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