On Wed, Mar 18, 2015 at 9:48 AM, Jan Kaluža <[email protected]> wrote: > On 03/18/2015 09:23 AM, Yann Ylavic wrote: >> >> On Wed, Mar 18, 2015 at 8:07 AM, Jan Kaluža <[email protected]> wrote: >>> >>> >>> I have no big knowledge of WebSockets, but it should be possible to >>> detect >>> Switching Protocol header and return HTTP error if some error happens >>> before >>> we switch to WebSocket. >>> >>> Would this be acceptable, or you think this empty reply is not worth >>> fixing >>> this way? >> >> >> The problem is that at this point (poll() loop), "101 Switching >> Protocol" is already sent to the backend, and hence the >> ap_proxy_pass_brigade() doing so in proxy_wstunnel_request() should >> already have failed with the correct status code returned to the >> handler. > > > Hm, I think I'm little bit confused how it's supposed to work. I thought > mod_proxy_wstunnel appends Upgrade and Connection header to the request's > headers, sends it to the backend and then the backend responds with "101 > Switching Protocols".
Yes, this is what's supposed to be done, with all but the backend's response happening before the poll() loop. That's why I wonder why, before that, there is no failure when the request (with appended Upgrade and Connection headers) is sent to the backend. > > But when reading the code now, it would mean that "101 Switch Protocols" is > forwarded to the client, which, I think, should not happen. This is not happening, ap_proxy_pass_brigade() forwards to the backend.
