]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: http: refrain from sending "Connection: close" when Upgrade is present
authorWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 21:19:57 +0000 (22:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 21:40:00 +0000 (22:40 +0100)
commit50fc7777c645ee1f647181f27aaad06778d9f55d
tree52875c1574838512fe52ac75fcfc12258e56a797
parent70c6fd82c33b0fb34a92010a888d2e4e3168b169
MEDIUM: http: refrain from sending "Connection: close" when Upgrade is present

Some servers are not totally HTTP-compliant when it comes to parsing the
Connection header. This is particularly true with WebSocket where it happens
from time to time that a server doesn't support having a "close" token along
with the "Upgrade" token in the Connection header. This broken behaviour has
also been noticed on some clients though the problem is less frequent on the
response path.

Sometimes the workaround consists in enabling "option http-pretend-keepalive"
to leave the request Connection header untouched, but this is not always the
most convenient solution. This patch introduces a new solution : haproxy now
also looks for the "Upgrade" token in the Connection header and if it finds
it, then it refrains from adding any other token to the Connection header
(though "keep-alive" and "close" may still be removed if found). The same is
done for the response headers.

This way, WebSocket much with less changes even when facing non-compliant
clients or servers. At least it fixes the DISCONNECT issue that was seen
on the websocket.org test.

Note that haproxy does not change its internal mode, it just refrains from
adding new tokens to the connection header.
include/types/proto_http.h
src/proto_http.c