When relayd relays a connection upgrade to a websocket, it relays
the outbound "Connection: Upgrade" header from the interal server.

It also tags on a "Connection: close" header to the outbound
response - ie the response goes out with two "Connection"
header lines.

Chrome and Netscape work despite the double upgrade/close connection 
headers. Safari fails.

Small patch below against 6.8 to only send the "Connection: close"
header if we are not handling a http_status 101.

Thanks,
Jonathon


cvs -q -d /cvs diff -ub -rOPENBSD_6_8 usr.sbin/relayd/relay_http.c


Index: usr.sbin/relayd/relay_http.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/relay_http.c,v
retrieving revision 1.79
diff -u -p -u -b -r1.79 relay_http.c
--- usr.sbin/relayd/relay_http.c        4 Sep 2020 13:09:14 -0000       1.79
+++ usr.sbin/relayd/relay_http.c        6 Mar 2021 19:46:56 -0000
@@ -526,7 +526,7 @@ relay_read_http(struct bufferevent *bev,
                 * Ask the server to close the connection after this request
                 * since we don't read any further request headers.
                 */
-               if (cre->toread == TOREAD_UNLIMITED)
+               if (cre->toread == TOREAD_UNLIMITED && desc->http_status != 101)
                        if (kv_add(&desc->http_headers, "Connection",
                            "close", 0) == NULL)
                                goto fail;

Reply via email to