Remove WSU() items forwarded & secure, since these are in webserver nowadays.

This commit is contained in:
Bram Matthys 2023-11-27 10:04:28 +01:00
parent 02ac1fc0b3
commit 026d5522a8
No known key found for this signature in database
GPG key ID: BF8116B163EAAE98
3 changed files with 4 additions and 13 deletions

View file

@ -1962,8 +1962,6 @@ struct WebSocketUser {
int lefttoparselen; /**< Length of lefttoparse buffer */
WebSocketType type; /**< WEBSOCKET_TYPE_BINARY or WEBSOCKET_TYPE_TEXT */
char *sec_websocket_protocol; /**< Only valid during parsing of the request, after that it is NULL again */
char *forwarded; /**< Unparsed `Forwarded:` header, RFC 7239 */
int secure; /**< If there is a Forwarded header, this indicates if the remote connection is secure */
};
#define WEBSOCKET_MAGIC_KEY "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" /* see RFC6455 */

View file

@ -347,11 +347,6 @@ int websocket_handle_request(Client *client, WebRequest *web)
{
/* Save it here, will be processed later */
safe_strdup(WSU(client)->sec_websocket_protocol, value);
} else
if (!strcasecmp(key, "Forwarded"))
{
/* will be processed later too */
safe_strdup(WSU(client)->forwarded, value);
}
}
@ -433,10 +428,6 @@ int websocket_handle_request(Client *client, WebRequest *web)
}
}
/* If using a proxy, set the secure flag depending on what the proxy said */
if (WEB(client)->forwarded)
WSU(client)->secure = WEB(client)->forwarded->secure;
websocket_handshake_send_response(client);
return 1;
}
@ -447,8 +438,11 @@ int websocket_secure_connect(Client *client)
* us that their [client]--[webirc gateway] connection is also
* secure (eg: using https)
*/
if (IsSecureConnect(client) && websocket_md && WSU(client) && WSU(client)->forwarded && !WSU(client)->secure)
if (IsSecureConnect(client) && websocket_md && WSU(client) &&
WEB(client)->forwarded && !WEB(client)->forwarded->secure)
{
client->umodes &= ~UMODE_SECURE;
}
return 0;
}

View file

@ -481,7 +481,6 @@ void websocket_mdata_free(ModData *m)
safe_free(wsu->handshake_key);
safe_free(wsu->lefttoparse);
safe_free(wsu->sec_websocket_protocol);
safe_free(wsu->forwarded);
safe_free(m->ptr);
}
}