Fix proxy for websockets

This commit is contained in:
Bartosz Wieczorek 2025-06-25 19:13:21 +02:00
parent 677ba438be
commit 6747caa56c

View File

@ -87,7 +87,7 @@ class WebSocket {
log(LogLevel::Debug, "WebSocket using proxy");
// "username:password\@server:port"
proxyUrl.reserve(conservative_estimate(cfg.proxyUsername, cfg.proxyPass, cfg.proxyHost, cfg.proxyPort) + 10);
proxyUrl.reserve(conservative_estimate(cfg.proxyUsername, cfg.proxyPass, cfg.proxyHost) + 10);
if(cfg.proxyAuthRequired) {
proxyUrl += *cfg.proxyUsername;
proxyUrl += ":";
@ -96,15 +96,7 @@ class WebSocket {
}
proxyUrl += *cfg.proxyHost;
if(cfg.proxyPort.value_or(0) > 0) {
proxyUrl += ":";
proxyUrl += std::to_string(*cfg.proxyPort);
}
// Set environment variable for libwebsockets to pick up
log(LogLevel::Debug, "WebSocket proxy %s", proxyUrl.c_str());
info.http_proxy_address = proxyUrl.c_str();
info.http_proxy_port = config.proxyPort.value_or(8080);
}