You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending message with special chars from client to server, socket-io throw an exception :
Traceback (most recent call last):
File "/var/www/.pyenv/versions/3.6.1/lib/python3.6/site-packages/engineio/server.py", line 279, in handle_request
socket.handle_post_request(environ)
File "/var/www/.pyenv/versions/3.6.1/lib/python3.6/site-packages/engineio/socket.py", line 104, in handle_post_request
p = payload.Payload(encoded_payload=body)
File "/var/www/.pyenv/versions/3.6.1/lib/python3.6/site-packages/engineio/payload.py", line 11, in __init__
self.decode(encoded_payload)
File "/var/www/.pyenv/versions/3.6.1/lib/python3.6/site-packages/engineio/payload.py", line 58, in decode
raise ValueError('invalid payload')
ValueError: invalid payload
My javascript code :
var socket = io.connect("http://XXX:XXX", {transports:["polling"]});
socket.emit("my_event", {"data": "ééé"});
I try to modify "payload.py", and i find an exception on this line : fixed_payload = encoded_payload.decode('utf-8').encode('raw_unicode_escape')
"encoded_payload" isn't decoded because an exception was throw. Adding encoded_payload = encoded_payload.decode('utf-8') in the except block resolve my problem, but i think it's not the best solution.
Python version : Python 3.6.1
Javascript Socket-IO version : 2.0.1
That line that is failing was added there to compensate for a bug in a few releases of the Socket.IO JavaScript client. They have probably changed the client in the 2.x that causes things to break in a different way. I'll have to see what I can figure out to keep this fix for the 1.x socket.io clients, while allowing the 2.x to work as well.
Hi Miguel,
When sending message with special chars from client to server, socket-io throw an exception :
My javascript code :
I try to modify "payload.py", and i find an exception on this line :
fixed_payload = encoded_payload.decode('utf-8').encode('raw_unicode_escape')
"encoded_payload" isn't decoded because an exception was throw. Adding
encoded_payload = encoded_payload.decode('utf-8')
in the except block resolve my problem, but i think it's not the best solution.Python version : Python 3.6.1
Javascript Socket-IO version : 2.0.1
Python packages :
Flask==0.12.1
Flask-SocketIO==2.8.6
python-engineio==1.5.2
python-socketio==1.7.4
eventlet==0.21.0
The text was updated successfully, but these errors were encountered: