bwi/v2.3.0 #29
@ -43,13 +43,6 @@ class WebSocket {
|
|||||||
RublonEventData * currentEvent{nullptr};
|
RublonEventData * currentEvent{nullptr};
|
||||||
std::pmr::string proxyUrl{};
|
std::pmr::string proxyUrl{};
|
||||||
|
|
||||||
// constexpr static const struct lws_protocol_vhost_options pvo = {
|
|
||||||
// NULL, /* "next" pvo linked-list /
|
|
||||||
// &pvo_proxy_uri, / "child" pvo linked-list /
|
|
||||||
// "push_protocol", / protocol name we belong to on this vhost /
|
|
||||||
// "" / ignored */
|
|
||||||
// };
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WebSocket(const Configuration & config) : _config{config}, urlv{_config.get().apiServer}, proxyUrl{_config.get().apiServer.get_allocator()} {
|
WebSocket(const Configuration & config) : _config{config}, urlv{_config.get().apiServer}, proxyUrl{_config.get().apiServer.get_allocator()} {
|
||||||
const auto & cfg = _config.get(); // only a alias to not use _config.get() all the time
|
const auto & cfg = _config.get(); // only a alias to not use _config.get() all the time
|
||||||
@ -70,7 +63,11 @@ class WebSocket {
|
|||||||
log(rlevel, "libwesockets: %s", line);
|
log(rlevel, "libwesockets: %s", line);
|
||||||
};
|
};
|
||||||
|
|
||||||
lws_set_log_level(LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | LLL_DEBUG | LLL_HEADER, lws_log_emit);
|
if(_config.get().logging) {
|
||||||
|
lws_set_log_level(LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | LLL_DEBUG | LLL_HEADER, lws_log_emit);
|
||||||
|
} else {
|
||||||
|
lws_set_log_level(LLL_ERR | LLL_WARN, lws_log_emit);
|
||||||
|
}
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
memset(&ccinfo, 0, sizeof(ccinfo));
|
memset(&ccinfo, 0, sizeof(ccinfo));
|
||||||
@ -85,8 +82,8 @@ class WebSocket {
|
|||||||
log(LogLevel::Debug, "WebSocket using proxy");
|
log(LogLevel::Debug, "WebSocket using proxy");
|
||||||
|
|
||||||
// "username:password\@server:port"
|
// "username:password\@server:port"
|
||||||
proxyUrl.reserve(conservative_estimate(cfg.proxyUsername, cfg.proxyPass, cfg.proxyHost) + 10);
|
|
||||||
if(cfg.proxyAuthRequired) {
|
if(cfg.proxyAuthRequired) {
|
||||||
|
proxyUrl.reserve(conservative_estimate(cfg.proxyUsername, cfg.proxyPass, cfg.proxyHost) + 10);
|
||||||
proxyUrl += *cfg.proxyUsername;
|
proxyUrl += *cfg.proxyUsername;
|
||||||
proxyUrl += ":";
|
proxyUrl += ":";
|
||||||
proxyUrl += *cfg.proxyPass;
|
proxyUrl += *cfg.proxyPass;
|
||||||
@ -96,7 +93,7 @@ class WebSocket {
|
|||||||
proxyUrl += *cfg.proxyHost;
|
proxyUrl += *cfg.proxyHost;
|
||||||
log(LogLevel::Debug, "WebSocket proxy %s", proxyUrl.c_str());
|
log(LogLevel::Debug, "WebSocket proxy %s", proxyUrl.c_str());
|
||||||
info.http_proxy_address = proxyUrl.c_str();
|
info.http_proxy_address = proxyUrl.c_str();
|
||||||
info.http_proxy_port = config.proxyPort.value_or(8080);
|
info.http_proxy_port = config.proxyPort.value_or(8080);
|
||||||
}
|
}
|
||||||
|
|
||||||
context = lws_create_context(&info);
|
context = lws_create_context(&info);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user