]>
Commit | Line | Data |
---|---|---|
5f6b130d MV |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $ | |
3 | // $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
1e3f4083 | 6 | MIRROR Acquire Method - This is the MIRROR acquire method for APT. |
5f6b130d MV |
7 | |
8 | ##################################################################### */ | |
9 | /*}}}*/ | |
10 | ||
11 | #ifndef APT_MIRROR_H | |
12 | #define APT_MIRROR_H | |
13 | ||
453b82a3 DK |
14 | #include <apt-pkg/acquire-method.h> |
15 | ||
5f6b130d | 16 | #include <iostream> |
472ff00e DK |
17 | #include <string> |
18 | #include <vector> | |
5f6b130d MV |
19 | |
20 | using std::cout; | |
21 | using std::cerr; | |
22 | using std::endl; | |
23 | ||
24 | #include "http.h" | |
25 | ||
14e097c1 | 26 | class MirrorMethod : public HttpMethod |
5f6b130d MV |
27 | { |
28 | FetchResult Res; | |
86c17f0a | 29 | // we simply transform between BaseUri and Mirror |
472ff00e DK |
30 | std::string BaseUri; // the original mirror://... url |
31 | std::string Mirror; // the selected mirror uri (http://...) | |
32 | std::vector<std::string> AllMirrors; // all available mirrors | |
33 | std::string MirrorFile; // the file that contains the list of mirrors | |
38eedeb7 | 34 | bool DownloadedMirrorFile; // already downloaded this session |
472ff00e | 35 | std::string Dist; // the target distrubtion (e.g. sid, oneiric) |
5f6b130d | 36 | |
14e097c1 MV |
37 | bool Debug; |
38 | ||
5f6b130d | 39 | protected: |
472ff00e DK |
40 | bool DownloadMirrorFile(std::string uri); |
41 | bool RandomizeMirrorFile(std::string file); | |
42 | std::string GetMirrorFileName(std::string uri); | |
96db74ce | 43 | bool InitMirrors(); |
03915427 MV |
44 | bool TryNextMirror(); |
45 | void CurrentQueueUriToMirror(); | |
472ff00e | 46 | bool Clean(std::string dir); |
86c17f0a MV |
47 | |
48 | // we need to overwrite those to transform the url back | |
472ff00e | 49 | virtual void Fail(std::string Why, bool Transient = false); |
14e097c1 MV |
50 | virtual void URIStart(FetchResult &Res); |
51 | virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0); | |
472ff00e | 52 | virtual bool Configuration(std::string Message); |
14e097c1 | 53 | |
5f6b130d MV |
54 | public: |
55 | MirrorMethod(); | |
56 | virtual bool Fetch(FetchItem *Itm); | |
57 | }; | |
58 | ||
59 | ||
60 | #endif |