From 29a08d8ab0c4d82f26c2712c456508784040cdbb Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 28 Jun 2017 15:52:00 +0200 Subject: Fix https->http redirect issues Gbp-Dch: ignore --- methods/http_main.cc | 2 +- test/integration/test-apt-https-no-redirect | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/methods/http_main.cc b/methods/http_main.cc index 1e56044b7..90a0450e2 100644 --- a/methods/http_main.cc +++ b/methods/http_main.cc @@ -11,7 +11,7 @@ int main(int, const char *argv[]) // closes the connection (this is dealt with via ServerDie()) signal(SIGPIPE, SIG_IGN); std::string Binary = flNotDir(argv[0]); - if (Binary.find('+') == std::string::npos && Binary != "http") + if (Binary.find('+') == std::string::npos && Binary != "https" && Binary != "http") Binary.append("+http"); return HttpMethod(std::move(Binary)).Loop(); } diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index d6c630d5f..05e97159c 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -14,7 +14,7 @@ echo 'alright' > aptarchive/working changetohttpswebserver webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/" webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' "https://localhost:${APTHTTPSPORT}/" -echo 'Dir::Bin::Methods::https+http "https";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method +echo 'Dir::Bin::Methods::https+http "http";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method msgtest 'download of a file works via' 'http' testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile @@ -26,13 +26,9 @@ testfileequal httpsfile 'alright' rm -f httpfile httpsfile msgtest 'download of http file works via' 'https+http' -testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile +testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/working" httpfile testfileequal httpfile 'alright' - -msgtest 'download of https file works via' 'https+http' -testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile -testfileequal httpsfile 'alright' -rm -f httpfile httpsfile +rm -f httpfile msgtest 'download of a file does not work if' 'https redirected to http' testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile -- cgit v1.2.3