From 45a4174d5269661cfbd46e56acbbdc6551c6fbe2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 9 Jan 2016 23:36:58 +0200 Subject: Support https protocol for repository_location --- tests/repository-location/driver.cxx | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'tests/repository-location') diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx index cbd76f9..5d88b0d 100644 --- a/tests/repository-location/driver.cxx +++ b/tests/repository-location/driver.cxx @@ -99,6 +99,7 @@ main (int argc, char* argv[]) assert (bad_location ("aaa/bbb")); assert (bad_location ("/aaa/bbb")); assert (bad_location ("http://aa")); + assert (bad_location ("https://aa")); assert (bad_location ("http://aa/")); assert (bad_location ("http://aa/b/..")); assert (bad_location ("http://aa/.")); @@ -153,11 +154,25 @@ main (int argc, char* argv[]) repository_location l ("http://www.a.com:80/1/aa/bb"); assert (l.string () == "http://www.a.com:80/1/aa/bb"); assert (l.canonical_name () == "a.com/aa/bb"); + assert (!l.secure ()); + } + { + repository_location l ("https://www.a.com:443/1/aa/bb"); + assert (l.string () == "https://www.a.com:443/1/aa/bb"); + assert (l.canonical_name () == "a.com/aa/bb"); + assert (l.secure ()); } { repository_location l ("http://www.a.com:8080/dd/1/aa/bb"); assert (l.string () == "http://www.a.com:8080/dd/1/aa/bb"); assert (l.canonical_name () == "a.com:8080/aa/bb"); + assert (!l.secure ()); + } + { + repository_location l ("https://www.a.com:444/dd/1/aa/bb"); + assert (l.string () == "https://www.a.com:444/dd/1/aa/bb"); + assert (l.canonical_name () == "a.com:444/aa/bb"); + assert (l.secure ()); } { repository_location l ("http://a.com/a/b/../c/1/aa/../bb"); @@ -165,11 +180,26 @@ main (int argc, char* argv[]) assert (l.canonical_name () == "a.com/bb"); } { + repository_location l ("https://a.com/a/b/../c/1/aa/../bb"); + assert (l.string () == "https://a.com/a/c/1/bb"); + assert (l.canonical_name () == "a.com/bb"); + } + { repository_location l ("http://www.CPPget.org/qw/1/a/b/"); assert (l.string () == "http://www.cppget.org/qw/1/a/b"); assert (l.canonical_name () == "cppget.org/a/b"); } { + repository_location l ("http://pkg.CPPget.org/qw/1/a/b/"); + assert (l.string () == "http://pkg.cppget.org/qw/1/a/b"); + assert (l.canonical_name () == "cppget.org/a/b"); + } + { + repository_location l ("http://bpkg.CPPget.org/qw/1/a/b/"); + assert (l.string () == "http://bpkg.cppget.org/qw/1/a/b"); + assert (l.canonical_name () == "cppget.org/a/b"); + } + { repository_location l ("http://abc.cppget.org/qw/1/a/b/"); assert (l.string () == "http://abc.cppget.org/qw/1/a/b"); assert (l.canonical_name () == "abc.cppget.org/a/b"); @@ -180,6 +210,11 @@ main (int argc, char* argv[]) assert (l.canonical_name () == "www.cppget.org/a/b"); } { + repository_location l ("http://bpkg.www.cppget.org/qw/1/a/b/"); + assert (l.string () == "http://bpkg.www.cppget.org/qw/1/a/b"); + assert (l.canonical_name () == "www.cppget.org/a/b"); + } + { repository_location l ("http://cppget.org/qw//1/a//b/"); assert (l.string () == "http://cppget.org/qw/1/a/b"); assert (l.canonical_name () == "cppget.org/a/b"); @@ -195,6 +230,12 @@ main (int argc, char* argv[]) assert (l2.canonical_name () == "stable.cppget.org/math"); } { + repository_location l1 ("https://stable.cppget.org/1/misc"); + repository_location l2 ("../../1/math", l1); + assert (l2.string () == "https://stable.cppget.org/1/math"); + assert (l2.canonical_name () == "stable.cppget.org/math"); + } + { repository_location l1 ("http://stable.cppget.org/1/misc"); repository_location l2 ("../math", l1); assert (l2.string () == "http://stable.cppget.org/1/math"); @@ -205,6 +246,14 @@ main (int argc, char* argv[]) repository_location l2 ("../1/math", l1); assert (l2.string () == "http://www.stable.cppget.org:8080/1/math"); assert (l2.canonical_name () == "stable.cppget.org:8080/math"); + assert (!l2.secure ()); + } + { + repository_location l1 ("https://www.stable.cppget.org:444/1"); + repository_location l2 ("../1/math", l1); + assert (l2.string () == "https://www.stable.cppget.org:444/1/math"); + assert (l2.canonical_name () == "stable.cppget.org:444/math"); + assert (l2.secure ()); } { repository_location l1 ("/var/r1/1/misc"); -- cgit v1.1