Closed neoxic closed 2 years ago
This can be reproduced with a server that fails all handshakes with 400. In my case, the implementation failed a handshake due to Autobahn's Upgrade: WebSocket
instead of all lowercase Upgrade: websocket
.
As per RFC 6455:
4. Opening Handshake 4.1. Client Requirements ...
- The request MUST contain an |Upgrade| header field whose value MUST include the "websocket" keyword.
- The request MUST contain a |Connection| header field whose value MUST include the "Upgrade" token.
Please note that the "websocket" keyword must be all lowercase in contrast to the "Upgrade" token.
Please note that the "websocket" keyword must be all lowercase in contrast to the "Upgrade" token.
No, I don't believe so:
[4.1](https://datatracker.ietf.org/doc/html/rfc6455#section-4.1). Client Requirements
...
2. If the response lacks an |Upgrade| header field or the |Upgrade|
header field contains a value that is not an ASCII case-
insensitive match for the value "websocket", the client MUST
_Fail the WebSocket Connection_.
3. If the response lacks a |Connection| header field or the
|Connection| header field doesn't contain a token that is an
ASCII case-insensitive match for the value "Upgrade", the client
MUST _Fail the WebSocket Connection_.
So a client should accept even accept Upgrade: wEbSoCkeT
I guess you are actually right. I just gave it another try, and:
4.2.1. Reading the Client's Opening Handshake ....
- An |Upgrade| header field containing the value "websocket", treated as an ASCII case-insensitive value.
- A |Connection| header field that includes the token "Upgrade", treated as an ASCII case-insensitive value.
My bad.
no problem! I remember discussion around this in the IETF WG when the RFC was still in draft ... it really should contain more examples, probably including mixed-case, and it should not use lowercase only in 1 header, and camelcase for another. well. anyways, closing then ..
The Unhandled Error is still there though.:-) Upgrade: WebSocket
was just the way to trigger it. More presicely, a 400 Bad Request
response to every handshake, of course.
yes, not ideal. I should note: the testsuite contains hundreds of tests which together cover a lot of the spec - BUT: those are all for everything that happens after the initial HTTP upgrading request/response!! the testsuite does NOT contain any tests for the HTTP handshake. I wanted to add that "later" .. never got to it .. and it would be quite waste amount of work, simply because HTTP is so complex (at the very detail level), and because a 100% compliant HTTP might not work great in practice (because of all the broken shit that insists to continue eating shit) ... anyways, no time, sorry;)
That's ok, totally understand.:) Anyways, I'm grateful for the great yet not perfect test suite!:) Thank you!
I tried both Python2 and PyPy with no luck in testing my server. I follow the docs, but wstest fails in unhandled exception: