From 2f8d0df085519351dbd7123178895ba910d756c1 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 18 Feb 2017 13:56:56 +0100 Subject: proxy: fix hostname resolution and IDN conversion Properly resolve, convert and log the proxy host names. Support the "--connect-to" feature for SOCKS proxies and for passive FTP data transfers. Follow-up to cb4e2be Reported-by: Jay Satiro Fixes https://github.com/curl/curl/issues/1248 --- tests/data/Makefile.inc | 4 +-- tests/data/test2055 | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test712 | 1 - tests/data/test713 | 49 ++++++++++++++++++++++++++++++ tests/data/test714 | 64 +++++++++++++++++++++++++++++++++++++++ tests/data/test715 | 66 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 261 insertions(+), 3 deletions(-) create mode 100755 tests/data/test2055 create mode 100755 tests/data/test713 create mode 100755 tests/data/test714 create mode 100755 tests/data/test715 (limited to 'tests/data') diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 953916d97..33dce05d8 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -80,7 +80,7 @@ test626 test627 test628 test629 test630 test631 test632 test633 test634 \ test635 test636 test637 test638 test639 test640 test641 \ \ test700 test701 test702 test703 test704 test705 test706 test707 test708 \ -test709 test710 test711 test712 \ +test709 test710 test711 test712 test713 test714 test715 \ \ test800 test801 test802 test803 test804 test805 test806 test807 test808 \ test809 test810 test811 test812 test813 test814 test815 test816 test817 \ @@ -176,4 +176,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 test2049 test2050 test2051 test2052 test2053 test2054 +test2048 test2049 test2050 test2051 test2052 test2053 test2054 test2055 diff --git a/tests/data/test2055 b/tests/data/test2055 new file mode 100755 index 000000000..cca44942f --- /dev/null +++ b/tests/data/test2055 @@ -0,0 +1,80 @@ + + + +HTTP +HTTP GET +HTTP CONNECT +HTTP proxy +proxytunnel +CURLOPT_CONNECT_TO +SOCKS5 + + + +# +# 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 +socks5 + + +Connect to specific host via SOCKS proxy and HTTP proxy (switch to tunnel mode automatically) + + + +http://www.example.com.2055/2055 --connect-to ::connect.example.com.2055:%HTTPPORT -x %HOSTIP:%PROXYPORT --preproxy socks5://%HOSTIP:%SOCKSPORT + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +CONNECT connect.example.com.2055:%HTTPPORT HTTP/1.1 +Host: connect.example.com.2055:%HTTPPORT +Proxy-Connection: Keep-Alive + + + +GET /2055 HTTP/1.1 +Host: www.example.com.2055 +Accept: */* + + + + + diff --git a/tests/data/test712 b/tests/data/test712 index c62e9f2c5..252c9ef0e 100644 --- a/tests/data/test712 +++ b/tests/data/test712 @@ -6,7 +6,6 @@ FTP PASV RETR SOCKS5 -all_proxy # diff --git a/tests/data/test713 b/tests/data/test713 new file mode 100755 index 000000000..bb79994f5 --- /dev/null +++ b/tests/data/test713 @@ -0,0 +1,49 @@ + +#based off test 712 + + +FTP +PASV +RETR +SOCKS5 +CURLOPT_CONNECT_TO + + +# +# Server-side + + +silly content + + + +# +# Client-side + + +ftp +socks5 + + +FTP fetch with --proxy set to socks5:// and with --connect-to + + +ftp://ftp.example.com/713 --connect-to ::%HOSTIP:%FTPPORT --proxy socks5://%HOSTIP:%SOCKSPORT + + + +# +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE 713 +RETR 713 +QUIT + + + diff --git a/tests/data/test714 b/tests/data/test714 new file mode 100755 index 000000000..9d1f0a96e --- /dev/null +++ b/tests/data/test714 @@ -0,0 +1,64 @@ + +#based off test 712 + + +FTP +PASV +RETR +HTTP +HTTP CONNECT +proxytunnel +CURLOPT_CONNECT_TO + + +# +# Server-side + + +HTTP/1.1 200 Connection established + + + + +silly content + + + +HTTP/1.1 200 Connection established + +HTTP/1.1 200 Connection established + +silly content + + + +# +# Client-side + + +ftp +http-proxy + + +FTP fetch with --proxy set to http:// and with --connect-to + + +ftp://ftp.example.com.714/714 --connect-to ::connect.example.com.714:%FTPPORT --proxytunnel --proxy http://%HOSTIP:%PROXYPORT + + + +# +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE 714 +RETR 714 +QUIT + + + diff --git a/tests/data/test715 b/tests/data/test715 new file mode 100755 index 000000000..ffcfc7e3e --- /dev/null +++ b/tests/data/test715 @@ -0,0 +1,66 @@ + +#based off test 712 + + +FTP +PASV +RETR +HTTP +HTTP CONNECT +proxytunnel +SOCKS5 +CURLOPT_CONNECT_TO + + +# +# Server-side + + +HTTP/1.1 200 Connection established + + + + +silly content + + + +HTTP/1.1 200 Connection established + +HTTP/1.1 200 Connection established + +silly content + + + +# +# Client-side + + +ftp +http-proxy +socks5 + + +FTP fetch with --preproxy, --proxy and --connect-to + + +ftp://ftp.example.com.715/715 --connect-to ::connect.example.com.715:%FTPPORT --proxytunnel --proxy %HOSTIP:%PROXYPORT --preproxy socks5://%HOSTIP:%SOCKSPORT + + + +# +# Verify data after the test has been "shot" + + +USER anonymous +PASS ftp@example.com +PWD +EPSV +TYPE I +SIZE 715 +RETR 715 +QUIT + + + -- cgit v1.2.3