[meek/proxy] Add proxy URL tests using IP addresses.

commit fd2943a050c66f918287b05d144916bec47c111d Author: David Fifield <david@bamsoftware.com> Date: Sun May 25 10:17:20 2014 -0700 Add proxy URL tests using IP addresses. I assumed that you should be able to give a proxy host as a domain name, but it turns out that proposal 232 doesn't actually say that (https://trac.torproject.org/projects/tor/ticket/12125#comment:3). Add some IP addresses in addition to host names so we have that covered as well. --- meek-client/proxy_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/meek-client/proxy_test.go b/meek-client/proxy_test.go index 9e8fcf9..01ad37d 100644 --- a/meek-client/proxy_test.go +++ b/meek-client/proxy_test.go @@ -8,14 +8,28 @@ import ( func TestGetProxyURL(t *testing.T) { badTests := [...]string{ "bogus", + "http:", + "://127.0.0.1", + "//127.0.0.1", + "http:127.0.0.1", + "://[::1]", + "//[::1]", + "http:[::1]", "://localhost", "//localhost", - "http:", "http:localhost", } goodTests := [...]struct { input, expected string }{ + {"http://127.0.0.1", "http://127.0.0.1"}, + {"http://127.0.0.1:3128", "http://127.0.0.1:3128"}, + {"http://127.0.0.1:3128/", "http://127.0.0.1:3128/"}, + {"http://127.0.0.1:3128/path", "http://127.0.0.1:3128/path"}, + {"http://[::1]", "http://[::1]"}, + {"http://[::1]:3128", "http://[::1]:3128"}, + {"http://[::1]:3128/", "http://[::1]:3128/"}, + {"http://[::1]:3128/path", "http://[::1]:3128/path"}, {"http://localhost", "http://localhost"}, {"http://localhost:3128", "http://localhost:3128"}, {"http://localhost:3128/", "http://localhost:3128/"},
participants (1)
-
dcf@torproject.org