summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-11-10 10:37:29 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-11-10 16:39:07 +0100
commite40a4a3e381a8cb6c8b924e9ce545512769bddff (patch)
tree317f088aef988abf6d872b53b88a111cf1eeddbf /test
parent28ee7f19b865c32ce1b03cc0afa26983a0208693 (diff)
improve SOCKS error messages for http slightly
The 0.0.0.0:0 tor reports is pretty useless by itself, but even if an IP would be reported it is better to show the user the hostname we wanted the proxy to connect to in the same error message. We improve upon it further by looking for this bind address in particular and remap error messages slightly to give users a better chance of figuring out what went wrong. Upstream Tor can't do that as it is technically wrong.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/skip-method-http-socks-client65
1 files changed, 55 insertions, 10 deletions
diff --git a/test/integration/skip-method-http-socks-client b/test/integration/skip-method-http-socks-client
index ee08f6d34..f4146a6d1 100755
--- a/test/integration/skip-method-http-socks-client
+++ b/test/integration/skip-method-http-socks-client
@@ -25,7 +25,7 @@ runclient() {
# this doesn't need to be an actually reachable webserver for this test
# in fact, its better if it isn't.
rm -f index.html
- apthelper download-file http://localhost:2903/ index.html \
+ apthelper download-file "http://${2:-localhost:2903}/" index.html \
-o Acquire::http::Proxy="socks5h://${1}localhost:5555" \
-o Acquire::http::Timeout=2 -o Debug::Acquire::http=1 > client.output 2>&1 || true
}
@@ -68,49 +68,94 @@ testsuccess grep 'reported authorization failure: username or password incorrect
msgmsg 'SOCKS user:pass request not granted no hostname'
runserver '05 02' '01 00' '05 01 00 03 00 1f 90'
runclient 'user:pass@'
-testsuccess grep 'grant the connect to :8080 due to: general SOCKS server failure (1)' client.output
+testsuccess grep 'could not connect to localhost (:8080) due to: general SOCKS server failure (1)' client.output
msgmsg 'SOCKS user:pass request not granted with hostname'
runserver '05 02' '01 00' '05 01 00 03 09 68 6f 73 74 6c 6f 63 61 6c 1f 90'
runclient 'user:pass@'
-testsuccess grep 'grant the connect to hostlocal:8080 due to: general SOCKS server failure (1)' client.output
+testsuccess grep 'could not connect to localhost (hostlocal:8080) due to: general SOCKS server failure (1)' client.output
msgmsg 'SOCKS user:pass request not granted ipv4'
runserver '05 02' '01 00' '05 04 00 01 ac 10 fe 01 1f 90'
runclient 'user:pass@'
-testsuccess grep 'grant the connect to 172.16.254.1:8080 due to: Host unreachable (4)' client.output
+testsuccess grep 'could not connect to localhost (172.16.254.1:8080) due to: Host unreachable (4)' client.output
msgmsg 'SOCKS user:pass request not granted ipv6'
runserver '05 02' '01 00' '05 12 00 04 20 01 0d b8 ac 10 fe 00 00 00 00 00 00 00 00 00 1f 90'
runclient 'user:pass@'
-testsuccess grep 'grant the connect to \[2001:0DB8:AC10:FE00:0000:0000:0000:0000\]:8080 due to: Unknown error (18)' client.output
+testsuccess grep 'could not connect to localhost (\[2001:0DB8:AC10:FE00:0000:0000:0000:0000\]:8080) due to: Unknown error (18)' client.output
msgmsg 'SOCKS user:pass request granted ipv4'
runserver '05 02' '01 00' '05 00 00 01 ac 10 fe 01 1f 90'
runclient 'user:pass@'
-testequal "http: SOCKS proxy $PROXY connection established to 172.16.254.1:8080" head -n 1 client.output
+testequal "http: SOCKS proxy $PROXY connection established to localhost (172.16.254.1:8080)" head -n 1 client.output
testfileequal index.html 'HTML'
msgmsg 'SOCKS user:pass request granted ipv6'
runserver '05 02' '01 00' '05 00 00 04 20 01 0d b8 ac 10 fe 00 00 00 00 00 00 00 00 00 1f 90'
runclient 'user:pass@'
-testequal "http: SOCKS proxy $PROXY connection established to [2001:0DB8:AC10:FE00:0000:0000:0000:0000]:8080" head -n 1 client.output
+testequal "http: SOCKS proxy $PROXY connection established to localhost ([2001:0DB8:AC10:FE00:0000:0000:0000:0000]:8080)" head -n 1 client.output
testfileequal index.html 'HTML'
msgmsg 'SOCKS no auth no hostname'
runserver '05 00 05 00 00 03 00 1f 90'
runclient
-testequal "http: SOCKS proxy $PROXY connection established to :8080" head -n 1 client.output
+testequal "http: SOCKS proxy $PROXY connection established to localhost (:8080)" head -n 1 client.output
testfileequal index.html 'HTML'
msgmsg 'SOCKS no auth with hostname'
runserver '05 00 05 00 00 03 09 68 6f 73 74 6c 6f 63 61 6c 1f 90'
runclient
-testequal "http: SOCKS proxy $PROXY connection established to hostlocal:8080" head -n 1 client.output
+testequal "http: SOCKS proxy $PROXY connection established to localhost (hostlocal:8080)" head -n 1 client.output
testfileequal index.html 'HTML'
msgmsg 'SOCKS user-only request granted ipv4'
runserver '05 02' '01 00' '05 00 00 01 ac 10 fe 01 1f 90'
runclient 'apt@'
-testequal "http: SOCKS proxy $PROXY connection established to 172.16.254.1:8080" head -n 1 client.output
+testequal "http: SOCKS proxy $PROXY connection established to localhost (172.16.254.1:8080)" head -n 1 client.output
testfileequal index.html 'HTML'
+
+msgmsg 'tor: SOCKS user:pass request not granted'
+runserver '05 02' '01 00' '05 04 00 01 00 00 00 00 00 00'
+runclient 'user:pass@'
+testsuccess grep 'could not connect to localhost (0.0.0.0:0) due to: Host unreachable (4)' client.output
+
+msgmsg 'tor: SOCKS user:pass request tll expired'
+runserver '05 02' '01 00' '05 06 00 01 00 00 00 00 00 00'
+runclient 'user:pass@'
+testsuccess grep 'could not connect to localhost (0.0.0.0:0) due to: TTL expired (6)' client.output
+
+msgmsg 'tor: SOCKS user:pass request service unreachable'
+runserver '05 02' '01 00' '05 06 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'vwakviie2ienjx6t.onion'
+testsuccess grep 'could not connect to vwakviie2ienjx6t.onion (0.0.0.0:0) due to: Host unreachable (6)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted onion'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'vwakviie2ienjx6t.onion'
+testsuccess grep 'could not connect to vwakviie2ienjx6t.onion (0.0.0.0:0) due to: general SOCKS server failure (1)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted subdomain'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'ftp.vwakviie2ienjx6t.onion'
+testsuccess grep 'could not connect to ftp.vwakviie2ienjx6t.onion (0.0.0.0:0) due to: general SOCKS server failure (1)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted too short'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'wakviie2ienjx6t.onion'
+testsuccess grep 'could not connect to wakviie2ienjx6t.onion (0.0.0.0:0) due to: Invalid hostname: onion service name must be 16 characters long (1)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted too long'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'vwakviie2ienjx6t2.onion'
+testsuccess grep 'could not connect to vwakviie2ienjx6t2.onion (0.0.0.0:0) due to: Invalid hostname: onion service name must be 16 characters long (1)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted too short subdomain'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'a.akviie2ienjx6t.onion'
+testsuccess grep 'could not connect to a.akviie2ienjx6t.onion (0.0.0.0:0) due to: Invalid hostname: onion service name must be 16 characters long (1)' client.output
+
+msgmsg 'tor: SOCKS user:pass request not granted too short subdomains'
+runserver '05 02' '01 00' '05 01 00 01 00 00 00 00 00 00'
+runclient 'user:pass@' 'a.a.viie2ienjx6t.onion'
+testsuccess grep 'could not connect to a.a.viie2ienjx6t.onion (0.0.0.0:0) due to: Invalid hostname: onion service name must be 16 characters long (1)' client.output