--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: apt: better handling of external redirections
- From: Raphael Geissert <geissert@debian.org>
- Date: Sun, 8 Apr 2012 18:10:02 -0500
- Message-id: <201204081810.04297.geissert@debian.org>
Package: apt
Version: 0.8.15.10
Tag: patch
Severity: wishlist
Hi,
APT currently handles external http redirections in the same method process
that received the redirection. This has two side effects:
a) Leads to lots of connects/disconnects if all the redirects are external.
b) Can lead to more than one connection per server (say, you have an entry
for domain.tld, and one to foo.tld, but foo.tld redirects to domain.tld)
The attached patch makes the redirections go all the way back to pkgAcquire
so that external redirections create a new method process. It does break the
redirection loop detection code, but I can restore it if there's no
objection to the patch in general.
It also fixes the handling of redirections that switch protocol. They are
now blocked, instead of attempting to resolve them over http.
Although this is a wishlist, I'd really like to see this in sid soon, as it
benefits users of http.debian.net.
Please let me know what you think.
Cheers,
--
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
diff --git a/apt-0.8.15.10/methods/http.cc b/apt-0.8.15.10.wip/methods/http.cc
index 65a0cbb..cbc6c69 100644
--- a/apt-0.8.15.10/methods/http.cc
+++ b/apt-0.8.15.10.wip/methods/http.cc
@@ -967,7 +967,10 @@ HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
else
{
NextURI = DeQuoteString(Srv->Location);
- return TRY_AGAIN_OR_REDIRECT;
+ URI tmpURI = NextURI;
+ // Do not allow a redirection to switch protocol
+ if (tmpURI.Access == "http")
+ return TRY_AGAIN_OR_REDIRECT;
}
/* else pass through for error message */
}
diff --git a/apt-0.8.15.10/apt-pkg/acquire-worker.cc b/apt-0.8.15.10.wip/apt-pkg/acquire-worker.cc
index 75e0323..4c14daf 100644
--- a/apt-0.8.15.10/apt-pkg/acquire-worker.cc
+++ b/apt-0.8.15.10.wip/apt-pkg/acquire-worker.cc
@@ -242,6 +242,18 @@ bool pkgAcquire::Worker::RunMessages()
string NewURI = LookupTag(Message,"New-URI",URI.c_str());
Itm->URI = NewURI;
+
+ pkgAcquire::Item *Owner = Itm->Owner;
+ pkgAcquire::ItemDesc Desc = *Itm;
+
+ // Change the status so that it can be dequeued
+ Owner->Status = pkgAcquire::Item::StatIdle;
+ // Since it is going to be put on the queue again with
+ // Enqueue, and that increases a counter, it must be
+ // dequeued with Dequeue, to keep the counter in sync
+ OwnerQ->Owner->Dequeue(Owner);
+ OwnerQ->Owner->Enqueue(Desc);
+ OwnerQ->Cycle();
break;
}
diff --git a/apt-0.8.15.10/apt-pkg/acquire-method.cc b/apt-0.8.15.10.wip/apt-pkg/acquire-method.cc
index 294d78f..eddf443 100644
--- a/apt-0.8.15.10/apt-pkg/acquire-method.cc
+++ b/apt-0.8.15.10.wip/apt-pkg/acquire-method.cc
@@ -417,26 +417,19 @@ void pkgAcqMethod::Status(const char *Format,...)
/*}}}*/
// AcqMethod::Redirect - Send a redirect message /*{{{*/
// ---------------------------------------------------------------------
-/* This method sends the redirect message and also manipulates the queue
- to keep the pipeline synchronized. */
+/* This method sends the redirect message and dequeues the item. */
void pkgAcqMethod::Redirect(const string &NewURI)
{
std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n"
<< "New-URI: " << NewURI << "\n"
<< "\n" << std::flush;
- // Change the URI for the request.
- Queue->Uri = NewURI;
-
- /* To keep the pipeline synchronized, move the current request to
- the end of the queue, past the end of the current pipeline. */
- FetchItem *I;
- for (I = Queue; I->Next != 0; I = I->Next) ;
- I->Next = Queue;
+ // Dequeue
+ FetchItem *Tmp = Queue;
Queue = Queue->Next;
- I->Next->Next = 0;
- if (QueueBack == 0)
- QueueBack = I->Next;
+ delete Tmp;
+ if (Tmp == QueueBack)
+ QueueBack = Queue;
}
/*}}}*/
// AcqMethod::FetchResult::FetchResult - Constructor /*{{{*/
--- End Message ---
--- Begin Message ---
Source: apt
Source-Version: 0.9.4
We believe that the bug you reported is fixed in the latest version of
apt, which is due to be installed in the Debian FTP archive:
apt-doc_0.9.4_all.deb
to main/a/apt/apt-doc_0.9.4_all.deb
apt-transport-https_0.9.4_amd64.deb
to main/a/apt/apt-transport-https_0.9.4_amd64.deb
apt-utils_0.9.4_amd64.deb
to main/a/apt/apt-utils_0.9.4_amd64.deb
apt_0.9.4.dsc
to main/a/apt/apt_0.9.4.dsc
apt_0.9.4.tar.gz
to main/a/apt/apt_0.9.4.tar.gz
apt_0.9.4_amd64.deb
to main/a/apt/apt_0.9.4_amd64.deb
libapt-inst1.5_0.9.4_amd64.deb
to main/a/apt/libapt-inst1.5_0.9.4_amd64.deb
libapt-pkg-dev_0.9.4_amd64.deb
to main/a/apt/libapt-pkg-dev_0.9.4_amd64.deb
libapt-pkg-doc_0.9.4_all.deb
to main/a/apt/libapt-pkg-doc_0.9.4_all.deb
libapt-pkg4.12_0.9.4_amd64.deb
to main/a/apt/libapt-pkg4.12_0.9.4_amd64.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 668111@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Michael Vogt <mvo@debian.org> (supplier of updated apt package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Mon, 21 May 2012 12:29:05 +0200
Source: apt
Binary: apt libapt-pkg4.12 libapt-inst1.5 apt-doc libapt-pkg-dev libapt-pkg-doc apt-utils apt-transport-https
Architecture: source all amd64
Version: 0.9.4
Distribution: unstable
Urgency: low
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Michael Vogt <mvo@debian.org>
Description:
apt - commandline package manager
apt-doc - documentation for APT
apt-transport-https - https download transport for APT
apt-utils - package managment related utility programs
libapt-inst1.5 - deb package format runtime library
libapt-pkg-dev - development files for APT's libapt-pkg and libapt-inst
libapt-pkg-doc - documentation for APT development
libapt-pkg4.12 - package managment runtime library
Closes: 668111 669142 669409 672466 672927 673536 673647
Changes:
apt (0.9.4) unstable; urgency=low
.
[ David Kalnischkies ]
* methods/http.cc:
- after many years of pointless discussions disable http/1.1 pipelining
by default as many webservers and proxies seem to be unable to conform
to specification must's (rfc2616 section 8.1.2.2) (LP: #996151)
- add spaces around PACKAGE_VERSION to fix FTBFS with -std=c++11
* apt-pkg/pkgcachegen.cc:
- make IsDuplicatedDescription static so that it is really private
as we don't need a symbol for it as it is not in a header
* Makefile, buildlib/*.mak:
- reshuffle dependencies so that parallel building seems to work
- separate manpages from the rest of the doc building
* prepare-release:
- apt-inst version isn't apt versions, so don't override variable
* debian/rules:
- apt-utils packages manpages, so it should depend on build-doc
- make apt and apt-utils packages depend on manpages instead of full doc
* debian/control:
- move doxygen and debiandoc-sgml to Build-Depends-Indep as docs
are no longer build in the same target as the manpages
* apt-pkg/acquire-methods.cc:
- factor out into private Dequeue() to fix access to deleted pointer
* apt-pkg/contrib/fileutl.cc:
- ensure that we close compressed fds, wait for forks and such even if
the FileFd itself is set to not autoclose the given Fd
* cmdline/apt-get.cc:
- use the host architecture, not the build architecture for matching
of [architecture restrictions] in Build-Depends (Closes: #672927)
* doc/makefile:
- build manpages with the correct l10n.gentext.default.language setting
to get the correct section titles provided by docbook
* doc/po/de.po:
- updated german manpage translation by Chris Leick, thanks!
* apt-pkg/packagemanager.cc:
- do not run into loop on new-pre-depends-breaks (Closes: #673536)
* doc/*.xml:
- add a few translator notes and reword some paragraphs to ensure that
translators and users alike can better understand them (Closes: #669409)
- in <term> mark all options with <option> and mark <term><option>
as untranslated for po4a removing ~200 unless "translateable" strings
* apt-pkg/aptconfiguration.cc:
- longcode Translation files are saved with encoded underscore,
so make sure to pick these files up as well for Acquire::Languages
* ftparchive/writer.cc:
- include Contents-* files in Release files (Closes: #673647)
.
[ Michael Vogt ]
* merged updated de.po, thanks to Holger Wansing (closes: #672466)
.
[ Raphael Geissert ]
* apt-pkg/acquire*.cc:
- handle redirections in the worker with the right method instead of
in the method the redirection occured in (Closes: #668111)
* methods/http.cc:
- forbid redirects to change protocol
* methods/mirror.cc:
- generate an equal sign also for the first arch (Closes: #669142)
.
[ Marius Vollmer ]
* apt-pkg/algorithms.cc:
- fix memory leak of Flags in pkgSimulate by a proper destructor
Checksums-Sha1:
4a62f68452f3c2ddb61c89a950315d9db5b90d76 1683 apt_0.9.4.dsc
9b9d91ed0104402c0cdc6d3e18d02a66ecb85fdf 3375298 apt_0.9.4.tar.gz
6ad11cab7d4a102a3460f5533088220ec4630b3a 256630 apt-doc_0.9.4_all.deb
3c46bfe82dba6c38b42b797fa325cc79f768df32 834616 libapt-pkg-doc_0.9.4_all.deb
3c2f51ba2eb01547cb8668ce87d80ebd0c67cc94 865096 libapt-pkg4.12_0.9.4_amd64.deb
dbc9eb4d1a3dcb76f452c58cb86fb9f3fa70f3ad 159716 libapt-inst1.5_0.9.4_amd64.deb
af2a9a26177f98a79372d42072aa5f9e6bb15cce 797540 apt_0.9.4_amd64.deb
f5c6ef7cd8fea94300ecb6e012e932f56622978d 180314 libapt-pkg-dev_0.9.4_amd64.deb
cc2fed7663bf0407749cc8bfd8f6c82d1b548f70 350808 apt-utils_0.9.4_amd64.deb
0729e68a941ad0eba500e70821f231e9e0aef803 102450 apt-transport-https_0.9.4_amd64.deb
Checksums-Sha256:
bb62692a25451ee9169a75f708fb2762510028c69dbfdf2222c2271a3c9abe4a 1683 apt_0.9.4.dsc
6d30ebf4818b79ee49db99cd030b8169f1365cc68db1298546e19a706a4c86c8 3375298 apt_0.9.4.tar.gz
fec4dd437957d5231f85c5c4f506a83893ee3b9218ac3beaf5e1ee94719d3bc2 256630 apt-doc_0.9.4_all.deb
ab97b996d2ce57ca94a4aa88b28bcb7ac88f3fc9f6c12d9e78215275797df4ac 834616 libapt-pkg-doc_0.9.4_all.deb
51d99fd7d349d3c689f41d9ecc6073f7956f7bb313d30dc9cc7d6c8b8575b8c7 865096 libapt-pkg4.12_0.9.4_amd64.deb
57ec0a45cdf06d8e9c638bd43fe62d37ae22ba58c2d4011118587af0c9f8e5dd 159716 libapt-inst1.5_0.9.4_amd64.deb
5197c5b425f24ab8d5f4aa477aa4fda0842bf96c13491fbf1430856b0a5d0eb5 797540 apt_0.9.4_amd64.deb
1367cd87be79dc6e0ffc0c364862627614ad8209148bd09f10217dc998520863 180314 libapt-pkg-dev_0.9.4_amd64.deb
b4b95ce54935a7647d5c92ca1b24886b7e3458607238187479e41f4aca1eac9a 350808 apt-utils_0.9.4_amd64.deb
b73b8895df7708497da85333f37a101c504bd85dcc96ff03749f862da24efbfb 102450 apt-transport-https_0.9.4_amd64.deb
Files:
1e21de879c95e99f14c17ad54b39176e 1683 admin important apt_0.9.4.dsc
2632f36b9f4c01f78ae1e37aaa35091b 3375298 admin important apt_0.9.4.tar.gz
3fd050f45ab73815e5e65834d88770d4 256630 doc optional apt-doc_0.9.4_all.deb
7923ac87a585cefb7abb237ab0f8879f 834616 doc optional libapt-pkg-doc_0.9.4_all.deb
a689b18a0a4fe6cae09889ae248656e0 865096 admin important libapt-pkg4.12_0.9.4_amd64.deb
f1311311a8d25e30ca7bbe511408f681 159716 admin important libapt-inst1.5_0.9.4_amd64.deb
9c2c38b5cb7794148b1826b9ee2f30b5 797540 admin important apt_0.9.4_amd64.deb
6bb1ff4f31e13b056b71c8889255850e 180314 libdevel optional libapt-pkg-dev_0.9.4_amd64.deb
20c92cce342cece1fd64b6c5b528f9ec 350808 admin important apt-utils_0.9.4_amd64.deb
c124f5366d960ba6d10ec2055efbb41e 102450 admin optional apt-transport-https_0.9.4_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAk+6KkAACgkQliSD4VZixzRQ/QCePAKxtEXZ6R2ZUutFHHznsNfK
Jp4AnikbL5U526TSMZDzLBVKQB84q08y
=+xDT
-----END PGP SIGNATURE-----
--- End Message ---