libzypp  17.31.8
curlhelper_p.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_PRIVATE_CURLHELPER_P_H_INCLUDED
15 #define ZYPP_MEDIA_PRIVATE_CURLHELPER_P_H_INCLUDED
16 
17 #include <curl/curl.h>
18 #include <zypp-core/Url.h>
19 #include <zypp-curl/TransferSettings>
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 namespace zypp
31 {
32  namespace env
33  {
35  inline long ZYPP_MEDIA_CURL_DEBUG()
36  {
37  long ret = 0L;
38  if ( char *ptr = ::getenv("ZYPP_MEDIA_CURL_DEBUG"); ptr && *ptr )
39  str::strtonum( ptr, ret );
40  return ret;
41  }
42 
45  } // namespace env
46 } //namespace zypp
47 
48 //do not export
49 namespace internal {
50 
51 void globalInitCurlOnce();
52 int log_curl(CURL *curl, curl_infotype info, char *ptr, size_t len, void *max_lvl);
53 size_t log_redirects_curl( char *ptr, size_t size, size_t nmemb, void *userdata);
54 
55 
58 
59 void curlEscape( std::string & str_r, const char char_r, const std::string & escaped_r );
60 std::string curlEscapedPath( std::string path_r );
61 std::string curlUnEscape( std::string text_r );
62 
64 zypp::Url propagateQueryParams( zypp::Url url_r, const zypp::Url & template_r );
65 
66 }
67 
68 #endif //ZYPP_MEDIA_PRIVATE_CURLHELPER_P_H_INCLUDED
void globalInitCurlOnce()
Definition: curlhelper.cc:59
size_t log_redirects_curl(char *ptr, size_t size, size_t nmemb, void *userdata)
Definition: curlhelper.cc:102
zypp::Url propagateQueryParams(zypp::Url url_r, const zypp::Url &template_r)
Definition: curlhelper.cc:358
int log_curl(CURL *, curl_infotype info, char *ptr, size_t len, void *max_lvl)
Definition: curlhelper.cc:68
Holds transfer setting.
Url clearQueryString(const Url &url)
Definition: curlhelper.cc:332
std::string curlEscapedPath(std::string path_r)
Definition: curlhelper.cc:320
int ZYPP_MEDIA_CURL_IPRESOLVE()
4/6 to force IPv4/v6
Definition: curlhelper.cc:48
void curlEscape(std::string &str_r, const char char_r, const std::string &escaped_r)
Definition: curlhelper.cc:312
TInt strtonum(const C_Str &str)
Parsing numbers from string.
Definition: String.h:388
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:142
long ZYPP_MEDIA_CURL_DEBUG()
Long number for setting CURLOPT_DEBUGDATA.
Definition: curlhelper_p.h:35
std::string curlUnEscape(std::string text_r)
Definition: curlhelper.cc:325
void fillSettingsSystemProxy(const Url &url, media::TransferSettings &s)
Reads the system proxy configuration and fills the settings structure proxy information.
Definition: curlhelper.cc:290
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
Url manipulation class.
Definition: Url.h:91