1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/MediaMultiCurl.h
12 #ifndef ZYPP_MEDIA_MEDIAMULTICURL_H
13 #define ZYPP_MEDIA_MEDIAMULTICURL_H
20 #include "zypp/media/MediaHandler.h"
21 #include "zypp/media/MediaCurl.h"
22 #include "zypp/media/MediaBlockList.h"
23 #include "zypp/media/TransferSettings.h"
24 #include "zypp/ZYppCallbacks.h"
30 * @short Implementation class for FTP, HTTP and HTTPS MediaHandler
32 * @author Michael Schroeder <mls@suse.de>
37 class multifetchrequest;
38 class multifetchworker;
40 class MediaMultiCurl : public MediaCurl {
42 friend class multifetchrequest;
43 friend class multifetchworker;
45 MediaMultiCurl(const Url &url_r, const Pathname & attach_point_hint_r);
48 virtual void doGetFileCopy( const Pathname & srcFilename, const Pathname & targetFilename, callback::SendReport<DownloadProgressReport> & _report, const ByteCount &expectedFileSize_r, RequestOptions options = OPTION_NONE ) const override;
50 void multifetch(const Pathname &filename, FILE *fp, std::vector<Url> *urllist, callback::SendReport<DownloadProgressReport> *report = 0, MediaBlockList *blklist = 0, off_t filesize = off_t(-1)) const;
54 bool isDNSok(const std::string &host) const;
55 void setDNSok(const std::string &host) const;
57 CURL *fromEasyPool(const std::string &host) const;
58 void toEasyPool(const std::string &host, CURL *easy) const;
60 virtual void setupEasy();
61 void checkFileDigest(Url &url, FILE *fp, MediaBlockList *blklist) const;
62 static int progressCallback( void *clientp, double dltotal, double dlnow, double ultotal, double ulnow );
65 // the custom headers from MediaCurl plus a "Accept: metalink" header
66 curl_slist *_customHeadersMetalink;
67 mutable CURLM *_multi; // reused for all fetches so we can make use of the dns cache
68 mutable std::set<std::string> _dnsok;
69 mutable std::map<std::string, CURL *> _easypool;
72 ///////////////////////////////////////////////////////////////////
77 #endif // ZYPP_MEDIA_MEDIAMULTICURL_H