Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] websocket-client-9.0.0.M5 does not allow to handle failed upgrade request properly

I think the API of the websocket-client-9.0.0.M5 does not allow to
handle failed upgrade requests as mandated by the spec.

RFC6455 (p. 18) defines:

   Once the client's opening handshake has been sent, the client MUST
   wait for a response from the server before sending any further data.
   The client MUST validate the server's response as follows:

   1.  If the status code received from the server is not 101, the
       client handles the response per HTTP [RFC2616] procedures.  In
       particular, the client might perform authentication if it
       receives a 401 status code; the server might redirect the client
       using a 3xx status code (but clients are not required to follow
       them), etc.  Otherwise, proceed as follows.

The method ClientUpgradeResponse::validateWebSocketHash, however, only
checks for the presence of the Sec-WebSocket-Accept header and, if not
present, throws an UpgradeException. Maybe I'm missing something, but it
seems whenever the exception is being thrown, the original HTTP status
code (which was stored in the response before), is getting lost. That
does not allow me to handle such server errors.


Back to the top