libzypp: zypp/media/CurlHelper.h Source File

libzypp 17.25.10

CurlHelper.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 ----------------------------------------------------------------------/
9 *
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
12 *
13 */
14 #ifndef ZYPP_MEDIA_CURLHELPER_H_INCLUDED
15 #define ZYPP_MEDIA_CURLHELPER_H_INCLUDED
16
17 #include <curl/curl.h>
18 #include <zypp/Url.h>
19 #include <zypp/media/TransferSettings.h>
20
21 #define CONNECT_TIMEOUT 60
22 #define TRANSFER_TIMEOUT_MAX 60 * 60
23 #define DETECT_DIR_INDEX 0
24
25 #define EXPLICITLY_NO_PROXY "_none_"
26
27 #undef CURLVERSION_AT_LEAST
28 #define CURLVERSION_AT_LEAST(M,N,O) LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O)
29
30
31 //do not export
32 namespace internal {
33
34 namespace env {
35 int getZYPP_MEDIA_CURL_IPRESOLVE();
36 inline int ZYPP_MEDIA_CURL_IPRESOLVE()
37 {
38 static int _v = getZYPP_MEDIA_CURL_IPRESOLVE();
39 return _v;
40 }
41 }
42
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);
46
47
48 void fillSettingsFromUrl( const zypp::Url &url, zypp::media::TransferSettings &s );
49 void fillSettingsSystemProxy( const zypp::Url& url, zypp::media::TransferSettings &s );
50
55 const char * anonymousIdHeader();
56
61 const char * distributionFlavorHeader();
62
67 const char * agentString();
68
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 );
72
73 zypp::Url clearQueryString(const zypp::Url &url);
74 zypp::Url propagateQueryParams( zypp::Url url_r, const zypp::Url & template_r );
75
76 }
77
78
79
80
81 #endif
curl
CURL * curl
Definition: MediaCurl.cc:65
url
Url url
Definition: MediaCurl.cc:66
TransferSettings.h
Url.h
zypp::Url
Url manipulation class.
Definition: Url.h:92
zypp::media::TransferSettings
Holds transfer setting.
Definition: TransferSettings.h:21
internal::env::ZYPP_MEDIA_CURL_IPRESOLVE
int ZYPP_MEDIA_CURL_IPRESOLVE()
Definition: CurlHelper.h:36
internal::env::getZYPP_MEDIA_CURL_IPRESOLVE
int getZYPP_MEDIA_CURL_IPRESOLVE()
Definition: CurlHelper.cc:281
internal
Definition: CurlHelper.cc:17
internal::fillSettingsFromUrl
void fillSettingsFromUrl(const Url &url, media::TransferSettings &s)
Fills the settings structure using options passed on the url for example ?timeout=x&proxy=foo.
Definition: CurlHelper.cc:110
internal::log_redirects_curl
size_t log_redirects_curl(char *ptr, size_t size, size_t nmemb, void *userdata)
Definition: CurlHelper.cc:62
internal::anonymousIdHeader
const char * anonymousIdHeader()
initialized only once, this gets the anonymous id from the target, which we pass in the http header
Definition: CurlHelper.cc:294
internal::globalInitCurlOnce
void globalInitCurlOnce()
Definition: CurlHelper.cc:19
internal::distributionFlavorHeader
const char * distributionFlavorHeader()
initialized only once, this gets the distribution flavor from the target, which we pass in the http h...
Definition: CurlHelper.cc:308
internal::propagateQueryParams
zypp::Url propagateQueryParams(zypp::Url url_r, const zypp::Url &template_r)
Definition: CurlHelper.cc:384
internal::curlUnEscape
std::string curlUnEscape(std::string text_r)
Definition: CurlHelper.cc:351
internal::curlEscapedPath
std::string curlEscapedPath(std::string path_r)
Definition: CurlHelper.cc:346
internal::agentString
const char * agentString()
initialized only once, this gets the agent string which also includes the curl version
Definition: CurlHelper.cc:322
internal::fillSettingsSystemProxy
void fillSettingsSystemProxy(const Url &url, media::TransferSettings &s)
Reads the system proxy configuration and fills the settings structure proxy information.
Definition: CurlHelper.cc:258
internal::clearQueryString
Url clearQueryString(const Url &url)
Definition: CurlHelper.cc:358
internal::curlEscape
void curlEscape(std::string &str_r, const char char_r, const std::string &escaped_r)
Definition: CurlHelper.cc:338
internal::log_curl
int log_curl(CURL *curl, curl_infotype info, char *ptr, size_t len, void *max_lvl)
Definition: CurlHelper.cc:28