fre 2009-07-17 klockan 16:32 +1200 skrev Amos Jeffries:
> 3.1.5.1
> Connect to the server given by /host/ on port 80 and ask it to
> upgrade from HTTP to WebSockets.
>
> The client must send only the following lines:
>
> GET /thepath/ HTTP/1.1
> Host: /host/
> Upgrade: WebSockets
> Connection: Upgrade
>
> terminated by two CRLF as per HTTP specification.
Per HTTP specifications the client SHOULD send more lines, in specific
the User-Agent.
> 3.1.5.2
> A server receiving the request SHOULD ignore any other headers
> received with the request.
>
> If any data following the headers is received then fail the
> WebSocket connection. The server MUST discard any body data
> received with an Upgrade request. It MAY respond with a 4xx or
> 5xx HTTP error code from the HTTP specification.
No, only 4xx. It's the request that is in error for being an WebSockets
Upgrade request, not the server.
But per HTTP specifications such body data is part of the HTTP Upgrade
request and should be ignored if switching protocols as part of ignoring
the HTTP request which contained the Upgrade request. Consider for
example if the request is a POST request, containing a alternative
simplex representation of the communication meant to be used by a
non-WebSockets server.
> 3.1.5.4
> A server receiving a valid HTTP Upgrade request to WebSockets
> and which does not accept that WebSockets upgrade MUST send back
> a 4xx or 5xx HTTP response as per section 3.1.5.2.
There is no such requirement in HTTP. Handling Upgrade is purely
optional and the server is free to ignore Upgrade. Upgrade is a "please
upgrade to one of these protocols if supported".
> The server SHOULD send only the following lines:
>
> HTTP/1.1 101 Web Socket Protocol Handshake
> Upgrade: WebSocket
> Connection: Upgrade
While it's true HTTP does not mandate any headers for 1xx responses,
including things like Server is a good idea in 101 responses, and there
may also be other headers required by the HTTP operation such as
Authentication-Info and possibly other headers as well in future
specifications.
Regards
Henrik
Received on Fri Jul 17 2009 - 08:28:55 MDT
This archive was generated by hypermail 2.2.0 : Fri Jul 17 2009 - 12:00:05 MDT