From cd8d23624594e21c37a0453459229a90a38ad471 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 25 Jan 2016 14:37:24 +0100 Subject: news: CURLOPT_CONNECT_TO and --connect-to Makes curl connect to the given host+port instead of the host+port found in the URL. --- tests/data/Makefile.inc | 2 +- tests/data/test2049 | 64 ++++++++++++++++++++++++++++++++++++++++ tests/data/test2050 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test2051 | 74 +++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test2052 | 68 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 tests/data/test2049 create mode 100644 tests/data/test2050 create mode 100644 tests/data/test2051 create mode 100644 tests/data/test2052 (limited to 'tests') diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index a13aac9b9..bc0ee4ce3 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -169,4 +169,4 @@ test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \ test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \ test2032 test2033 test2034 test2035 test2036 test2037 test2038 test2039 \ test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 \ -test2048 +test2048 test2049 test2050 test2051 test2052 diff --git a/tests/data/test2049 b/tests/data/test2049 new file mode 100644 index 000000000..efa576e98 --- /dev/null +++ b/tests/data/test2049 @@ -0,0 +1,64 @@ + + + +HTTP +HTTP GET +CURLOPT_CONNECT_TO + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK + + + +# +# Client-side + + +http + + +Connect to specific host + + + +http://www1.example.com:8081/2049 --connect-to ::%HOSTIP:%HTTPPORT --next http://www2.example.com:8082/2049 --connect-to :8082:%HOSTIP:%HTTPPORT --next http://www3.example.com:8083/2049 --connect-to www3.example.com::%HOSTIP:%HTTPPORT --next http://www4.example.com:8084/2049 --connect-to www4.example.com:8084:%HOSTIP:%HTTPPORT + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /2049 HTTP/1.1 +Host: www1.example.com:8081 +Accept: */* + +GET /2049 HTTP/1.1 +Host: www2.example.com:8082 +Accept: */* + +GET /2049 HTTP/1.1 +Host: www3.example.com:8083 +Accept: */* + +GET /2049 HTTP/1.1 +Host: www4.example.com:8084 +Accept: */* + + + + + diff --git a/tests/data/test2050 b/tests/data/test2050 new file mode 100644 index 000000000..805e872e4 --- /dev/null +++ b/tests/data/test2050 @@ -0,0 +1,77 @@ + + + +HTTP +HTTP GET +HTTP CONNECT +HTTP proxy +proxytunnel +CURLOPT_CONNECT_TO + + + +# +# Server-side + + +HTTP/1.1 200 Connection established + + + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK + + + +HTTP/1.1 200 Connection established + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK + + + +# +# Client-side + + +http +http-proxy + + +Connect to specific host via HTTP proxy (switch to tunnel mode automatically) + + + +http://www.example.com.2050/2050 --connect-to ::connect.example.com.2050:%HTTPPORT -x %HOSTIP:%PROXYPORT + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +CONNECT connect.example.com.2050:%HTTPPORT HTTP/1.1 +Host: connect.example.com.2050:%HTTPPORT + + + +GET /2050 HTTP/1.1 +Host: www.example.com.2050 +Accept: */* + + + + + diff --git a/tests/data/test2051 b/tests/data/test2051 new file mode 100644 index 000000000..e8c6bed1d --- /dev/null +++ b/tests/data/test2051 @@ -0,0 +1,74 @@ + + + +HTTP +HTTP GET +CURLOPT_CONNECT_TO + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK + + + +# +# Client-side + + +http + + +Connect to specific host: Re-use existing connections if possible + + + +http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" --next --connect-to ::%HOSTIP:%HTTPPORT http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" --next http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /2051 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + +GET /2051 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + +GET /2051 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + + + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +1 +OK +0 +OK +0 + + + + diff --git a/tests/data/test2052 b/tests/data/test2052 new file mode 100644 index 000000000..082002f2c --- /dev/null +++ b/tests/data/test2052 @@ -0,0 +1,68 @@ + + + +HTTP +HTTP GET +CURLOPT_CONNECT_TO + + + +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK + + + +# +# Client-side + + +http + + +Connect to specific host: Do not mix connections with and without a "connect to host" + + + +http://www.example.com:%HTTPPORT/2052 --resolve www.example.com:%HTTPPORT:%HOSTIP -w "%{num_connects}\n" --next --resolve -www.example.com:%HTTPPORT --connect-to ::%HOSTIP:%HTTPPORT http://www.example.com:%HTTPPORT/2052 -w "%{num_connects}\n" + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /2052 HTTP/1.1 +Host: www.example.com:%HTTPPORT +Accept: */* + +GET /2052 HTTP/1.1 +Host: www.example.com:%HTTPPORT +Accept: */* + + + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +1 +OK +1 + + + + -- cgit v1.2.3