summaryrefslogtreecommitdiff
path: root/methods/mirror.cc
AgeCommit message (Collapse)Author
2018-01-03non-local mirrorlists shouldn't redirect to localDavid Kalnischkies
A mirror list we get from an non-local source like http shouldn't be able to include e.g. file sources and even with other online sources we need to be careful: They also shouldn't include prefixed methods like 'tor+http'. So apply magic based on how the method is called: mirror+file will be allowed to redirect to any source while tor+mirror+file allows all, but sends them to their tor+ variant.
2018-01-03add tag-based control over mirror choices from the listDavid Kalnischkies
The old implementation used to construct a query string including the release(s) the mirrorlist should be for, but that is hard to deal with as this rules out that partial mirrors are included in the list and it turns out that nobody ended up implementing it on the server side. Controlling this on the client side allows partial mirrors to be included and as a bonus prevents that we tell the mirrorlist server (this rather generic) user information.
2018-01-03require methods to request AuxRequest capability at startupDavid Kalnischkies
Allowing a method to request work from other methods is a powerful capability which could be misused or exploited, so to slightly limited the surface let method opt-in into this capability on startup.
2018-01-03reimplement and simplify mirror:// methodDavid Kalnischkies
Embedding an entire acquire stack and HTTP logic in the mirror method made it rather heavy weight and fragile. This reimplement goes the other way by doing only the bare minimum in the method itself and instead redirect the actual download of files to their proper methods. The reimplementation drops the (in the real world) unused query-string feature as it isn't really implementable in the new architecture.
2017-10-22methods/mirror: Enable sandboxing and other aptMethod featuresJulian Andres Klode
Sandboxing was turned off because we called pkgAcqMethod's Configuration() instead of aptMethod's.
2017-07-12Reformat and sort all includes with clang-formatJulian Andres Klode
This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
2017-06-26avoid changing directory in mirror methodDavid Kalnischkies
2016-08-10implement generic config fallback for methodsDavid Kalnischkies
The https method implemented for a long while now a hardcoded fallback to the same options in http, which, while it works, is rather inflexible if we want to allow the methods to use another name to change their behavior slightly, like apt-transport-tor does to https – most of the diff being s#https#tor#g which then fails to do the full circle fallthrough tor -> https -> http for https sources. With this config infrastructure this could be implemented now.
2016-05-28use std::locale::global instead of setlocaleDavid Kalnischkies
We use a wild mixture of C and C++ ways of generating output, so having a consistent world-view in both styles sounds like a good idea and should help in preventing regressions.
2015-11-19ignore lost+found in private directory cleanupDavid Kalnischkies
In ce1f3a2c we started warning about failing unlinking, which we consistently do for directories. That isn't a problem as directories usually aren't in the places we do want to clean up – with the potential exeception of "lost+found", so lets ignore it like we ignore our own partial/ subdirectory. Closes: 805424
2015-11-04wrap every unlink call to check for != /dev/nullDavid Kalnischkies
Unlinking /dev/null is bad, we shouldn't do that. Also, we should print at least a warning if we tried to unlink a file but didn't manage to pull it of (ignoring the case were the file is /dev/null or doesn't exist in the first place). This got triggered by a relatively unlikely to cause problem in pkgAcquire::Worker::PrepareFiles which would while temporary uncompressed files (which are set to keep compressed) figure out that to files are the same and prepare for sharing by deleting them. Bad move. That also shows why not printing a warning is a bad idea as this hide the error for in non-root test runs. Git-Dch: Ignore
2014-03-13cleanup headers and especially #includes everywhereDavid Kalnischkies
Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
2014-03-13warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies
Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
2014-03-13warning: extra ‘;’ [-Wpedantic]David Kalnischkies
Git-Dch: Ignore Reported-By: gcc -Wpedantic
2014-02-22Fix typos in documentation (codespell)Michael Vogt
2014-01-16correct some style/performance/warnings from cppcheckDavid Kalnischkies
The most "visible" change is from utime to utimensat/futimens as the first one isn't part of POSIX anymore. Reported-By: cppcheck Git-Dch: Ignore
2013-06-06Fix double free (closes: #711045)Michael Vogt
* Fix double free (closes: #711045) * Fix crash when the "mirror" method does not find any entry (closes: #699303)
2012-05-14* methods/mirror.cc:Raphael Geissert
- generate an equal sign also for the first arch (Closes: #669142)
2012-03-20* methods/rred.cc:David Kalnischkies
- check return of writev() as gcc recommends * methods/mirror.cc: - check return of chdir() as gcc recommends * apt-pkg/deb/dpkgpm.cc: - check return of write() a gcc recommends * apt-inst/deb/debfile.cc: - check return of chdir() as gcc recommends * apt-inst/deb/dpkgdb.cc: - check return of chdir() as gcc recommends
2012-03-05micro-optimize "(performance) Prefer prefix ++/-- operators for ↵David Kalnischkies
non-primitive types."
2011-09-19use forward declaration in headers if possible instead of includesDavid Kalnischkies
2011-09-13merge with debian/experimentalDavid Kalnischkies
2011-09-13reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies
2011-08-15merged from lp:~mvo/apt/mvoMichael Vogt
2011-08-11follow the recommendation of cppcheck to make some method methods (scnr)David Kalnischkies
const and initial mostly Debug member values in the constructors
2011-08-11cppcheck complains about some possible speed improvements which could beDavid Kalnischkies
done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types.
2011-08-11* methods/mirror.cc:Michael Vogt
- include the architecture(s) in the query string as well so that the server can make better decisions
2011-06-07append the dist (e.g. sid, wheezy) as a query string whenMichael Vogt
asking for a suitable mirror
2011-06-07* methods/mirror.cc:Michael Vogt
- ignore lines starting with "#" in the mirror file - ignore non http urls in the mirrors
2011-03-24methods/mirror.cc: raise error if the mirror file can not be readMichael Vogt
2011-03-24do not crash if the mirror file fails to downloadMichael Vogt
2011-03-24merge fix from Matt Zimmerman, many thanks (LP: #741098)Michael Vogt
2011-03-14methods/mirror.cc: randomize only based on hostnameMichael Vogt
2011-03-14methods/mirror.cc: init random seed at startupMichael Vogt
2011-03-14randomize mirror list to ensure more even loadMichael Vogt
2011-03-14* mirror method:Michael Vogt
- when downloading data, show the mirror being used
2011-03-11methods/mirror.cc: improve debug output and fix selecting the next mirrorMichael Vogt
2010-06-09fix compiler warning in the new mirror codeDavid Kalnischkies
2010-06-02methods/mirror.cc: debug improvementsMichael Vogt
2010-06-02implement Fail-Ignore bool in FetchItem that tells the method that a failure ↵Michael Vogt
of this item is ok and does not need to be tried on all mirrors
2010-06-02methods/mirror.cc: simplify uri.startswith()Michael Vogt
2010-06-02methods/mirrors.cc: make cycle through the mirrors work properlyMichael Vogt
2010-06-02methods/mirror.cc: remove Acquire::Mirror::RefreshInterval (not really useful)Michael Vogt
2010-06-02improve error message if mirror method failsMichael Vogt
2010-06-02methods/mirror.cc: on fail try the next mirrorMichael Vogt
2010-06-02* apt-pkg/deb/dpkgpm.cc:Michael Vogt
- add missing include * methods/mirror.{cc,h}: - add SelectNextMirror() and InitMirrors() functions - read all mirrors into the AllMirrors vector
2009-03-19* methods/mirror.cc:Michael Vogt
- when download the mirror file and the server is down, return a propper error message (LP: #278635)
2007-11-28* methods/mirror.{cc,h}:Michael Vogt
- only update mirror list on IndexFile updates
2007-11-28methods/mirror.{cc,h}:Michael Vogt
- improve the mirror method so that it only updates the mirror list from the server if we get new indexfiles - code cleanup
2007-02-06* merged the apt--mirror branchMichael Vogt