summaryrefslogtreecommitdiff
path: root/methods/mirror.cc
Commit message (Collapse)AuthorAgeFilesLines
* Apply various suggestions by cppcheckDavid Kalnischkies2019-07-081-7/+3
| | | | Reported-By: cppcheck
* Add 'explicit' to most single argument constructorsJulian Andres Klode2019-04-301-1/+1
| | | | | | | | | | | This prevents implicit conversions that we do not want, such as having a FileFd* being converted to a debListParser. Two cases are not yet handled because they require changes in code using them: 1. The classes in hashes.h 2. The URI class - this one is used quite a lot
* non-local mirrorlists shouldn't redirect to localDavid Kalnischkies2018-01-031-2/+46
| | | | | | | | | 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.
* add tag-based control over mirror choices from the listDavid Kalnischkies2018-01-031-34/+103
| | | | | | | | | | | 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.
* require methods to request AuxRequest capability at startupDavid Kalnischkies2018-01-031-1/+1
| | | | | | 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.
* reimplement and simplify mirror:// methodDavid Kalnischkies2018-01-031-398/+225
| | | | | | | | | | 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.
* methods/mirror: Enable sandboxing and other aptMethod featuresJulian Andres Klode2017-10-221-1/+1
| | | | | Sandboxing was turned off because we called pkgAcqMethod's Configuration() instead of aptMethod's.
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-10/+10
| | | | | | | | | | | | | 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.
* avoid changing directory in mirror methodDavid Kalnischkies2017-06-261-17/+13
|
* implement generic config fallback for methodsDavid Kalnischkies2016-08-101-2/+2
| | | | | | | | | | 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.
* use std::locale::global instead of setlocaleDavid Kalnischkies2016-05-281-6/+1
| | | | | | 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.
* ignore lost+found in private directory cleanupDavid Kalnischkies2015-11-191-0/+1
| | | | | | | | | | 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
* wrap every unlink call to check for != /dev/nullDavid Kalnischkies2015-11-041-1/+1
| | | | | | | | | | | | | | | | 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
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-5/+5
| | | | | | | | 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)
* warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies2014-03-131-1/+1
| | | | | Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
* warning: extra ‘;’ [-Wpedantic]David Kalnischkies2014-03-131-14/+14
| | | | | Git-Dch: Ignore Reported-By: gcc -Wpedantic
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-3/+3
|
* correct some style/performance/warnings from cppcheckDavid Kalnischkies2014-01-161-4/+4
| | | | | | | | 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
* Fix double free (closes: #711045)Michael Vogt2013-06-061-0/+3
| | | | | | | * Fix double free (closes: #711045) * Fix crash when the "mirror" method does not find any entry (closes: #699303)
* * methods/mirror.cc:Raphael Geissert2012-05-141-1/+1
| | | | - generate an equal sign also for the first arch (Closes: #669142)
* * methods/rred.cc:David Kalnischkies2012-03-201-2/+3
| | | | | | | | | | | - 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
* micro-optimize "(performance) Prefer prefix ++/-- operators for ↵David Kalnischkies2012-03-051-1/+1
| | | | non-primitive types."
* use forward declaration in headers if possible instead of includesDavid Kalnischkies2011-09-191-1/+2
|
* merge with debian/experimentalDavid Kalnischkies2011-09-131-4/+20
|\
| * merged from lp:~mvo/apt/mvoMichael Vogt2011-08-151-1/+17
| |\
| | * * methods/mirror.cc:Michael Vogt2011-08-111-1/+17
| | | | | | | | | | | | - include the architecture(s) in the query string as well so that the server can make better decisions
| * | follow the recommendation of cppcheck to make some method methods (scnr)David Kalnischkies2011-08-111-1/+1
| | | | | | | | | | | | const and initial mostly Debug member values in the constructors
| * | cppcheck complains about some possible speed improvements which could beDavid Kalnischkies2011-08-111-2/+2
| |/ | | | | | | | | | | done on the mirco-optimazation level, so lets fix them: (performance) Possible inefficient checking for emptiness. (performance) Prefer prefix ++/-- operators for non-primitive types.
* / reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies2011-09-131-1/+3
|/
* append the dist (e.g. sid, wheezy) as a query string whenMichael Vogt2011-06-071-0/+5
| | | asking for a suitable mirror
* * methods/mirror.cc:Michael Vogt2011-06-071-2/+12
| | | | - ignore lines starting with "#" in the mirror file - ignore non http urls in the mirrors
* methods/mirror.cc: raise error if the mirror file can not be readMichael Vogt2011-03-241-0/+7
|
* do not crash if the mirror file fails to downloadMichael Vogt2011-03-241-2/+5
|
* merge fix from Matt Zimmerman, many thanks (LP: #741098)Michael Vogt2011-03-241-1/+3
|
* methods/mirror.cc: randomize only based on hostnameMichael Vogt2011-03-141-4/+15
|
* methods/mirror.cc: init random seed at startupMichael Vogt2011-03-141-1/+3
|
* randomize mirror list to ensure more even loadMichael Vogt2011-03-141-0/+30
|
* * mirror method:Michael Vogt2011-03-141-0/+4
| | | - when downloading data, show the mirror being used
* methods/mirror.cc: improve debug output and fix selecting the next mirrorMichael Vogt2011-03-111-4/+9
|
* fix compiler warning in the new mirror codeDavid Kalnischkies2010-06-091-11/+16
|
* methods/mirror.cc: debug improvementsMichael Vogt2010-06-021-2/+9
|
* implement Fail-Ignore bool in FetchItem that tells the method that a failure ↵Michael Vogt2010-06-021-12/+11
| | | | of this item is ok and does not need to be tried on all mirrors
* methods/mirror.cc: simplify uri.startswith()Michael Vogt2010-06-021-1/+1
|
* methods/mirrors.cc: make cycle through the mirrors work properlyMichael Vogt2010-06-021-15/+40
|
* methods/mirror.cc: remove Acquire::Mirror::RefreshInterval (not really useful)Michael Vogt2010-06-021-22/+0
|
* improve error message if mirror method failsMichael Vogt2010-06-021-6/+8
|
* methods/mirror.cc: on fail try the next mirrorMichael Vogt2010-06-021-1/+11
|
* * apt-pkg/deb/dpkgpm.cc:Michael Vogt2010-06-021-7/+23
| | | | | | | - add missing include * methods/mirror.{cc,h}: - add SelectNextMirror() and InitMirrors() functions - read all mirrors into the AllMirrors vector
* * methods/mirror.cc:Michael Vogt2009-03-191-2/+16
| | | | - when download the mirror file and the server is down, return a propper error message (LP: #278635)
* * methods/mirror.{cc,h}:Michael Vogt2007-11-281-59/+93
|\ | | | | - only update mirror list on IndexFile updates