mirror.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. MIRROR Aquire Method - This is the MIRROR aquire method for APT.
  6. ##################################################################### */
  7. /*}}}*/
  8. #ifndef APT_MIRROR_H
  9. #define APT_MIRROR_H
  10. #include <iostream>
  11. using std::cout;
  12. using std::cerr;
  13. using std::endl;
  14. #include "http.h"
  15. class MirrorMethod : public HttpMethod
  16. {
  17. FetchResult Res;
  18. // we simply transform between BaseUri and Mirror
  19. string BaseUri; // the original mirror://... url
  20. string Mirror; // the selected mirror uri (http://...)
  21. vector<string> AllMirrors; // all available mirrors
  22. string MirrorFile; // the file that contains the list of mirrors
  23. bool DownloadedMirrorFile; // already downloaded this session
  24. bool Debug;
  25. protected:
  26. bool DownloadMirrorFile(string uri);
  27. string GetMirrorFileName(string uri);
  28. bool InitMirrors();
  29. bool TryNextMirror();
  30. void CurrentQueueUriToMirror();
  31. bool Clean(string dir);
  32. // we need to overwrite those to transform the url back
  33. virtual void Fail(string Why, bool Transient = false);
  34. virtual void URIStart(FetchResult &Res);
  35. virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
  36. virtual bool Configuration(string Message);
  37. public:
  38. MirrorMethod();
  39. virtual bool Fetch(FetchItem *Itm);
  40. };
  41. #endif