1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 ----------------------------------------------------------------------/
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
14 #ifndef ZYPP_MEDIA_CURLHELPER_H_INCLUDED
15 #define ZYPP_MEDIA_CURLHELPER_H_INCLUDED
17 #include <curl/curl.h>
19 #include <zypp/media/TransferSettings.h>
21 #define CONNECT_TIMEOUT 60
22 #define TRANSFER_TIMEOUT_MAX 60 * 60
23 #define DETECT_DIR_INDEX 0
25 #define EXPLICITLY_NO_PROXY "_none_"
27 #undef CURLVERSION_AT_LEAST
28 #define CURLVERSION_AT_LEAST(M,N,O) LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O)
35 int getZYPP_MEDIA_CURL_IPRESOLVE();
36 inline int ZYPP_MEDIA_CURL_IPRESOLVE()
38 static int _v = getZYPP_MEDIA_CURL_IPRESOLVE();
43 void globalInitCurlOnce();
44 int log_curl(CURL *curl, curl_infotype info, char *ptr, size_t len, void *max_lvl);
45 size_t log_redirects_curl( char *ptr, size_t size, size_t nmemb, void *userdata);
48 void fillSettingsFromUrl( const zypp::Url &url, zypp::media::TransferSettings &s );
49 void fillSettingsSystemProxy( const zypp::Url& url, zypp::media::TransferSettings &s );
52 * initialized only once, this gets the anonymous id
53 * from the target, which we pass in the http header
55 const char * anonymousIdHeader();
58 * initialized only once, this gets the distribution flavor
59 * from the target, which we pass in the http header
61 const char * distributionFlavorHeader();
64 * initialized only once, this gets the agent string
65 * which also includes the curl version
67 const char * agentString();
69 void curlEscape( std::string & str_r, const char char_r, const std::string & escaped_r );
70 std::string curlEscapedPath( std::string path_r );
71 std::string curlUnEscape( std::string text_r );
73 zypp::Url clearQueryString(const zypp::Url &url);
74 zypp::Url propagateQueryParams( zypp::Url url_r, const zypp::Url & template_r );