On 03/18/2015 10:01 AM, Yann Ylavic wrote:
On Wed, Mar 18, 2015 at 9:48 AM, Jan Kaluža <jkal...@redhat.com> wrote:
On 03/18/2015 09:23 AM, Yann Ylavic wrote:

On Wed, Mar 18, 2015 at 8:07 AM, Jan Kaluža <jkal...@redhat.com> 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.

What's going on here is that backend does not reply anything. proxy_wstunnel_transfer returns APR_EOF without receiving "101 Switching Protocols" from the backend and without passing anything to the client. We could check if APR_EOF happens before "101 Switching Protocols" and send HTTP error to client, right?


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.


Reply via email to