14 #ifndef ZYPP_MEDIA_CURLHELPER_H_INCLUDED 15 #define ZYPP_MEDIA_CURLHELPER_H_INCLUDED 17 #include <curl/curl.h> 22 #define CONNECT_TIMEOUT 60 23 #define TRANSFER_TIMEOUT_MAX 60 * 60 24 #define DETECT_DIR_INDEX 0 26 #define EXPLICITLY_NO_PROXY "_none_" 28 #undef CURLVERSION_AT_LEAST 29 #define CURLVERSION_AT_LEAST(M,N,O) LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O) 39 if (
char *ptr = ::getenv(
"ZYPP_MEDIA_CURL_DEBUG"); ptr && *ptr )
80 void updateStats(
double dltotal = 0.0,
double dlnow = 0.0 );
102 int log_curl(CURL *curl, curl_infotype info,
char *ptr,
size_t len,
void *max_lvl);
127 void curlEscape( std::string & str_r,
const char char_r,
const std::string & escaped_r );
void globalInitCurlOnce()
size_t log_redirects_curl(char *ptr, size_t size, size_t nmemb, void *userdata)
const char * anonymousIdHeader()
initialized only once, this gets the anonymous id from the target, which we pass in the http header ...
zypp::Url propagateQueryParams(zypp::Url url_r, const zypp::Url &template_r)
Store and operate with byte count.
int reportProgress() const
Url clearQueryString(const Url &url)
std::string curlEscapedPath(std::string path_r)
const char * distributionFlavorHeader()
initialized only once, this gets the distribution flavor from the target, which we pass in the http h...
int ZYPP_MEDIA_CURL_IPRESOLVE()
4/6 to force IPv4/v6
void curlEscape(std::string &str_r, const char char_r, const std::string &escaped_r)
double _dnlTotal
Bytes to download or 0 if unknown.
double _dnlLast
Bytes downloaded at period start.
TInt strtonum(const C_Str &str)
Parsing numbers from string.
void fillSettingsFromUrl(const Url &url, media::TransferSettings &s)
Fills the settings structure using options passed on the url for example ?timeout=x&proxy=foo.
zypp::ByteCount _expectedFileSize
int _dnlPercent
Percent completed or 0 if _dnlTotal is unknown.
long ZYPP_MEDIA_CURL_DEBUG()
Long number for setting CURLOPT_DEBUGDATA.
ProgressData(CURL *_curl, time_t _timeout=0, const zypp::Url &_url=zypp::Url(), zypp::ByteCount expectedFileSize_r=0, zypp::callback::SendReport< zypp::media::DownloadProgressReport > *_report=nullptr)
double _drateLast
Download rate in last period.
std::string curlUnEscape(std::string text_r)
time_t _timeStart
Start total stats.
double _dnlNow
Bytes downloaded now.
const char * agentString()
initialized only once, this gets the agent string which also includes the curl version ...
void updateStats(double dltotal=0.0, double dlnow=0.0)
void fillSettingsSystemProxy(const Url &url, media::TransferSettings &s)
Reads the system proxy configuration and fills the settings structure proxy information.
double _drateTotal
Download rate so far.
time_t _timeRcv
Start of no-data timeout.
Easy-to use interface to the ZYPP dependency resolver.
int log_curl(CURL *curl, curl_infotype info, char *ptr, size_t len, void *max_lvl)
time_t _timeLast
Start last period(~1sec)
zypp::callback::SendReport< zypp::media::DownloadProgressReport > * report