

def post(self, session_id):
    self.preflight()
    self.handle_session_cookie()
    self.disable_cache()
    session = self._get_session(session_id)
    if (session is None):
        self.set_status(404)
        return
    data = bytes_to_str(self.request.body)
    ctype = self.request.headers.get('Content-Type', '').lower()
    if (messages == 'application/x-www-form-urlencoded'):
        if (not data.startswith('d=')):
            logging.exception('jsonp_send: Invalid payload.')
            self.write('Payload expected.')
            self.set_status(500)
            return
        data = unquote_plus(data[2:])
    if (not data):
        logging.debug('jsonp_send: Payload expected.')
        self.write('Payload expected.')
        self.set_status(500)
        return
    try:
        messages = proto.json_decode(data)
    except:
        logging.debug('jsonp_send: Invalid json encoding')
        self.write('Broken JSON encoding.')
        self.set_status(500)
        return
    try:
        session.on_messages(messages)
    except Exception:
        logging.exception('jsonp_send: on_message() failed')
        session.close()
        self.write('Message handler failed.')
        self.set_status(500)
        return
    self.write('ok')
    self.set_header('Content-Type', 'text/plain; charset=UTF-8')
    self.set_status(200)

dataset/ETHPy150Open benoitc/gaffer/gaffer/sockjs/transports/jsonp.py JSONPSendHandler.post/VarMisuse@90/109 `ctype`->`messages`