Loading lib/http_proxy.c +40 −15 Original line number Diff line number Diff line Loading @@ -135,13 +135,9 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex) return CURLE_OK; } /* * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This * function will issue the necessary commands to get a seamless tunnel through * this proxy. After that, the socket can be used just as a normal socket. */ #define CONNECT_BUFFER_SIZE 16384 CURLcode Curl_proxyCONNECT(struct connectdata *conn, static CURLcode CONNECT(struct connectdata *conn, int sockindex, const char *hostname, int remote_port) Loading Loading @@ -299,17 +295,17 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, char *ptr; char *line_start; ptr = data->state.buffer; ptr = conn->connect_buffer; line_start = ptr; nread = 0; perline = 0; while(nread < BUFSIZE && keepon && !error) { while(nread < (size_t)CONNECT_BUFFER_SIZE && keepon && !error) { if(Curl_pgrsUpdate(conn)) return CURLE_ABORTED_BY_CALLBACK; if(ptr >= &data->state.buffer[BUFSIZE]) { if(ptr >= &conn->connect_buffer[CONNECT_BUFFER_SIZE]) { failf(data, "CONNECT response too large!"); return CURLE_RECV_ERROR; } Loading Loading @@ -358,7 +354,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* This means we are currently ignoring a response-body */ nread = 0; /* make next read start over in the read buffer */ ptr = data->state.buffer; ptr = conn->connect_buffer; if(cl) { /* A Content-Length based body: simply count down the counter and make sure to break out of the loop when we're done! */ Loading Loading @@ -430,7 +426,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* end of response-headers from the proxy */ nread = 0; /* make next read start over in the read buffer */ ptr = data->state.buffer; ptr = conn->connect_buffer; if((407 == k->httpcode) && !data->state.authproblem) { /* If we get a 407 response code with content length when we have no auth problem, we must ignore the Loading Loading @@ -543,7 +539,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, } perline = 0; /* line starts over here */ ptr = data->state.buffer; ptr = conn->connect_buffer; line_start = ptr; } /* while there's buffer left and loop is requested */ Loading Loading @@ -628,4 +624,33 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, document request */ return CURLE_OK; } /* * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This * function will issue the necessary commands to get a seamless tunnel through * this proxy. After that, the socket can be used just as a normal socket. */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, int sockindex, const char *hostname, int remote_port) { CURLcode result; if(TUNNEL_INIT == conn->tunnel_state[sockindex]) { if(!conn->connect_buffer) { conn->connect_buffer = malloc(CONNECT_BUFFER_SIZE); if(!conn->connect_buffer) return CURLE_OUT_OF_MEMORY; } } result = CONNECT(conn, sockindex, hostname, remote_port); if(result || (TUNNEL_COMPLETE == conn->tunnel_state[sockindex])) Curl_safefree(conn->connect_buffer); return result; } #endif /* CURL_DISABLE_PROXY */ lib/url.c +1 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,7 @@ static void conn_free(struct connectdata *conn) Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */ Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */ Curl_safefree(conn->master_buffer); Curl_safefree(conn->connect_buffer); conn_reset_all_postponed_data(conn); Loading lib/urldata.h +1 −0 Original line number Diff line number Diff line Loading @@ -1144,6 +1144,7 @@ struct connectdata { struct connectbundle *bundle; /* The bundle we are member of */ int negnpn; /* APLN or NPN TLS negotiated protocol, CURL_HTTP_VERSION* */ char *connect_buffer; /* for CONNECT business */ #ifdef USE_UNIX_SOCKETS char *unix_domain_socket; Loading Loading
lib/http_proxy.c +40 −15 Original line number Diff line number Diff line Loading @@ -135,13 +135,9 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex) return CURLE_OK; } /* * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This * function will issue the necessary commands to get a seamless tunnel through * this proxy. After that, the socket can be used just as a normal socket. */ #define CONNECT_BUFFER_SIZE 16384 CURLcode Curl_proxyCONNECT(struct connectdata *conn, static CURLcode CONNECT(struct connectdata *conn, int sockindex, const char *hostname, int remote_port) Loading Loading @@ -299,17 +295,17 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, char *ptr; char *line_start; ptr = data->state.buffer; ptr = conn->connect_buffer; line_start = ptr; nread = 0; perline = 0; while(nread < BUFSIZE && keepon && !error) { while(nread < (size_t)CONNECT_BUFFER_SIZE && keepon && !error) { if(Curl_pgrsUpdate(conn)) return CURLE_ABORTED_BY_CALLBACK; if(ptr >= &data->state.buffer[BUFSIZE]) { if(ptr >= &conn->connect_buffer[CONNECT_BUFFER_SIZE]) { failf(data, "CONNECT response too large!"); return CURLE_RECV_ERROR; } Loading Loading @@ -358,7 +354,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* This means we are currently ignoring a response-body */ nread = 0; /* make next read start over in the read buffer */ ptr = data->state.buffer; ptr = conn->connect_buffer; if(cl) { /* A Content-Length based body: simply count down the counter and make sure to break out of the loop when we're done! */ Loading Loading @@ -430,7 +426,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* end of response-headers from the proxy */ nread = 0; /* make next read start over in the read buffer */ ptr = data->state.buffer; ptr = conn->connect_buffer; if((407 == k->httpcode) && !data->state.authproblem) { /* If we get a 407 response code with content length when we have no auth problem, we must ignore the Loading Loading @@ -543,7 +539,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, } perline = 0; /* line starts over here */ ptr = data->state.buffer; ptr = conn->connect_buffer; line_start = ptr; } /* while there's buffer left and loop is requested */ Loading Loading @@ -628,4 +624,33 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, document request */ return CURLE_OK; } /* * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This * function will issue the necessary commands to get a seamless tunnel through * this proxy. After that, the socket can be used just as a normal socket. */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, int sockindex, const char *hostname, int remote_port) { CURLcode result; if(TUNNEL_INIT == conn->tunnel_state[sockindex]) { if(!conn->connect_buffer) { conn->connect_buffer = malloc(CONNECT_BUFFER_SIZE); if(!conn->connect_buffer) return CURLE_OUT_OF_MEMORY; } } result = CONNECT(conn, sockindex, hostname, remote_port); if(result || (TUNNEL_COMPLETE == conn->tunnel_state[sockindex])) Curl_safefree(conn->connect_buffer); return result; } #endif /* CURL_DISABLE_PROXY */
lib/url.c +1 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,7 @@ static void conn_free(struct connectdata *conn) Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */ Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */ Curl_safefree(conn->master_buffer); Curl_safefree(conn->connect_buffer); conn_reset_all_postponed_data(conn); Loading
lib/urldata.h +1 −0 Original line number Diff line number Diff line Loading @@ -1144,6 +1144,7 @@ struct connectdata { struct connectbundle *bundle; /* The bundle we are member of */ int negnpn; /* APLN or NPN TLS negotiated protocol, CURL_HTTP_VERSION* */ char *connect_buffer; /* for CONNECT business */ #ifdef USE_UNIX_SOCKETS char *unix_domain_socket; Loading