-
-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websockets 14 does not accept Transfer-Encoding header in error responses #1550
Comments
This is happening because the legacy implementation didn't even attempt to read the HTTP response body. I added that functionality in the standard case but not in the chunked encoding case. I believe that #1549 will wrap that error in an I could make an argument for skipping the body rather than crashing in this case. Let me think about it. |
I forgot to mention — as a short term fix, you can use |
Thanks! I guess I'll go with the legacy code for now. For the record, though, I don't really care about the message body in this case, and I don't mind altering my code, I just need some way to figure out the error code. |
Yes, it's a legitimate request for improvement. The HTTP code is right there and it's reasonable to expect websockets to give it to you. |
I took a stab at fixing it in #1568. I wanted to test against a real life server rather than just my test suite but I couldn't find one in 15 minutes and I'm not really excited with the idea of installing Erlang and Cowboy locally (-: Any chance you can test the branch before I merge the PR? |
Thanks for looking into it, I can confirm that the issue-1550 branch fixes the problem on my end! |
Great, thank you for reporting this issue and testing the fix! |
After upgrading to websockets 14, websockets.connect is raising the exception
NotImplementedError: transfer codings aren't supported
in a scenario that previously raised InvalidStatusCode (503). I was expecting it to change to InvalidStatus, which would have been fine, but even if I catch the NotImplementedError, there is no way to extract an error code from it. The issue arises when my server, in response to the websocket upgrade request returns a 503 error, withtransfer-encoding: chunked
and then a short error message in the body. While it could be argued that this particular message could just use Content-Length rather than chunked encoding, this does seem like a regression on the part of websockets.The entire back and forth looks something like this.
Request (sent with websockets 14.1):
Response:
The text was updated successfully, but these errors were encountered: