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