proxy: fix automatic tunnel mode with "connect to host"
No binary (build failed)
—
(log yok)
| @@ -2100,7 +2100,7 @@ static CURLcode url_create_needle(struct Curl_easy *data, | |
| Curl_hash_str, curlx_str_key_compare, conn_meta_freeentry); | |
| /************************************************************* | |
| - | * Determine `conn->origin` and propulate `data->state.up` and |
| + | * Determine `conn->origin` and populate `data->state.up` and |
| * other URL related properties. | |
| *************************************************************/ | |
| result = url_set_conn_origin_etc(data, needle); | |
| @@ -2135,6 +2135,15 @@ static CURLcode url_create_needle(struct Curl_easy *data, | |
| goto out; | |
| } | |
| + | /************************************************************* |
| + | * Check whether the host and the "connect to host" are equal. |
| + | * Do this after the hostnames have been IDN-converted and |
| + | * before initializing the proxy. |
| + | *************************************************************/ |
| + | if(Curl_peer_equal(needle->origin, needle->via_peer)) { |
| + | Curl_peer_unlink(&needle->via_peer); |
| + | } |
| + | |
| #ifndef CURL_DISABLE_PROXY | |
| /* Going via a unix socket ignores any proxy settings */ | |
| if(network_scheme && | |
| @@ -2149,14 +2158,6 @@ static CURLcode url_create_needle(struct Curl_easy *data, | |
| if(result) | |
| goto out; | |
| - | /************************************************************* |
| - | * Check whether the host and the "connect to host" are equal. |
| - | * Do this after the hostnames have been IDN-converted. |
| - | *************************************************************/ |
| - | if(Curl_peer_equal(needle->origin, needle->via_peer)) { |
| - | Curl_peer_unlink(&needle->via_peer); |
| - | } |
| - | |
| /************************************************************* | |
| * Setup internals depending on protocol. Needs to be done after | |
| * we figured out what/if proxy to use. | |
| @@ -50,7 +50,8 @@ http-proxy | |
| </name> | |
| <command> | |
| - | http://www.example.com.%TESTNUMBER/%TESTNUMBER --connect-to ::connect.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT |
| + | http://www.example.com.%TESTNUMBER/%TESTNUMBER --connect-to ::connect.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT --next |
| + | http://www.example.com.%TESTNUMBER:%HTTPPORT/%TESTNUMBER --connect-to ::www.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT |
| </command> | |
| <features> | |
| proxy | |
| @@ -59,12 +60,18 @@ proxy | |
| # Verify data after the test has been "shot" | |
| <verify> | |
| - | <proxy crlf="headers"> |
| + | <proxy crlf="yes"> |
| CONNECT connect.example.com.%TESTNUMBER:%HTTPPORT HTTP/1.1 | |
| Host: connect.example.com.%TESTNUMBER:%HTTPPORT | |
| User-Agent: curl/%VERSION | |
| Proxy-Connection: Keep-Alive | |
| + | GET http://www.example.com.%TESTNUMBER:%HTTPPORT/%TESTNUMBER HTTP/1.1 |
| + | Host: www.example.com.%TESTNUMBER:%HTTPPORT |
| + | User-Agent: curl/%VERSION |
| + | Accept: */* |
| + | Proxy-Connection: Keep-Alive |
| + | |
| </proxy> | |
| <protocol crlf="headers"> | |
| GET /%TESTNUMBER HTTP/1.1 | |
| @@ -54,18 +54,25 @@ socks5 | |
| proxy | |
| </features> | |
| <command> | |
| - | http://www.example.com.%TESTNUMBER/%TESTNUMBER --connect-to ::connect.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT --preproxy socks5://%HOSTIP:%SOCKSPORT |
| + | http://www.example.com.%TESTNUMBER/%TESTNUMBER --connect-to ::connect.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT --preproxy socks5://%HOSTIP:%SOCKSPORT --next |
| + | http://www.example.com.%TESTNUMBER:%HTTPPORT/%TESTNUMBER --connect-to ::www.example.com.%TESTNUMBER:%HTTPPORT -x %HOSTIP:%PROXYPORT --preproxy socks5://%HOSTIP:%SOCKSPORT |
| </command> | |
| </client> | |
| # Verify data after the test has been "shot" | |
| <verify> | |
| - | <proxy crlf="headers"> |
| + | <proxy crlf="yes"> |
| CONNECT connect.example.com.%TESTNUMBER:%HTTPPORT HTTP/1.1 | |
| Host: connect.example.com.%TESTNUMBER:%HTTPPORT | |
| User-Agent: curl/%VERSION | |
| Proxy-Connection: Keep-Alive | |
| + | GET http://www.example.com.%TESTNUMBER:%HTTPPORT/%TESTNUMBER HTTP/1.1 |
| + | Host: www.example.com.%TESTNUMBER:%HTTPPORT |
| + | User-Agent: curl/%VERSION |
| + | Accept: */* |
| + | Proxy-Connection: Keep-Alive |
| + | |
| </proxy> | |
| <protocol crlf="headers"> | |
| GET /%TESTNUMBER HTTP/1.1 | |