Dear all, After websockets support was added in relayd(8), https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/relayd/relay_http.c.diff?r1=1.71&r2=1.72&f=h the connections to services usging websockets are broken.
I checked what caused this breakage, and found that the check for the
"Connection" HTTP request header strictly checks for "Upgrade" value (line 402):
if (cre->dir == RELAY_DIR_REQUEST) {
if (strcasecmp("Connection", key) == 0 &&
strcasecmp("Upgrade", value) == 0)
priv->http_upgrade_req |=
HTTP_CONNECTION_UPGRADE;
while the browser can also send (and sends)
Connection: keep-alive, Upgrade
Websockets work fine if I add keep-alive to the list of values, but I'm sure
this must be fixed in some other way,
--- usr.sbin/relayd/relay_http.c.orig Wed Apr 3 17:41:00 2019
+++ usr.sbin/relayd/relay_http.c Wed Apr 3 21:31:37 2019
@@ -400,7 +400,8 @@
if (cre->line != 1) {
if (cre->dir == RELAY_DIR_REQUEST) {
if (strcasecmp("Connection", key) == 0 &&
- strcasecmp("Upgrade", value) == 0)
+ (strcasecmp("Upgrade", value) == 0 ||
+ strcasecmp("keep-alive, Upgrade", value) ==
0))
priv->http_upgrade_req |=
HTTP_CONNECTION_UPGRADE;
if (strcasecmp("Upgrade", key) == 0 &&
--
With best regards,
Pavel Korovin
