diff options
| author | Julian Andres Klode <jak@debian.org> | 2021-10-18 13:37:09 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2021-10-18 13:37:09 +0000 |
| commit | 76bd0ab589f5a577bd6127bf6487fd351de5b32a (patch) | |
| tree | a1d191fcb07118428a09e92bd29827e3af622bf6 | |
| parent | f6b08c78dcdda1734710a5ef01553f53ceb5c52e (diff) | |
| parent | 4e04cbafe7db326b52ee650a4f4ccc3444da6890 (diff) | |
Merge branch 'fix/file-https-proxy' into 'main'
Fix file:/// vs file:/ hang & https-proxy for http
See merge request apt-team/apt!187
| -rw-r--r-- | apt-pkg/sourcelist.cc | 10 | ||||
| -rw-r--r-- | methods/aptmethod.h | 123 | ||||
| -rw-r--r-- | methods/connect.cc | 19 | ||||
| -rw-r--r-- | methods/connect.h | 3 | ||||
| -rw-r--r-- | methods/http.cc | 6 | ||||
| -rw-r--r-- | test/integration/framework | 31 | ||||
| -rwxr-xr-x | test/integration/test-apt-by-hash-update | 2 | ||||
| -rwxr-xr-x | test/integration/test-apt-get-download | 2 | ||||
| -rwxr-xr-x | test/integration/test-apt-get-update-unauth-warning | 2 | ||||
| -rwxr-xr-x | test/integration/test-apt-update-nofallback | 2 | ||||
| -rwxr-xr-x | test/integration/test-bug-722207-print-uris-even-if-very-quiet | 8 | ||||
| -rwxr-xr-x | test/integration/test-bug-723705-tagfile-truncates-fields | 20 | ||||
| -rwxr-xr-x | test/integration/test-bug-990555-https-proxy-for-http | 37 | ||||
| -rwxr-xr-x | test/integration/test-method-mirror | 13 |
14 files changed, 173 insertions, 105 deletions
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index cd7dbce9c..0ac59fcfc 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -85,12 +85,12 @@ bool pkgSourceList::Type::FixupURI(string &URI) const if (URI.find(':') == string::npos) return false; - URI = SubstVar(URI,"$(ARCH)",_config->Find("APT::Architecture")); - + URI = ::URI{SubstVar(URI, "$(ARCH)", _config->Find("APT::Architecture"))}; + // Make sure that the URI is / postfixed - if (URI[URI.size() - 1] != '/') - URI += '/'; - + if (URI.back() != '/') + URI.push_back('/'); + return true; } /*}}}*/ diff --git a/methods/aptmethod.h b/methods/aptmethod.h index bd50e8078..afc761cc5 100644 --- a/methods/aptmethod.h +++ b/methods/aptmethod.h @@ -43,7 +43,71 @@ static bool hasDoubleColon(std::string const &n) return n.find("::") != std::string::npos; } -class aptMethod : public pkgAcqMethod +class aptConfigWrapperForMethods +{ +protected: + std::vector<std::string> methodNames; +public: + void setPostfixForMethodNames(char const * const postfix) APT_NONNULL(2) + { + methodNames.erase(std::remove_if(methodNames.begin(), methodNames.end(), hasDoubleColon), methodNames.end()); + decltype(methodNames) toAdd; + for (auto && name: methodNames) + toAdd.emplace_back(name + "::" + postfix); + std::move(toAdd.begin(), toAdd.end(), std::back_inserter(methodNames)); + } + + bool DebugEnabled() const + { + if (methodNames.empty()) + return false; + auto const sni = std::find_if_not(methodNames.crbegin(), methodNames.crend(), hasDoubleColon); + if (unlikely(sni == methodNames.crend())) + return false; + auto const ln = methodNames[methodNames.size() - 1]; + // worst case: all three are the same + std::string confln, confsn, confpn; + strprintf(confln, "Debug::Acquire::%s", ln.c_str()); + strprintf(confsn, "Debug::Acquire::%s", sni->c_str()); + auto const pni = sni->substr(0, sni->find('+')); + strprintf(confpn, "Debug::Acquire::%s", pni.c_str()); + return _config->FindB(confln,_config->FindB(confsn, _config->FindB(confpn, false))); + } + std::string ConfigFind(char const * const postfix, std::string const &defValue) const APT_NONNULL(2) + { + for (auto name = methodNames.rbegin(); name != methodNames.rend(); ++name) + { + std::string conf; + strprintf(conf, "Acquire::%s::%s", name->c_str(), postfix); + auto value = _config->Find(conf); + if (not value.empty()) + return value; + } + return defValue; + } + std::string ConfigFind(std::string const &postfix, std::string const &defValue) const + { + return ConfigFind(postfix.c_str(), defValue); + } + bool ConfigFindB(char const * const postfix, bool const defValue) const APT_NONNULL(2) + { + return StringToBool(ConfigFind(postfix, defValue ? "yes" : "no"), defValue); + } + int ConfigFindI(char const * const postfix, int const defValue) const APT_NONNULL(2) + { + char *End; + std::string const value = ConfigFind(postfix, ""); + auto const Res = strtol(value.c_str(), &End, 0); + if (value.c_str() == End) + return defValue; + return Res; + } + + explicit aptConfigWrapperForMethods(std::string const &name) : methodNames{{name}} {} + explicit aptConfigWrapperForMethods(std::vector<std::string> &&names) : methodNames{std::move(names)} {} +}; + +class aptMethod : public pkgAcqMethod, public aptConfigWrapperForMethods { protected: std::string const Binary; @@ -397,61 +461,6 @@ protected: SendMessage("104 Warning", std::move(fields)); } - std::vector<std::string> methodNames; - void setPostfixForMethodNames(char const * const postfix) APT_NONNULL(2) - { - methodNames.erase(std::remove_if(methodNames.begin(), methodNames.end(), hasDoubleColon), methodNames.end()); - decltype(methodNames) toAdd; - for (auto && name: methodNames) - toAdd.emplace_back(name + "::" + postfix); - std::move(toAdd.begin(), toAdd.end(), std::back_inserter(methodNames)); - } - bool DebugEnabled() const - { - if (methodNames.empty()) - return false; - auto const sni = std::find_if_not(methodNames.crbegin(), methodNames.crend(), hasDoubleColon); - if (unlikely(sni == methodNames.crend())) - return false; - auto const ln = methodNames[methodNames.size() - 1]; - // worst case: all three are the same - std::string confln, confsn, confpn; - strprintf(confln, "Debug::Acquire::%s", ln.c_str()); - strprintf(confsn, "Debug::Acquire::%s", sni->c_str()); - auto const pni = sni->substr(0, sni->find('+')); - strprintf(confpn, "Debug::Acquire::%s", pni.c_str()); - return _config->FindB(confln,_config->FindB(confsn, _config->FindB(confpn, false))); - } - std::string ConfigFind(char const * const postfix, std::string const &defValue) const APT_NONNULL(2) - { - for (auto name = methodNames.rbegin(); name != methodNames.rend(); ++name) - { - std::string conf; - strprintf(conf, "Acquire::%s::%s", name->c_str(), postfix); - auto const value = _config->Find(conf); - if (value.empty() == false) - return value; - } - return defValue; - } - std::string ConfigFind(std::string const &postfix, std::string const &defValue) const - { - return ConfigFind(postfix.c_str(), defValue); - } - bool ConfigFindB(char const * const postfix, bool const defValue) const APT_NONNULL(2) - { - return StringToBool(ConfigFind(postfix, defValue ? "yes" : "no"), defValue); - } - int ConfigFindI(char const * const postfix, int const defValue) const APT_NONNULL(2) - { - char *End; - std::string const value = ConfigFind(postfix, ""); - auto const Res = strtol(value.c_str(), &End, 0); - if (value.c_str() == End) - return defValue; - return Res; - } - bool TransferModificationTimes(char const * const From, char const * const To, time_t &LastModified) APT_NONNULL(2, 3) { if (strcmp(To, "/dev/null") == 0) @@ -498,7 +507,7 @@ protected: } aptMethod(std::string &&Binary, char const *const Ver, unsigned long const Flags) APT_NONNULL(3) - : pkgAcqMethod(Ver, Flags), Binary(Binary), SeccompFlags(0), methodNames({Binary}) + : pkgAcqMethod(Ver, Flags), aptConfigWrapperForMethods(Binary), Binary(std::move(Binary)), SeccompFlags(0) { try { std::locale::global(std::locale("")); diff --git a/methods/connect.cc b/methods/connect.cc index 044984403..bc2fe1de5 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -894,7 +894,8 @@ struct TlsFd : public MethodFd }; ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd, - unsigned long Timeout, aptMethod *Owner) + unsigned long const Timeout, aptMethod * const Owner, + aptConfigWrapperForMethods const * const OwnerConf) { if (_config->FindB("Acquire::AllowTLS", true) == false) { @@ -940,7 +941,7 @@ ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd, } // Credential setup - std::string fileinfo = Owner->ConfigFind("CaInfo", ""); + std::string fileinfo = OwnerConf->ConfigFind("CaInfo", ""); if (fileinfo.empty()) { // No CaInfo specified, use system trust store. @@ -965,20 +966,20 @@ ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd, } } - if (!Owner->ConfigFind("IssuerCert", "").empty()) + if (not OwnerConf->ConfigFind("IssuerCert", "").empty()) { _error->Error("The option '%s' is not supported anymore", "IssuerCert"); return ResultState::FATAL_ERROR; } - if (!Owner->ConfigFind("SslForceVersion", "").empty()) + if (not OwnerConf->ConfigFind("SslForceVersion", "").empty()) { _error->Error("The option '%s' is not supported anymore", "SslForceVersion"); return ResultState::FATAL_ERROR; } // For client authentication, certificate file ... - std::string const cert = Owner->ConfigFind("SslCert", ""); - std::string const key = Owner->ConfigFind("SslKey", ""); + std::string const cert = OwnerConf->ConfigFind("SslCert", ""); + std::string const key = OwnerConf->ConfigFind("SslKey", ""); if (cert.empty() == false) { if ((err = gnutls_certificate_set_x509_key_file( @@ -993,7 +994,7 @@ ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd, } // CRL file - std::string const crlfile = Owner->ConfigFind("CrlFile", ""); + std::string const crlfile = OwnerConf->ConfigFind("CrlFile", ""); if (crlfile.empty() == false) { if ((err = gnutls_certificate_set_x509_crl_file(tlsFd->credentials, @@ -1017,9 +1018,9 @@ ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd, return ResultState::FATAL_ERROR; } - if (Owner->ConfigFindB("Verify-Peer", true)) + if (OwnerConf->ConfigFindB("Verify-Peer", true)) { - gnutls_session_set_verify_cert(tlsFd->session, Owner->ConfigFindB("Verify-Host", true) ? tlsFd->hostname.c_str() : nullptr, 0); + gnutls_session_set_verify_cert(tlsFd->session, OwnerConf->ConfigFindB("Verify-Host", true) ? tlsFd->hostname.c_str() : nullptr, 0); } // set SNI only if the hostname is really a name and not an address diff --git a/methods/connect.h b/methods/connect.h index bd6507761..413484aa3 100644 --- a/methods/connect.h +++ b/methods/connect.h @@ -42,7 +42,8 @@ ResultState Connect(std::string To, int Port, const char *Service, int DefPort, std::unique_ptr<MethodFd> &Fd, unsigned long TimeOut, aptMethod *Owner); ResultState UnwrapSocks(std::string To, int Port, URI Proxy, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner); -ResultState UnwrapTLS(std::string const &To, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner); +ResultState UnwrapTLS(std::string const &To, std::unique_ptr<MethodFd> &Fd, unsigned long Timeout, aptMethod *Owner, + aptConfigWrapperForMethods const * OwnerConf); void RotateDNS(); diff --git a/methods/http.cc b/methods/http.cc index b6d754037..2a5ab2cd2 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -518,7 +518,9 @@ ResultState HttpServerState::Open() return result; if (Host == Proxy.Host && Proxy.Access == "https") { - result = UnwrapTLS(Proxy.Host, ServerFd, TimeOut, Owner); + aptConfigWrapperForMethods ProxyConf{std::vector<std::string>{"http", "https"}}; + ProxyConf.setPostfixForMethodNames(Proxy.Host.c_str()); + result = UnwrapTLS(Proxy.Host, ServerFd, TimeOut, Owner, &ProxyConf); if (result != ResultState::SUCCESSFUL) return result; } @@ -531,7 +533,7 @@ ResultState HttpServerState::Open() } if (tls) - return UnwrapTLS(ServerName.Host, ServerFd, TimeOut, Owner); + return UnwrapTLS(ServerName.Host, ServerFd, TimeOut, Owner, Owner); return ResultState::SUCCESSFUL; } diff --git a/test/integration/framework b/test/integration/framework index d8fd6ba95..c9559a7ba 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1190,7 +1190,7 @@ setupdistsaptarchive() { SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" - echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" + echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" msgdone "info" done } @@ -1207,7 +1207,7 @@ setupflataptarchive() { fi if [ -f "${APTARCHIVE}/Sources" ]; then msgninfo "\tadd deb-src sources.list line… " - echo "deb-src file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' + echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' msgdone 'info' else rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' @@ -1369,10 +1369,13 @@ webserverconfig() { } rewritesourceslist() { - local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" - local APTARCHIVE2="copy://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" + local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#$APTARCHIVE2#${1}#" \ + sed -i $LIST \ + -e "s#file://$APTARCHIVE#${1}#" \ + -e "s#file:$APTARCHIVE#${1}#" \ + -e "s#copy://$APTARCHIVE#${1}#" \ + -e "s#copy:$APTARCHIVE#${1}#" \ -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" done @@ -1393,10 +1396,9 @@ waitforpidfile() { } changetowebserver() { - local REWRITE='no' - if [ "$1" != '--no-rewrite' ]; then - REWRITE='yes' - else + local REWRITE='yes' + if [ "$1" = '--no-rewrite' ]; then + REWRITE='no' shift fi if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then @@ -1421,12 +1423,17 @@ changetowebserver() { else msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' fi - if [ "$REWRTE" != 'yes' ]; then + if [ "$REWRITE" != 'no' ]; then rewritesourceslist "http://localhost:${APTHTTPPORT}/" fi } changetohttpswebserver() { + local REWRITE='yes' + if [ "$1" = '--no-rewrite' ]; then + REWRITE='no' + shift + fi local stunnel4 if command -v stunnel4 >/dev/null 2>&1; then stunnel4=stunnel4 @@ -1455,7 +1462,9 @@ connect = $APTHTTPPORT addtrap 'prefix' "kill ${PID};" APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" - rewritesourceslist "https://localhost:${APTHTTPSPORT}/" + if [ "$REWRITE" != 'no' ]; then + rewritesourceslist "https://localhost:${APTHTTPSPORT}/" + fi } changetocdrom() { diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update index f4794a84f..65c3766d0 100755 --- a/test/integration/test-apt-by-hash-update +++ b/test/integration/test-apt-by-hash-update @@ -104,4 +104,4 @@ testfailureequal "Get:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InReleas Err:1 file:${TMPWORKINGDIRECTORY}/aptarchive unstable InRelease File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory) Reading package lists... -E: Failed to fetch file://${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/InRelease File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory)" aptget update +E: Failed to fetch file:${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/InRelease File not found - ${TMPWORKINGDIRECTORY}/aptarchive/dists/unstable/by-hash/SHA256/${inrelease_hash} (2: No such file or directory)" aptget update diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index fc0e6cfa3..ea74ac662 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -73,7 +73,7 @@ testdownload apt_1.0_all.deb apt/stable testdownload apt_2.0_all.deb apt DEBFILE="$(readlink -f ../aptarchive)/pool/apt_2.0_all.deb" -testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s "$DEBFILE") SHA512:$(sha512sum "$DEBFILE" | cut -d' ' -f 1)" aptget download apt --print-uris +testequal "'file:${DEBFILE}' apt_2.0_all.deb $(stat -c%s "$DEBFILE") SHA512:$(sha512sum "$DEBFILE" | cut -d' ' -f 1)" aptget download apt --print-uris # deb:677887 testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms --print-uris diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning index a0d7a59d9..42c4e5a9d 100755 --- a/test/integration/test-apt-get-update-unauth-warning +++ b/test/integration/test-apt-get-update-unauth-warning @@ -47,7 +47,7 @@ partial' ls rootdir/var/lib/apt/lists filesize() { local CREATEDBY="$1" shift - stat -c%s "$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $CREATEDBY" "$@" | cut -d'/' -f 3- ).gz" + stat -c%s "/$(aptget indextargets --no-release-info --format '$(URI)' "Created-By: $CREATEDBY" "$@" | cut -d'/' -f 2- ).gz" } # allow override #aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1 diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index d7e30ba20..637716543 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -178,7 +178,7 @@ test_subvert_inrelease() # replace InRelease with something else mv "$APTARCHIVE/dists/unstable/Release" "$APTARCHIVE/dists/unstable/InRelease" - testfailuremsg "E: Failed to fetch file://${APTARCHIVE}/dists/unstable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) + testfailuremsg "E: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) E: The repository 'file:${APTARCHIVE} unstable InRelease' is no longer signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet index 116e8fa2a..73290a72d 100755 --- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet +++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet @@ -17,10 +17,10 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) -testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget upgrade -qq --print-uris -testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget dist-upgrade -qq --print-uris -testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget install apt -qq --print-uris -testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 SHA256:0000000000000000000000000000000000000000000000000000000000000000" aptget download apt -qq --print-uris +testsuccessequal "'file:${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget upgrade -qq --print-uris +testsuccessequal "'file:${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget dist-upgrade -qq --print-uris +testsuccessequal "'file:${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 " aptget install apt -qq --print-uris +testsuccessequal "'file:${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 42 SHA256:0000000000000000000000000000000000000000000000000000000000000000" aptget download apt -qq --print-uris testsuccessequal "'file:${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 SHA256:7776436a6d741497f1cd958014e1a05b352224231428152aae39da3c17fd2fd4 'file:${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 SHA256:f57f565eabe3fde0ec6e6e0bcc8db1d86fe2b4d6344a380a23520ddbb7728e99" aptget source apt -qq --print-uris testsuccessequal "'https://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris diff --git a/test/integration/test-bug-723705-tagfile-truncates-fields b/test/integration/test-bug-723705-tagfile-truncates-fields index d167a3f65..15422286f 100755 --- a/test/integration/test-bug-723705-tagfile-truncates-fields +++ b/test/integration/test-bug-723705-tagfile-truncates-fields @@ -8,7 +8,7 @@ configarchitecture 'amd64' setupaptarchive -aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed "s#file://${TMPWORKINGDIRECTORY}#file:///tmp#g" > filename.log +aptget install --print-uris -y cdebconf-newt-terminal cdebconf-gtk-terminal 2>&1 | sed "s#file:\(//\|\)${TMPWORKINGDIRECTORY}#file:/tmp#g" > filename.log testfileequal filename.log "Reading package lists... Building dependency tree... @@ -22,12 +22,12 @@ The following NEW packages will be installed: 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/4774 kB of archives. After this operation, 19.8 MB of additional disk space will be used. -'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-udeb_0.185_amd64.udeb' cdebconf-udeb_0.185_amd64.udeb 77376 MD5Sum:e3883706fdbf54c2e5ea959c92b2d37f -'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-gtk-udeb_0.185_amd64.udeb' cdebconf-gtk-udeb_0.185_amd64.udeb 27278 MD5Sum:a1bbbc1d4fb8e0615b5621abac021924 -'file:///tmp/aptarchive/pool/main/c/cdebconf/cdebconf-newt-udeb_0.185_amd64.udeb' cdebconf-newt-udeb_0.185_amd64.udeb 19192 MD5Sum:de27807f56dae2f2403b3322d5fe6bd2 -'file:///tmp/aptarchive/pool/main/g/glib2.0/libglib2.0-udeb_2.36.4-1_amd64.udeb' libglib2.0-udeb_2.36.4-1_amd64.udeb 1714604 MD5Sum:72da029f1bbb36057d874f1f82a5d00a -'file:///tmp/aptarchive/pool/main/e/eglibc/libc6-udeb_2.17-92%2bb1_amd64.udeb' libc6-udeb_2.17-92+b1_amd64.udeb 1056000 MD5Sum:7fd7032eeeecf7f76eff79a0543fbd72 -'file:///tmp/aptarchive/pool/main/g/gtk%2b2.0/libgtk2.0-0-udeb_2.24.20-1_amd64.udeb' libgtk2.0-0-udeb_2.24.20-1_amd64.udeb 1643046 MD5Sum:25513478eb2e02e5766c0eea0b411ca9 -'file:///tmp/aptarchive/pool/main/v/vte/libvte9-udeb_0.28.2-5_amd64.udeb' libvte9-udeb_1%3a0.28.2-5_amd64.udeb 216968 MD5Sum:7da7201effaf5ced19abd9d0b45aa2c6 -'file:///tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-gtk-terminal_0.22_amd64.udeb' cdebconf-gtk-terminal_0.22_amd64.udeb 14734 MD5Sum:f9c3a7354560cb88e0396e2b7ba54363 -'file:///tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-newt-terminal_0.22_amd64.udeb' cdebconf-newt-terminal_0.22_amd64.udeb 4538 MD5Sum:20db6152fce5081fcbf49c7c08f21246" +'file:/tmp/aptarchive/pool/main/c/cdebconf/cdebconf-udeb_0.185_amd64.udeb' cdebconf-udeb_0.185_amd64.udeb 77376 MD5Sum:e3883706fdbf54c2e5ea959c92b2d37f +'file:/tmp/aptarchive/pool/main/c/cdebconf/cdebconf-gtk-udeb_0.185_amd64.udeb' cdebconf-gtk-udeb_0.185_amd64.udeb 27278 MD5Sum:a1bbbc1d4fb8e0615b5621abac021924 +'file:/tmp/aptarchive/pool/main/c/cdebconf/cdebconf-newt-udeb_0.185_amd64.udeb' cdebconf-newt-udeb_0.185_amd64.udeb 19192 MD5Sum:de27807f56dae2f2403b3322d5fe6bd2 +'file:/tmp/aptarchive/pool/main/g/glib2.0/libglib2.0-udeb_2.36.4-1_amd64.udeb' libglib2.0-udeb_2.36.4-1_amd64.udeb 1714604 MD5Sum:72da029f1bbb36057d874f1f82a5d00a +'file:/tmp/aptarchive/pool/main/e/eglibc/libc6-udeb_2.17-92%2bb1_amd64.udeb' libc6-udeb_2.17-92+b1_amd64.udeb 1056000 MD5Sum:7fd7032eeeecf7f76eff79a0543fbd72 +'file:/tmp/aptarchive/pool/main/g/gtk%2b2.0/libgtk2.0-0-udeb_2.24.20-1_amd64.udeb' libgtk2.0-0-udeb_2.24.20-1_amd64.udeb 1643046 MD5Sum:25513478eb2e02e5766c0eea0b411ca9 +'file:/tmp/aptarchive/pool/main/v/vte/libvte9-udeb_0.28.2-5_amd64.udeb' libvte9-udeb_1%3a0.28.2-5_amd64.udeb 216968 MD5Sum:7da7201effaf5ced19abd9d0b45aa2c6 +'file:/tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-gtk-terminal_0.22_amd64.udeb' cdebconf-gtk-terminal_0.22_amd64.udeb 14734 MD5Sum:f9c3a7354560cb88e0396e2b7ba54363 +'file:/tmp/aptarchive/pool/main/c/cdebconf-terminal/cdebconf-newt-terminal_0.22_amd64.udeb' cdebconf-newt-terminal_0.22_amd64.udeb 4538 MD5Sum:20db6152fce5081fcbf49c7c08f21246" diff --git a/test/integration/test-bug-990555-https-proxy-for-http b/test/integration/test-bug-990555-https-proxy-for-http new file mode 100755 index 000000000..f43abfd92 --- /dev/null +++ b/test/integration/test-bug-990555-https-proxy-for-http @@ -0,0 +1,37 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'unrelated' 'all' '1' 'unstable' + +setupaptarchive --no-update +changetowebserver --request-absolute='uri' +changetohttpswebserver --no-rewrite + +msgtest 'Check that non-absolute paths are' 'not accepted' +testfailure --nomsg aptget update --allow-insecure-repositories + +echo "Acquire::http::Proxy \"https://localhost:${APTHTTPSPORT}\";" > rootdir/etc/apt/apt.conf.d/99proxy + +msgtest 'Check that requests to https proxies' 'work from http' +testsuccess --nomsg aptget update + +testsuccessequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + unrelated +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst unrelated (1 unstable [all]) +Conf unrelated (1 unstable [all])' apt install unrelated -s + +testsuccess apt download unrelated --print-uris +testfailure grep 'https:' rootdir/tmp/testsuccess.output + +cd downloaded +testsuccess apt download unrelated +testsuccess test -s 'unrelated_1_all.deb' +cd .. diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror index 81a5585fd..ce44b86e3 100755 --- a/test/integration/test-method-mirror +++ b/test/integration/test-method-mirror @@ -148,7 +148,16 @@ Ign:2 http://localhost:${APTHTTPPORT}/failure2 stable InRelease Ign:3 http://localhost:${APTHTTPPORT}/failure unstable InRelease 404 Not Found" head -n 5 aptupdate.output -changetohttpswebserver +msgmsg 'do not hang on' 'file:///' +sed -i -e 's#file:/tmp#file:///tmp#' rootdir/etc/apt/sources.list.d/apt-test-unstable-deb* +testrun '*_localhost_*' '*_aptarchive_mirror.txt_*' +testsuccessequal "Get:1 file:${APTARCHIVE}/mirror.txt Mirrorlist [$(stat -c%s 'aptarchive/mirror.txt') B] +Ign:2 http://localhost:${APTHTTPPORT}/failure2 stable InRelease + 404 Not Found +Ign:3 http://localhost:${APTHTTPPORT}/failure unstable InRelease + 404 Not Found" head -n 5 aptupdate.output + +changetohttpswebserver --no-rewrite rm -f rootdir/etc/apt/sources.list.d/*-stable-* msgmsg 'fallback mirrors are used if needed' 'random' echo "http://localhost:${APTHTTPPORT}/failure2 priority:1 @@ -241,7 +250,7 @@ Reading package lists... Building dependency tree... Reading state information... All packages are up to date." apt update -sed -i -e "s#+file:${APTARCHIVE}#+http://localhost:${APTHTTPPORT}#" rootdir/etc/apt/sources.list.d/* +sed -i -e "s#+file:\(//\|\)${APTARCHIVE}#+http://localhost:${APTHTTPPORT}#" rootdir/etc/apt/sources.list.d/* testsuccess apt update testrundownload 'foo=2' |
