[undertow-dev] Redirects during the handshake of a WebSocket upgrade request

electrotype electrotype at gmail.com
Mon Jul 4 20:43:12 EDT 2016


Hi,

I see some people think the HTTP request for a WebSocket upgrade shouldn't honnor 301/302 redirects. 
But the spec seems to say it is ok:

"/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 server MAY redirect the client using a 3xx status code//
//[RFC2616].  Note that this step can happen together with, before,//
//or after the optional authentication step described above./"

https://tools.ietf.org/html/rfc6455

In the version of Undertow I use, 1.2.12.Final, I see that the redirect response is handled by 
/org.xnio.http.HttpUpgrade/ :

private void handleRedirect(final HttpUpgradeParser parser) {
     List<String> location = parser.getHeaders().get("location");
     future.setException(new RedirectException(msg.redirect(), parser.getResponseCode(), location == 
null ? null : location.get(0)));
}

Is it the same behavior in most recent Undertow releases?

Related discussion: https://github.com/sta/websocket-sharp/issues/42

Thanks,

Julien


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20160704/fea69c1c/attachment.html 


More information about the undertow-dev mailing list