mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
http_proxy: fixes
This commit is contained in:
parent
1bd08c3941
commit
0516966d7d
4 changed files with 12 additions and 5 deletions
|
@ -141,7 +141,7 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i)
|
|||
wsi->user_space = NULL;
|
||||
wsi->pending_timeout = NO_PENDING_TIMEOUT;
|
||||
wsi->position_in_fds_table = LWS_NO_FDS_POS;
|
||||
wsi->c_port = i->port;
|
||||
wsi->ocport = wsi->c_port = i->port;
|
||||
|
||||
wsi->protocol = &wsi->vhost->protocols[0];
|
||||
wsi->client_pipeline = !!(i->ssl_connection & LCCSCF_PIPELINE);
|
||||
|
|
|
@ -689,7 +689,7 @@ struct lws {
|
|||
#endif
|
||||
|
||||
#ifndef LWS_NO_CLIENT
|
||||
unsigned short c_port;
|
||||
unsigned short ocport, c_port;
|
||||
#endif
|
||||
|
||||
/* chars */
|
||||
|
|
|
@ -422,10 +422,14 @@ create_new_conn:
|
|||
* Priority 1: connect to http proxy */
|
||||
|
||||
if (wsi->vhost->http.http_proxy_port) {
|
||||
|
||||
lwsl_info("%s: going via proxy\n", __func__);
|
||||
|
||||
plen = lws_snprintf((char *)pt->serv_buf, 256,
|
||||
"CONNECT %s:%u HTTP/1.0\x0d\x0a"
|
||||
"Host: %s:%u\x0d\x0a"
|
||||
"User-agent: libwebsockets\x0d\x0a",
|
||||
ads, wsi->c_port);
|
||||
ads, wsi->ocport, ads, wsi->ocport);
|
||||
|
||||
if (wsi->vhost->proxy_basic_auth_token[0])
|
||||
plen += lws_snprintf((char *)pt->serv_buf + plen, 256,
|
||||
|
|
|
@ -291,14 +291,17 @@ socks_reply_fail:
|
|||
}
|
||||
|
||||
pt->serv_buf[13] = '\0';
|
||||
if (strncmp(sb, "HTTP/1.0 200 ", 13) &&
|
||||
strncmp(sb, "HTTP/1.1 200 ", 13)) {
|
||||
if (n < 13 || (strncmp(sb, "HTTP/1.0 200 ", 13) &&
|
||||
strncmp(sb, "HTTP/1.1 200 ", 13))) {
|
||||
lwsl_err("%s: ERROR proxy did not reply with h1\n",
|
||||
__func__);
|
||||
/* lwsl_hexdump_notice(sb, n); */
|
||||
cce = "proxy not h1";
|
||||
goto bail3;
|
||||
}
|
||||
|
||||
lwsl_info("%s: proxy connection extablished\n", __func__);
|
||||
|
||||
/* clear his proxy connection timeout */
|
||||
|
||||
lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue