├── .gitignore ├── HttpClient.sln ├── HttpClient ├── HttpClient.cpp ├── HttpClient.vcxproj ├── HttpClient.vcxproj.filters ├── include │ ├── HttpClient.h │ └── curl │ │ ├── curl.h │ │ ├── curlbuild.h │ │ ├── curlrules.h │ │ ├── curlver.h │ │ ├── easy.h │ │ ├── mprintf.h │ │ ├── multi.h │ │ ├── stdcheaders.h │ │ └── typecheck-gcc.h ├── lib │ ├── libcurl.a │ └── libcurl_a_md_vs2015_x86.lib └── main.cpp ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /HttpClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpClient", "HttpClient\HttpClient.vcxproj", "{E5BD3BC0-4D4B-4246-B22D-F415496C9399}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Debug|x64.ActiveCfg = Debug|x64 17 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Debug|x64.Build.0 = Debug|x64 18 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Debug|x86.ActiveCfg = Debug|Win32 19 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Debug|x86.Build.0 = Debug|Win32 20 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Release|x64.ActiveCfg = Release|x64 21 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Release|x64.Build.0 = Release|x64 22 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Release|x86.ActiveCfg = Release|Win32 23 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /HttpClient/HttpClient.cpp: -------------------------------------------------------------------------------- 1 | #include "include/HttpClient.h" 2 | #include 3 | 4 | HttpClient *HttpClient::instance = NULL; 5 | 6 | double HttpClient::downloadFileLength = -1; 7 | curl_off_t HttpClient::resumeByte = -1; 8 | time_t HttpClient::lastTime = 0; 9 | 10 | bool HttpClient::stopCurl = false; 11 | 12 | HttpClient::HttpClient() 13 | { 14 | } 15 | 16 | 17 | HttpClient::~HttpClient() 18 | { 19 | } 20 | 21 | HttpClient *HttpClient::getInstance() 22 | { 23 | if (instance == NULL) 24 | { 25 | instance = new HttpClient(); 26 | instance->init(); 27 | } 28 | 29 | return instance; 30 | } 31 | 32 | void HttpClient::destroyInstance() 33 | { 34 | if (instance != NULL) 35 | { 36 | stopCurl = true; 37 | 38 | // curl_global_cleanup() will crash on Qt windows 39 | 40 | delete instance; 41 | instance = NULL; 42 | } 43 | } 44 | 45 | bool HttpClient::init() 46 | { 47 | if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) 48 | return false; 49 | 50 | return true; 51 | } 52 | 53 | void HttpClient::zlog(const char *date, const char *time, const char *file, const int line, const char *func, const char *str) 54 | { 55 | #ifdef Z_DEBUG 56 | FILE *fp = NULL; 57 | #ifdef _WIN32 58 | fopen_s(&fp, "log.log", "a+"); 59 | #else 60 | fopen("log.log", "a+"); 61 | #endif 62 | fprintf(fp, "%s | %s | %s | %d | %s | %s\n", date, time, file, line, func, str); 63 | fclose(fp); 64 | #else 65 | (void)str; 66 | #endif // end Z_DEBUG 67 | } 68 | 69 | // Return 0 if success, otherwise return error code 70 | int HttpClient::HttpGet(const string requestURL, const string saveTo, void *sender, progress_info_callback cb) 71 | { 72 | string partPath = saveTo + ".part"; 73 | 74 | CURL *easy_handle = NULL; 75 | FILE *fp = NULL; 76 | 77 | int ret = HTTP_REQUEST_ERROR; 78 | 79 | do 80 | { 81 | // Get the file size on the server 82 | downloadFileLength = getDownloadFileLength(requestURL); 83 | 84 | if (downloadFileLength < 0) 85 | { 86 | ZLOG("getDownloadFileLength error"); 87 | break; 88 | } 89 | 90 | easy_handle = curl_easy_init(); 91 | if (!easy_handle) 92 | { 93 | ZLOG("curl_easy_init error"); 94 | break; 95 | } 96 | 97 | #ifdef _WIN32 98 | fopen_s(&fp, partPath.c_str(), "ab+"); 99 | #else 100 | fp = fopen(partPath.c_str(), "ab+"); 101 | #endif 102 | if (fp == NULL) 103 | { 104 | ZLOG("file open failed"); 105 | ZLOG(partPath.c_str()); 106 | break; 107 | } 108 | 109 | // Set the url 110 | ret = curl_easy_setopt(easy_handle, CURLOPT_URL, requestURL.c_str()); 111 | 112 | // Save data from the server 113 | ret |= curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, &HttpClient::write_callback); 114 | ret |= curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, fp); 115 | 116 | Progress_User_Data data = { sender, easy_handle, cb }; 117 | 118 | // Get the download progress 119 | ret |= curl_easy_setopt(easy_handle, CURLOPT_NOPROGRESS, 0L); 120 | ret |= curl_easy_setopt(easy_handle, CURLOPT_XFERINFOFUNCTION, &HttpClient::progress_callback); 121 | ret |= curl_easy_setopt(easy_handle, CURLOPT_XFERINFODATA, &data); 122 | 123 | // Fail the request if the HTTP code returned is equal to or larger than 400 124 | ret |= curl_easy_setopt(easy_handle, CURLOPT_FAILONERROR, 1L); 125 | 126 | // The maximum time that allow the connection parse to the server 127 | ret |= curl_easy_setopt(easy_handle, CURLOPT_CONNECTTIMEOUT, 10L); 128 | 129 | resumeByte = getLocalFileLength(partPath); 130 | if (resumeByte > 0) 131 | { 132 | // Set a point to resume transfer 133 | ret |= curl_easy_setopt(easy_handle, CURLOPT_RESUME_FROM_LARGE, resumeByte); 134 | } 135 | 136 | if (ret != CURLE_OK) 137 | { 138 | ret = HTTP_REQUEST_ERROR; 139 | ZLOG("curl_easy_setopt error"); 140 | break; 141 | } 142 | 143 | ret = curl_easy_perform(easy_handle); 144 | 145 | if (ret != CURLE_OK) 146 | { 147 | char s[100] = { 0 }; 148 | #ifdef _WIN32 149 | sprintf_s(s, sizeof(s), "error:%d:%s", ret, curl_easy_strerror(static_cast(ret))); 150 | #else 151 | sprintf(s, "error:%d:%s", ret, curl_easy_strerror(static_cast(ret))); 152 | #endif 153 | 154 | ZLOG(s); 155 | switch (ret) 156 | { 157 | case CURLE_HTTP_RETURNED_ERROR: 158 | { 159 | int code = 0; 160 | curl_easy_getinfo(easy_handle, CURLINFO_RESPONSE_CODE, &code); 161 | 162 | char s[100] = { 0 }; 163 | #ifdef _WIN32 164 | sprintf_s(s, sizeof(s), "HTTP error code:%d", code); 165 | #else 166 | sprintf(s, "HTTP error code:%d", code); 167 | #endif 168 | ZLOG(s); 169 | break; 170 | } 171 | } 172 | } 173 | } while (0); 174 | 175 | if (fp != NULL) 176 | { 177 | fclose(fp); 178 | fp = NULL; 179 | } 180 | 181 | curl_easy_cleanup(easy_handle); 182 | easy_handle = NULL; 183 | 184 | if (ret == CURLE_OK) 185 | { 186 | remove(saveTo.c_str()); 187 | rename(partPath.c_str(), saveTo.c_str()); 188 | } 189 | 190 | return ret; 191 | } 192 | 193 | size_t HttpClient::write_callback(char *buffer, size_t size, size_t nmemb, void *userdata) 194 | { 195 | FILE *fp = static_cast(userdata); 196 | size_t length = fwrite(buffer, size, nmemb, fp); 197 | if (length != nmemb) 198 | { 199 | return length; 200 | } 201 | 202 | return size * nmemb; 203 | } 204 | 205 | int HttpClient::progress_callback(void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) 206 | { 207 | (void)ultotal; 208 | (void)ulnow; 209 | 210 | if(stopCurl) 211 | return 1; 212 | 213 | time_t now = time(NULL); 214 | if (now - lastTime < 1) 215 | { 216 | return 0; 217 | } 218 | lastTime = now; 219 | 220 | Progress_User_Data *data = static_cast(userdata); 221 | CURL *easy_handle = data->handle; 222 | 223 | // Defaults to bytes/second 224 | double speed = 0; 225 | curl_easy_getinfo(easy_handle, CURLINFO_SPEED_DOWNLOAD, &speed); 226 | 227 | // Time remaining 228 | double leftTime = 0; 229 | 230 | // Progress percentage 231 | double progress = 0; 232 | 233 | if (dltotal != 0 && speed != 0) 234 | { 235 | progress = (dlnow + resumeByte) / downloadFileLength * 100; 236 | leftTime = (downloadFileLength - dlnow - resumeByte) / speed; 237 | //printf("\t%.2f%%\tRemaing time:%s\n", progress, timeFormat); 238 | } 239 | 240 | if (data->cb != NULL) 241 | data->cb(data->sender, speed, leftTime, progress); 242 | 243 | return 0; 244 | } 245 | 246 | // Get the local file size, return -1 if failed 247 | p_off_t HttpClient::getLocalFileLength(string path) 248 | { 249 | p_off_t ret; 250 | struct stat fileStat; 251 | 252 | ret = stat(path.c_str(), &fileStat); 253 | if (ret == 0) 254 | { 255 | return fileStat.st_size; 256 | } 257 | 258 | return ret; 259 | } 260 | 261 | size_t nousecb(char *buffer, size_t x, size_t y, void *userdata) 262 | { 263 | (void)buffer; 264 | (void)userdata; 265 | return x * y; 266 | } 267 | 268 | // Get the file size on the server 269 | double HttpClient::getDownloadFileLength(string url) 270 | { 271 | CURL *easy_handle = NULL; 272 | int ret = CURLE_OK; 273 | double size = -1; 274 | 275 | do 276 | { 277 | easy_handle = curl_easy_init(); 278 | if (!easy_handle) 279 | { 280 | ZLOG("curl_easy_init error"); 281 | break; 282 | } 283 | 284 | // Only get the header data 285 | ret = curl_easy_setopt(easy_handle, CURLOPT_URL, url.c_str()); 286 | ret |= curl_easy_setopt(easy_handle, CURLOPT_HEADER, 1L); 287 | ret |= curl_easy_setopt(easy_handle, CURLOPT_NOBODY, 1L); 288 | ret |= curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, nousecb); // libcurl_a.lib will return error code 23 without this sentence on windows 289 | 290 | if (ret != CURLE_OK) 291 | { 292 | ZLOG("curl_easy_setopt error"); 293 | break; 294 | } 295 | 296 | ret = curl_easy_perform(easy_handle); 297 | if (ret != CURLE_OK) 298 | { 299 | char s[100] = {0}; 300 | #ifdef _WIN32 301 | sprintf_s(s, sizeof(s), "error:%d:%s", ret, curl_easy_strerror(static_cast(ret))); 302 | #else 303 | sprintf(s, "error:%d:%s", ret, curl_easy_strerror(static_cast(ret))); 304 | #endif 305 | ZLOG(s); 306 | break; 307 | } 308 | 309 | // size = -1 if no Content-Length return or Content-Length=0 310 | ret = curl_easy_getinfo(easy_handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size); 311 | if (ret != CURLE_OK) 312 | { 313 | ZLOG("curl_easy_getinfo error"); 314 | break; 315 | } 316 | 317 | } while (0); 318 | 319 | curl_easy_cleanup(easy_handle); 320 | return size; 321 | } 322 | -------------------------------------------------------------------------------- /HttpClient/HttpClient.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {E5BD3BC0-4D4B-4246-B22D-F415496C9399} 23 | Win32Proj 24 | HttpClient 25 | 8.1 26 | 27 | 28 | 29 | Application 30 | true 31 | v140 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v140 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | v140 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v140 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | Level3 89 | Disabled 90 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 91 | true 92 | MultiThreadedDLL 93 | 94 | 95 | Console 96 | true 97 | 98 | 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | 117 | 118 | MaxSpeed 119 | true 120 | true 121 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | true 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | 130 | 131 | 132 | 133 | Level3 134 | 135 | 136 | MaxSpeed 137 | true 138 | true 139 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 140 | true 141 | 142 | 143 | Console 144 | true 145 | true 146 | true 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /HttpClient/HttpClient.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | 26 | 27 | 资源文件 28 | 29 | 30 | -------------------------------------------------------------------------------- /HttpClient/include/HttpClient.h: -------------------------------------------------------------------------------- 1 | #ifndef __HTTPCLIENT_H__ 2 | #define __HTTPCLIENT_H__ 3 | 4 | #include 5 | #include "include/curl/curl.h" 6 | 7 | #define Z_DEBUG 8 | 9 | using namespace std; 10 | 11 | #define ZLOG(str) HttpClient::getInstance()->zlog(__DATE__, __TIME__, __FILE__, __LINE__, __FUNCTION__, str); 12 | 13 | #ifdef _WIN32 14 | typedef _off_t p_off_t; 15 | #else 16 | typedef off_t p_off_t; 17 | #endif 18 | 19 | typedef void(*progress_info_callback)(void *userdata, double downloadSpeed, double remainingTime, double progressPercentage); 20 | 21 | typedef struct 22 | { 23 | void *sender; 24 | CURL *handle; 25 | progress_info_callback cb; 26 | }Progress_User_Data; 27 | 28 | typedef enum 29 | { 30 | HTTP_REQUEST_OK = CURLE_OK, 31 | 32 | HTTP_REQUEST_ERROR = -999, 33 | 34 | }Http_Client_Response; 35 | 36 | class HttpClient 37 | { 38 | public: 39 | 40 | ~HttpClient(); 41 | 42 | static HttpClient *getInstance(); 43 | static void destroyInstance(); 44 | 45 | int HttpGet(const string requestURL, const string saveTo, void *sender, progress_info_callback cb); 46 | void zlog(const char *date, const char *time, const char *file, const int line, const char *func, const char* str); 47 | 48 | private: 49 | HttpClient(); 50 | 51 | bool init(); 52 | 53 | static size_t write_callback(char *buffer, size_t size, size_t nmemb, void *userdata); 54 | static int progress_callback(void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); 55 | 56 | // Get the local file size 57 | p_off_t getLocalFileLength(string path); 58 | 59 | // Get the file size on the server 60 | double getDownloadFileLength(string url); 61 | 62 | private: 63 | static HttpClient *instance; 64 | 65 | static double downloadFileLength; 66 | static curl_off_t resumeByte; 67 | 68 | // Call frequency of the callback function 69 | static time_t lastTime; 70 | 71 | static bool stopCurl; 72 | }; 73 | 74 | #endif // __HTTPCLIENT_H__ 75 | -------------------------------------------------------------------------------- /HttpClient/include/curl/curl.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURL_H 2 | #define __CURL_CURL_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* 26 | * If you have libcurl problems, all docs and details are found here: 27 | * http://curl.haxx.se/libcurl/ 28 | * 29 | * curl-library mailing list subscription and unsubscription web interface: 30 | * http://cool.haxx.se/mailman/listinfo/curl-library/ 31 | */ 32 | 33 | #include "curlver.h" /* libcurl version defines */ 34 | #include "curlbuild.h" /* libcurl build definitions */ 35 | #include "curlrules.h" /* libcurl rules enforcement */ 36 | 37 | /* 38 | * Define WIN32 when build target is Win32 API 39 | */ 40 | 41 | #if (defined(_WIN32) || defined(__WIN32__)) && \ 42 | !defined(WIN32) && !defined(__SYMBIAN32__) 43 | #define WIN32 44 | #endif 45 | 46 | #include 47 | #include 48 | 49 | #if defined(__FreeBSD__) && (__FreeBSD__ >= 2) 50 | /* Needed for __FreeBSD_version symbol definition */ 51 | #include 52 | #endif 53 | 54 | /* The include stuff here below is mainly for time_t! */ 55 | #include 56 | #include 57 | 58 | #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) 59 | #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) 60 | /* The check above prevents the winsock2 inclusion if winsock.h already was 61 | included, since they can't co-exist without problems */ 62 | #include 63 | #include 64 | #endif 65 | #endif 66 | 67 | /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish 68 | libc5-based Linux systems. Only include it on systems that are known to 69 | require it! */ 70 | #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ 71 | defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ 72 | defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ 73 | (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) 74 | #include 75 | #endif 76 | 77 | #if !defined(WIN32) && !defined(_WIN32_WCE) 78 | #include 79 | #endif 80 | 81 | #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) 82 | #include 83 | #endif 84 | 85 | #ifdef __BEOS__ 86 | #include 87 | #endif 88 | 89 | #ifdef __cplusplus 90 | extern "C" { 91 | #endif 92 | 93 | typedef void CURL; 94 | 95 | /* 96 | * libcurl external API function linkage decorations. 97 | */ 98 | 99 | #define CURL_STATICLIB 100 | 101 | #ifdef CURL_STATICLIB 102 | # define CURL_EXTERN 103 | #elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) 104 | # if defined(BUILDING_LIBCURL) 105 | # define CURL_EXTERN __declspec(dllexport) 106 | # else 107 | # define CURL_EXTERN __declspec(dllimport) 108 | # endif 109 | #elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS) 110 | # define CURL_EXTERN CURL_EXTERN_SYMBOL 111 | #else 112 | # define CURL_EXTERN 113 | #endif 114 | 115 | #ifndef curl_socket_typedef 116 | /* socket typedef */ 117 | #if defined(WIN32) && !defined(__LWIP_OPT_H__) 118 | typedef SOCKET curl_socket_t; 119 | #define CURL_SOCKET_BAD INVALID_SOCKET 120 | #else 121 | typedef int curl_socket_t; 122 | #define CURL_SOCKET_BAD -1 123 | #endif 124 | #define curl_socket_typedef 125 | #endif /* curl_socket_typedef */ 126 | 127 | struct curl_httppost { 128 | struct curl_httppost *next; /* next entry in the list */ 129 | char *name; /* pointer to allocated name */ 130 | long namelength; /* length of name length */ 131 | char *contents; /* pointer to allocated data contents */ 132 | long contentslength; /* length of contents field */ 133 | char *buffer; /* pointer to allocated buffer contents */ 134 | long bufferlength; /* length of buffer field */ 135 | char *contenttype; /* Content-Type */ 136 | struct curl_slist* contentheader; /* list of extra headers for this form */ 137 | struct curl_httppost *more; /* if one field name has more than one 138 | file, this link should link to following 139 | files */ 140 | long flags; /* as defined below */ 141 | #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ 142 | #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ 143 | #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer 144 | do not free in formfree */ 145 | #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer 146 | do not free in formfree */ 147 | #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ 148 | #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ 149 | #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the 150 | regular read callback to get the data 151 | and pass the given pointer as custom 152 | pointer */ 153 | 154 | char *showfilename; /* The file name to show. If not set, the 155 | actual file name will be used (if this 156 | is a file part) */ 157 | void *userp; /* custom pointer used for 158 | HTTPPOST_CALLBACK posts */ 159 | }; 160 | 161 | /* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered 162 | deprecated but was the only choice up until 7.31.0 */ 163 | typedef int (*curl_progress_callback)(void *clientp, 164 | double dltotal, 165 | double dlnow, 166 | double ultotal, 167 | double ulnow); 168 | 169 | /* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in 170 | 7.32.0, it avoids floating point and provides more detailed information. */ 171 | typedef int (*curl_xferinfo_callback)(void *clientp, 172 | curl_off_t dltotal, 173 | curl_off_t dlnow, 174 | curl_off_t ultotal, 175 | curl_off_t ulnow); 176 | 177 | #ifndef CURL_MAX_WRITE_SIZE 178 | /* Tests have proven that 20K is a very bad buffer size for uploads on 179 | Windows, while 16K for some odd reason performed a lot better. 180 | We do the ifndef check to allow this value to easier be changed at build 181 | time for those who feel adventurous. The practical minimum is about 182 | 400 bytes since libcurl uses a buffer of this size as a scratch area 183 | (unrelated to network send operations). */ 184 | #define CURL_MAX_WRITE_SIZE 16384 185 | #endif 186 | 187 | #ifndef CURL_MAX_HTTP_HEADER 188 | /* The only reason to have a max limit for this is to avoid the risk of a bad 189 | server feeding libcurl with a never-ending header that will cause reallocs 190 | infinitely */ 191 | #define CURL_MAX_HTTP_HEADER (100*1024) 192 | #endif 193 | 194 | /* This is a magic return code for the write callback that, when returned, 195 | will signal libcurl to pause receiving on the current transfer. */ 196 | #define CURL_WRITEFUNC_PAUSE 0x10000001 197 | 198 | typedef size_t (*curl_write_callback)(char *buffer, 199 | size_t size, 200 | size_t nitems, 201 | void *outstream); 202 | 203 | 204 | 205 | /* enumeration of file types */ 206 | typedef enum { 207 | CURLFILETYPE_FILE = 0, 208 | CURLFILETYPE_DIRECTORY, 209 | CURLFILETYPE_SYMLINK, 210 | CURLFILETYPE_DEVICE_BLOCK, 211 | CURLFILETYPE_DEVICE_CHAR, 212 | CURLFILETYPE_NAMEDPIPE, 213 | CURLFILETYPE_SOCKET, 214 | CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ 215 | 216 | CURLFILETYPE_UNKNOWN /* should never occur */ 217 | } curlfiletype; 218 | 219 | #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) 220 | #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) 221 | #define CURLFINFOFLAG_KNOWN_TIME (1<<2) 222 | #define CURLFINFOFLAG_KNOWN_PERM (1<<3) 223 | #define CURLFINFOFLAG_KNOWN_UID (1<<4) 224 | #define CURLFINFOFLAG_KNOWN_GID (1<<5) 225 | #define CURLFINFOFLAG_KNOWN_SIZE (1<<6) 226 | #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) 227 | 228 | /* Content of this structure depends on information which is known and is 229 | achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man 230 | page for callbacks returning this structure -- some fields are mandatory, 231 | some others are optional. The FLAG field has special meaning. */ 232 | struct curl_fileinfo { 233 | char *filename; 234 | curlfiletype filetype; 235 | time_t time; 236 | unsigned int perm; 237 | int uid; 238 | int gid; 239 | curl_off_t size; 240 | long int hardlinks; 241 | 242 | struct { 243 | /* If some of these fields is not NULL, it is a pointer to b_data. */ 244 | char *time; 245 | char *perm; 246 | char *user; 247 | char *group; 248 | char *target; /* pointer to the target filename of a symlink */ 249 | } strings; 250 | 251 | unsigned int flags; 252 | 253 | /* used internally */ 254 | char * b_data; 255 | size_t b_size; 256 | size_t b_used; 257 | }; 258 | 259 | /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ 260 | #define CURL_CHUNK_BGN_FUNC_OK 0 261 | #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ 262 | #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ 263 | 264 | /* if splitting of data transfer is enabled, this callback is called before 265 | download of an individual chunk started. Note that parameter "remains" works 266 | only for FTP wildcard downloading (for now), otherwise is not used */ 267 | typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, 268 | void *ptr, 269 | int remains); 270 | 271 | /* return codes for CURLOPT_CHUNK_END_FUNCTION */ 272 | #define CURL_CHUNK_END_FUNC_OK 0 273 | #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ 274 | 275 | /* If splitting of data transfer is enabled this callback is called after 276 | download of an individual chunk finished. 277 | Note! After this callback was set then it have to be called FOR ALL chunks. 278 | Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. 279 | This is the reason why we don't need "transfer_info" parameter in this 280 | callback and we are not interested in "remains" parameter too. */ 281 | typedef long (*curl_chunk_end_callback)(void *ptr); 282 | 283 | /* return codes for FNMATCHFUNCTION */ 284 | #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ 285 | #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ 286 | #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ 287 | 288 | /* callback type for wildcard downloading pattern matching. If the 289 | string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ 290 | typedef int (*curl_fnmatch_callback)(void *ptr, 291 | const char *pattern, 292 | const char *string); 293 | 294 | /* These are the return codes for the seek callbacks */ 295 | #define CURL_SEEKFUNC_OK 0 296 | #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ 297 | #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so 298 | libcurl might try other means instead */ 299 | typedef int (*curl_seek_callback)(void *instream, 300 | curl_off_t offset, 301 | int origin); /* 'whence' */ 302 | 303 | /* This is a return code for the read callback that, when returned, will 304 | signal libcurl to immediately abort the current transfer. */ 305 | #define CURL_READFUNC_ABORT 0x10000000 306 | /* This is a return code for the read callback that, when returned, will 307 | signal libcurl to pause sending data on the current transfer. */ 308 | #define CURL_READFUNC_PAUSE 0x10000001 309 | 310 | typedef size_t (*curl_read_callback)(char *buffer, 311 | size_t size, 312 | size_t nitems, 313 | void *instream); 314 | 315 | typedef enum { 316 | CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ 317 | CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ 318 | CURLSOCKTYPE_LAST /* never use */ 319 | } curlsocktype; 320 | 321 | /* The return code from the sockopt_callback can signal information back 322 | to libcurl: */ 323 | #define CURL_SOCKOPT_OK 0 324 | #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return 325 | CURLE_ABORTED_BY_CALLBACK */ 326 | #define CURL_SOCKOPT_ALREADY_CONNECTED 2 327 | 328 | typedef int (*curl_sockopt_callback)(void *clientp, 329 | curl_socket_t curlfd, 330 | curlsocktype purpose); 331 | 332 | struct curl_sockaddr { 333 | int family; 334 | int socktype; 335 | int protocol; 336 | unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it 337 | turned really ugly and painful on the systems that 338 | lack this type */ 339 | struct sockaddr addr; 340 | }; 341 | 342 | typedef curl_socket_t 343 | (*curl_opensocket_callback)(void *clientp, 344 | curlsocktype purpose, 345 | struct curl_sockaddr *address); 346 | 347 | typedef int 348 | (*curl_closesocket_callback)(void *clientp, curl_socket_t item); 349 | 350 | typedef enum { 351 | CURLIOE_OK, /* I/O operation successful */ 352 | CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ 353 | CURLIOE_FAILRESTART, /* failed to restart the read */ 354 | CURLIOE_LAST /* never use */ 355 | } curlioerr; 356 | 357 | typedef enum { 358 | CURLIOCMD_NOP, /* no operation */ 359 | CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ 360 | CURLIOCMD_LAST /* never use */ 361 | } curliocmd; 362 | 363 | typedef curlioerr (*curl_ioctl_callback)(CURL *handle, 364 | int cmd, 365 | void *clientp); 366 | 367 | /* 368 | * The following typedef's are signatures of malloc, free, realloc, strdup and 369 | * calloc respectively. Function pointers of these types can be passed to the 370 | * curl_global_init_mem() function to set user defined memory management 371 | * callback routines. 372 | */ 373 | typedef void *(*curl_malloc_callback)(size_t size); 374 | typedef void (*curl_free_callback)(void *ptr); 375 | typedef void *(*curl_realloc_callback)(void *ptr, size_t size); 376 | typedef char *(*curl_strdup_callback)(const char *str); 377 | typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); 378 | 379 | /* the kind of data that is passed to information_callback*/ 380 | typedef enum { 381 | CURLINFO_TEXT = 0, 382 | CURLINFO_HEADER_IN, /* 1 */ 383 | CURLINFO_HEADER_OUT, /* 2 */ 384 | CURLINFO_DATA_IN, /* 3 */ 385 | CURLINFO_DATA_OUT, /* 4 */ 386 | CURLINFO_SSL_DATA_IN, /* 5 */ 387 | CURLINFO_SSL_DATA_OUT, /* 6 */ 388 | CURLINFO_END 389 | } curl_infotype; 390 | 391 | typedef int (*curl_debug_callback) 392 | (CURL *handle, /* the handle/transfer this concerns */ 393 | curl_infotype type, /* what kind of data */ 394 | char *data, /* points to the data */ 395 | size_t size, /* size of the data pointed to */ 396 | void *userptr); /* whatever the user please */ 397 | 398 | /* All possible error codes from all sorts of curl functions. Future versions 399 | may return other values, stay prepared. 400 | 401 | Always add new return codes last. Never *EVER* remove any. The return 402 | codes must remain the same! 403 | */ 404 | 405 | typedef enum { 406 | CURLE_OK = 0, 407 | CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ 408 | CURLE_FAILED_INIT, /* 2 */ 409 | CURLE_URL_MALFORMAT, /* 3 */ 410 | CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for 411 | 7.17.0, reused in April 2011 for 7.21.5] */ 412 | CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ 413 | CURLE_COULDNT_RESOLVE_HOST, /* 6 */ 414 | CURLE_COULDNT_CONNECT, /* 7 */ 415 | CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ 416 | CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server 417 | due to lack of access - when login fails 418 | this is not returned. */ 419 | CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for 420 | 7.15.4, reused in Dec 2011 for 7.24.0]*/ 421 | CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ 422 | CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server 423 | [was obsoleted in August 2007 for 7.17.0, 424 | reused in Dec 2011 for 7.24.0]*/ 425 | CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ 426 | CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ 427 | CURLE_FTP_CANT_GET_HOST, /* 15 */ 428 | CURLE_HTTP2, /* 16 - A problem in the http2 framing layer. 429 | [was obsoleted in August 2007 for 7.17.0, 430 | reused in July 2014 for 7.38.0] */ 431 | CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ 432 | CURLE_PARTIAL_FILE, /* 18 */ 433 | CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ 434 | CURLE_OBSOLETE20, /* 20 - NOT USED */ 435 | CURLE_QUOTE_ERROR, /* 21 - quote command failure */ 436 | CURLE_HTTP_RETURNED_ERROR, /* 22 */ 437 | CURLE_WRITE_ERROR, /* 23 */ 438 | CURLE_OBSOLETE24, /* 24 - NOT USED */ 439 | CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ 440 | CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ 441 | CURLE_OUT_OF_MEMORY, /* 27 */ 442 | /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error 443 | instead of a memory allocation error if CURL_DOES_CONVERSIONS 444 | is defined 445 | */ 446 | CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ 447 | CURLE_OBSOLETE29, /* 29 - NOT USED */ 448 | CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ 449 | CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ 450 | CURLE_OBSOLETE32, /* 32 - NOT USED */ 451 | CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ 452 | CURLE_HTTP_POST_ERROR, /* 34 */ 453 | CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ 454 | CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ 455 | CURLE_FILE_COULDNT_READ_FILE, /* 37 */ 456 | CURLE_LDAP_CANNOT_BIND, /* 38 */ 457 | CURLE_LDAP_SEARCH_FAILED, /* 39 */ 458 | CURLE_OBSOLETE40, /* 40 - NOT USED */ 459 | CURLE_FUNCTION_NOT_FOUND, /* 41 */ 460 | CURLE_ABORTED_BY_CALLBACK, /* 42 */ 461 | CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ 462 | CURLE_OBSOLETE44, /* 44 - NOT USED */ 463 | CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ 464 | CURLE_OBSOLETE46, /* 46 - NOT USED */ 465 | CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ 466 | CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ 467 | CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ 468 | CURLE_OBSOLETE50, /* 50 - NOT USED */ 469 | CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint 470 | wasn't verified fine */ 471 | CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ 472 | CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ 473 | CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as 474 | default */ 475 | CURLE_SEND_ERROR, /* 55 - failed sending network data */ 476 | CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ 477 | CURLE_OBSOLETE57, /* 57 - NOT IN USE */ 478 | CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ 479 | CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ 480 | CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ 481 | CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ 482 | CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ 483 | CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ 484 | CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ 485 | CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind 486 | that failed */ 487 | CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ 488 | CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not 489 | accepted and we failed to login */ 490 | CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ 491 | CURLE_TFTP_PERM, /* 69 - permission problem on server */ 492 | CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ 493 | CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ 494 | CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ 495 | CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ 496 | CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ 497 | CURLE_CONV_FAILED, /* 75 - conversion failed */ 498 | CURLE_CONV_REQD, /* 76 - caller must register conversion 499 | callbacks using curl_easy_setopt options 500 | CURLOPT_CONV_FROM_NETWORK_FUNCTION, 501 | CURLOPT_CONV_TO_NETWORK_FUNCTION, and 502 | CURLOPT_CONV_FROM_UTF8_FUNCTION */ 503 | CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing 504 | or wrong format */ 505 | CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ 506 | CURLE_SSH, /* 79 - error from the SSH layer, somewhat 507 | generic so the error message will be of 508 | interest when this has happened */ 509 | 510 | CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL 511 | connection */ 512 | CURLE_AGAIN, /* 81 - socket is not ready for send/recv, 513 | wait till it's ready and try again (Added 514 | in 7.18.2) */ 515 | CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or 516 | wrong format (Added in 7.19.0) */ 517 | CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in 518 | 7.19.0) */ 519 | CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ 520 | CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ 521 | CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ 522 | CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ 523 | CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ 524 | CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the 525 | session will be queued */ 526 | CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not 527 | match */ 528 | CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */ 529 | CURL_LAST /* never use! */ 530 | } CURLcode; 531 | 532 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 533 | the obsolete stuff removed! */ 534 | 535 | /* Previously obsolete error code re-used in 7.38.0 */ 536 | #define CURLE_OBSOLETE16 CURLE_HTTP2 537 | 538 | /* Previously obsolete error codes re-used in 7.24.0 */ 539 | #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED 540 | #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT 541 | 542 | /* compatibility with older names */ 543 | #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING 544 | 545 | /* The following were added in 7.21.5, April 2011 */ 546 | #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION 547 | 548 | /* The following were added in 7.17.1 */ 549 | /* These are scheduled to disappear by 2009 */ 550 | #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION 551 | 552 | /* The following were added in 7.17.0 */ 553 | /* These are scheduled to disappear by 2009 */ 554 | #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ 555 | #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 556 | #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 557 | #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 558 | #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 559 | #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 560 | #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 561 | #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 562 | #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 563 | #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 564 | #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 565 | #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 566 | #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN 567 | 568 | #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED 569 | #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE 570 | #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR 571 | #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL 572 | #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS 573 | #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR 574 | #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED 575 | 576 | /* The following were added earlier */ 577 | 578 | #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT 579 | 580 | #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR 581 | #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED 582 | #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED 583 | 584 | #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE 585 | #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME 586 | 587 | /* This was the error code 50 in 7.7.3 and a few earlier versions, this 588 | is no longer used by libcurl but is instead #defined here only to not 589 | make programs break */ 590 | #define CURLE_ALREADY_COMPLETE 99999 591 | 592 | /* Provide defines for really old option names */ 593 | #define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */ 594 | #define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */ 595 | #define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA 596 | 597 | /* Since long deprecated options with no code in the lib that does anything 598 | with them. */ 599 | #define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40 600 | #define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72 601 | 602 | #endif /*!CURL_NO_OLDIES*/ 603 | 604 | /* This prototype applies to all conversion callbacks */ 605 | typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); 606 | 607 | typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ 608 | void *ssl_ctx, /* actually an 609 | OpenSSL SSL_CTX */ 610 | void *userptr); 611 | 612 | typedef enum { 613 | CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use 614 | CONNECT HTTP/1.1 */ 615 | CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT 616 | HTTP/1.0 */ 617 | CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already 618 | in 7.10 */ 619 | CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ 620 | CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ 621 | CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the 622 | host name rather than the IP address. added 623 | in 7.18.0 */ 624 | } curl_proxytype; /* this enum was added in 7.10 */ 625 | 626 | /* 627 | * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: 628 | * 629 | * CURLAUTH_NONE - No HTTP authentication 630 | * CURLAUTH_BASIC - HTTP Basic authentication (default) 631 | * CURLAUTH_DIGEST - HTTP Digest authentication 632 | * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication 633 | * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated) 634 | * CURLAUTH_NTLM - HTTP NTLM authentication 635 | * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour 636 | * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper 637 | * CURLAUTH_ONLY - Use together with a single other type to force no 638 | * authentication or just that single type 639 | * CURLAUTH_ANY - All fine types set 640 | * CURLAUTH_ANYSAFE - All fine types except Basic 641 | */ 642 | 643 | #define CURLAUTH_NONE ((unsigned long)0) 644 | #define CURLAUTH_BASIC (((unsigned long)1)<<0) 645 | #define CURLAUTH_DIGEST (((unsigned long)1)<<1) 646 | #define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2) 647 | /* Deprecated since the advent of CURLAUTH_NEGOTIATE */ 648 | #define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE 649 | #define CURLAUTH_NTLM (((unsigned long)1)<<3) 650 | #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) 651 | #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) 652 | #define CURLAUTH_ONLY (((unsigned long)1)<<31) 653 | #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) 654 | #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) 655 | 656 | #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ 657 | #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ 658 | #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ 659 | #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ 660 | #define CURLSSH_AUTH_HOST (1<<2) /* host key files */ 661 | #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ 662 | #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */ 663 | #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY 664 | 665 | #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ 666 | #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ 667 | #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ 668 | 669 | #define CURL_ERROR_SIZE 256 670 | 671 | enum curl_khtype { 672 | CURLKHTYPE_UNKNOWN, 673 | CURLKHTYPE_RSA1, 674 | CURLKHTYPE_RSA, 675 | CURLKHTYPE_DSS 676 | }; 677 | 678 | struct curl_khkey { 679 | const char *key; /* points to a zero-terminated string encoded with base64 680 | if len is zero, otherwise to the "raw" data */ 681 | size_t len; 682 | enum curl_khtype keytype; 683 | }; 684 | 685 | /* this is the set of return values expected from the curl_sshkeycallback 686 | callback */ 687 | enum curl_khstat { 688 | CURLKHSTAT_FINE_ADD_TO_FILE, 689 | CURLKHSTAT_FINE, 690 | CURLKHSTAT_REJECT, /* reject the connection, return an error */ 691 | CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so 692 | this causes a CURLE_DEFER error but otherwise the 693 | connection will be left intact etc */ 694 | CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ 695 | }; 696 | 697 | /* this is the set of status codes pass in to the callback */ 698 | enum curl_khmatch { 699 | CURLKHMATCH_OK, /* match */ 700 | CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ 701 | CURLKHMATCH_MISSING, /* no matching host/key found */ 702 | CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ 703 | }; 704 | 705 | typedef int 706 | (*curl_sshkeycallback) (CURL *easy, /* easy handle */ 707 | const struct curl_khkey *knownkey, /* known */ 708 | const struct curl_khkey *foundkey, /* found */ 709 | enum curl_khmatch, /* libcurl's view on the keys */ 710 | void *clientp); /* custom pointer passed from app */ 711 | 712 | /* parameter for the CURLOPT_USE_SSL option */ 713 | typedef enum { 714 | CURLUSESSL_NONE, /* do not attempt to use SSL */ 715 | CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ 716 | CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ 717 | CURLUSESSL_ALL, /* SSL for all communication or fail */ 718 | CURLUSESSL_LAST /* not an option, never use */ 719 | } curl_usessl; 720 | 721 | /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ 722 | 723 | /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the 724 | name of improving interoperability with older servers. Some SSL libraries 725 | have introduced work-arounds for this flaw but those work-arounds sometimes 726 | make the SSL communication fail. To regain functionality with those broken 727 | servers, a user can this way allow the vulnerability back. */ 728 | #define CURLSSLOPT_ALLOW_BEAST (1<<0) 729 | 730 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 731 | the obsolete stuff removed! */ 732 | 733 | /* Backwards compatibility with older names */ 734 | /* These are scheduled to disappear by 2009 */ 735 | 736 | #define CURLFTPSSL_NONE CURLUSESSL_NONE 737 | #define CURLFTPSSL_TRY CURLUSESSL_TRY 738 | #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL 739 | #define CURLFTPSSL_ALL CURLUSESSL_ALL 740 | #define CURLFTPSSL_LAST CURLUSESSL_LAST 741 | #define curl_ftpssl curl_usessl 742 | #endif /*!CURL_NO_OLDIES*/ 743 | 744 | /* parameter for the CURLOPT_FTP_SSL_CCC option */ 745 | typedef enum { 746 | CURLFTPSSL_CCC_NONE, /* do not send CCC */ 747 | CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ 748 | CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ 749 | CURLFTPSSL_CCC_LAST /* not an option, never use */ 750 | } curl_ftpccc; 751 | 752 | /* parameter for the CURLOPT_FTPSSLAUTH option */ 753 | typedef enum { 754 | CURLFTPAUTH_DEFAULT, /* let libcurl decide */ 755 | CURLFTPAUTH_SSL, /* use "AUTH SSL" */ 756 | CURLFTPAUTH_TLS, /* use "AUTH TLS" */ 757 | CURLFTPAUTH_LAST /* not an option, never use */ 758 | } curl_ftpauth; 759 | 760 | /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ 761 | typedef enum { 762 | CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ 763 | CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD 764 | again if MKD succeeded, for SFTP this does 765 | similar magic */ 766 | CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD 767 | again even if MKD failed! */ 768 | CURLFTP_CREATE_DIR_LAST /* not an option, never use */ 769 | } curl_ftpcreatedir; 770 | 771 | /* parameter for the CURLOPT_FTP_FILEMETHOD option */ 772 | typedef enum { 773 | CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ 774 | CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ 775 | CURLFTPMETHOD_NOCWD, /* no CWD at all */ 776 | CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ 777 | CURLFTPMETHOD_LAST /* not an option, never use */ 778 | } curl_ftpmethod; 779 | 780 | /* bitmask defines for CURLOPT_HEADEROPT */ 781 | #define CURLHEADER_UNIFIED 0 782 | #define CURLHEADER_SEPARATE (1<<0) 783 | 784 | /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ 785 | #define CURLPROTO_HTTP (1<<0) 786 | #define CURLPROTO_HTTPS (1<<1) 787 | #define CURLPROTO_FTP (1<<2) 788 | #define CURLPROTO_FTPS (1<<3) 789 | #define CURLPROTO_SCP (1<<4) 790 | #define CURLPROTO_SFTP (1<<5) 791 | #define CURLPROTO_TELNET (1<<6) 792 | #define CURLPROTO_LDAP (1<<7) 793 | #define CURLPROTO_LDAPS (1<<8) 794 | #define CURLPROTO_DICT (1<<9) 795 | #define CURLPROTO_FILE (1<<10) 796 | #define CURLPROTO_TFTP (1<<11) 797 | #define CURLPROTO_IMAP (1<<12) 798 | #define CURLPROTO_IMAPS (1<<13) 799 | #define CURLPROTO_POP3 (1<<14) 800 | #define CURLPROTO_POP3S (1<<15) 801 | #define CURLPROTO_SMTP (1<<16) 802 | #define CURLPROTO_SMTPS (1<<17) 803 | #define CURLPROTO_RTSP (1<<18) 804 | #define CURLPROTO_RTMP (1<<19) 805 | #define CURLPROTO_RTMPT (1<<20) 806 | #define CURLPROTO_RTMPE (1<<21) 807 | #define CURLPROTO_RTMPTE (1<<22) 808 | #define CURLPROTO_RTMPS (1<<23) 809 | #define CURLPROTO_RTMPTS (1<<24) 810 | #define CURLPROTO_GOPHER (1<<25) 811 | #define CURLPROTO_SMB (1<<26) 812 | #define CURLPROTO_SMBS (1<<27) 813 | #define CURLPROTO_ALL (~0) /* enable everything */ 814 | 815 | /* long may be 32 or 64 bits, but we should never depend on anything else 816 | but 32 */ 817 | #define CURLOPTTYPE_LONG 0 818 | #define CURLOPTTYPE_OBJECTPOINT 10000 819 | #define CURLOPTTYPE_FUNCTIONPOINT 20000 820 | #define CURLOPTTYPE_OFF_T 30000 821 | 822 | /* name is uppercase CURLOPT_, 823 | type is one of the defined CURLOPTTYPE_ 824 | number is unique identifier */ 825 | #ifdef CINIT 826 | #undef CINIT 827 | #endif 828 | 829 | #ifdef CURL_ISOCPP 830 | #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu 831 | #else 832 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 833 | #define LONG CURLOPTTYPE_LONG 834 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT 835 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT 836 | #define OFF_T CURLOPTTYPE_OFF_T 837 | #define CINIT(name,type,number) CURLOPT_/**/name = type + number 838 | #endif 839 | 840 | /* 841 | * This macro-mania below setups the CURLOPT_[what] enum, to be used with 842 | * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] 843 | * word. 844 | */ 845 | 846 | typedef enum { 847 | /* This is the FILE * or void * the regular output should be written to. */ 848 | CINIT(WRITEDATA, OBJECTPOINT, 1), 849 | 850 | /* The full URL to get/put */ 851 | CINIT(URL, OBJECTPOINT, 2), 852 | 853 | /* Port number to connect to, if other than default. */ 854 | CINIT(PORT, LONG, 3), 855 | 856 | /* Name of proxy to use. */ 857 | CINIT(PROXY, OBJECTPOINT, 4), 858 | 859 | /* "user:password;options" to use when fetching. */ 860 | CINIT(USERPWD, OBJECTPOINT, 5), 861 | 862 | /* "user:password" to use with proxy. */ 863 | CINIT(PROXYUSERPWD, OBJECTPOINT, 6), 864 | 865 | /* Range to get, specified as an ASCII string. */ 866 | CINIT(RANGE, OBJECTPOINT, 7), 867 | 868 | /* not used */ 869 | 870 | /* Specified file stream to upload from (use as input): */ 871 | CINIT(READDATA, OBJECTPOINT, 9), 872 | 873 | /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE 874 | * bytes big. If this is not used, error messages go to stderr instead: */ 875 | CINIT(ERRORBUFFER, OBJECTPOINT, 10), 876 | 877 | /* Function that will be called to store the output (instead of fwrite). The 878 | * parameters will use fwrite() syntax, make sure to follow them. */ 879 | CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), 880 | 881 | /* Function that will be called to read the input (instead of fread). The 882 | * parameters will use fread() syntax, make sure to follow them. */ 883 | CINIT(READFUNCTION, FUNCTIONPOINT, 12), 884 | 885 | /* Time-out the read operation after this amount of seconds */ 886 | CINIT(TIMEOUT, LONG, 13), 887 | 888 | /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about 889 | * how large the file being sent really is. That allows better error 890 | * checking and better verifies that the upload was successful. -1 means 891 | * unknown size. 892 | * 893 | * For large file support, there is also a _LARGE version of the key 894 | * which takes an off_t type, allowing platforms with larger off_t 895 | * sizes to handle larger files. See below for INFILESIZE_LARGE. 896 | */ 897 | CINIT(INFILESIZE, LONG, 14), 898 | 899 | /* POST static input fields. */ 900 | CINIT(POSTFIELDS, OBJECTPOINT, 15), 901 | 902 | /* Set the referrer page (needed by some CGIs) */ 903 | CINIT(REFERER, OBJECTPOINT, 16), 904 | 905 | /* Set the FTP PORT string (interface name, named or numerical IP address) 906 | Use i.e '-' to use default address. */ 907 | CINIT(FTPPORT, OBJECTPOINT, 17), 908 | 909 | /* Set the User-Agent string (examined by some CGIs) */ 910 | CINIT(USERAGENT, OBJECTPOINT, 18), 911 | 912 | /* If the download receives less than "low speed limit" bytes/second 913 | * during "low speed time" seconds, the operations is aborted. 914 | * You could i.e if you have a pretty high speed connection, abort if 915 | * it is less than 2000 bytes/sec during 20 seconds. 916 | */ 917 | 918 | /* Set the "low speed limit" */ 919 | CINIT(LOW_SPEED_LIMIT, LONG, 19), 920 | 921 | /* Set the "low speed time" */ 922 | CINIT(LOW_SPEED_TIME, LONG, 20), 923 | 924 | /* Set the continuation offset. 925 | * 926 | * Note there is also a _LARGE version of this key which uses 927 | * off_t types, allowing for large file offsets on platforms which 928 | * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. 929 | */ 930 | CINIT(RESUME_FROM, LONG, 21), 931 | 932 | /* Set cookie in request: */ 933 | CINIT(COOKIE, OBJECTPOINT, 22), 934 | 935 | /* This points to a linked list of headers, struct curl_slist kind. This 936 | list is also used for RTSP (in spite of its name) */ 937 | CINIT(HTTPHEADER, OBJECTPOINT, 23), 938 | 939 | /* This points to a linked list of post entries, struct curl_httppost */ 940 | CINIT(HTTPPOST, OBJECTPOINT, 24), 941 | 942 | /* name of the file keeping your private SSL-certificate */ 943 | CINIT(SSLCERT, OBJECTPOINT, 25), 944 | 945 | /* password for the SSL or SSH private key */ 946 | CINIT(KEYPASSWD, OBJECTPOINT, 26), 947 | 948 | /* send TYPE parameter? */ 949 | CINIT(CRLF, LONG, 27), 950 | 951 | /* send linked-list of QUOTE commands */ 952 | CINIT(QUOTE, OBJECTPOINT, 28), 953 | 954 | /* send FILE * or void * to store headers to, if you use a callback it 955 | is simply passed to the callback unmodified */ 956 | CINIT(HEADERDATA, OBJECTPOINT, 29), 957 | 958 | /* point to a file to read the initial cookies from, also enables 959 | "cookie awareness" */ 960 | CINIT(COOKIEFILE, OBJECTPOINT, 31), 961 | 962 | /* What version to specifically try to use. 963 | See CURL_SSLVERSION defines below. */ 964 | CINIT(SSLVERSION, LONG, 32), 965 | 966 | /* What kind of HTTP time condition to use, see defines */ 967 | CINIT(TIMECONDITION, LONG, 33), 968 | 969 | /* Time to use with the above condition. Specified in number of seconds 970 | since 1 Jan 1970 */ 971 | CINIT(TIMEVALUE, LONG, 34), 972 | 973 | /* 35 = OBSOLETE */ 974 | 975 | /* Custom request, for customizing the get command like 976 | HTTP: DELETE, TRACE and others 977 | FTP: to use a different list command 978 | */ 979 | CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), 980 | 981 | /* HTTP request, for odd commands like DELETE, TRACE and others */ 982 | CINIT(STDERR, OBJECTPOINT, 37), 983 | 984 | /* 38 is not used */ 985 | 986 | /* send linked-list of post-transfer QUOTE commands */ 987 | CINIT(POSTQUOTE, OBJECTPOINT, 39), 988 | 989 | CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */ 990 | 991 | CINIT(VERBOSE, LONG, 41), /* talk a lot */ 992 | CINIT(HEADER, LONG, 42), /* throw the header out too */ 993 | CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ 994 | CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ 995 | CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */ 996 | CINIT(UPLOAD, LONG, 46), /* this is an upload */ 997 | CINIT(POST, LONG, 47), /* HTTP POST method */ 998 | CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ 999 | 1000 | CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ 1001 | 1002 | /* Specify whether to read the user+password from the .netrc or the URL. 1003 | * This must be one of the CURL_NETRC_* enums below. */ 1004 | CINIT(NETRC, LONG, 51), 1005 | 1006 | CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ 1007 | 1008 | CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ 1009 | CINIT(PUT, LONG, 54), /* HTTP PUT */ 1010 | 1011 | /* 55 = OBSOLETE */ 1012 | 1013 | /* DEPRECATED 1014 | * Function that will be called instead of the internal progress display 1015 | * function. This function should be defined as the curl_progress_callback 1016 | * prototype defines. */ 1017 | CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), 1018 | 1019 | /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION 1020 | callbacks */ 1021 | CINIT(PROGRESSDATA, OBJECTPOINT, 57), 1022 | #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA 1023 | 1024 | /* We want the referrer field set automatically when following locations */ 1025 | CINIT(AUTOREFERER, LONG, 58), 1026 | 1027 | /* Port of the proxy, can be set in the proxy string as well with: 1028 | "[host]:[port]" */ 1029 | CINIT(PROXYPORT, LONG, 59), 1030 | 1031 | /* size of the POST input data, if strlen() is not good to use */ 1032 | CINIT(POSTFIELDSIZE, LONG, 60), 1033 | 1034 | /* tunnel non-http operations through a HTTP proxy */ 1035 | CINIT(HTTPPROXYTUNNEL, LONG, 61), 1036 | 1037 | /* Set the interface string to use as outgoing network interface */ 1038 | CINIT(INTERFACE, OBJECTPOINT, 62), 1039 | 1040 | /* Set the krb4/5 security level, this also enables krb4/5 awareness. This 1041 | * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string 1042 | * is set but doesn't match one of these, 'private' will be used. */ 1043 | CINIT(KRBLEVEL, OBJECTPOINT, 63), 1044 | 1045 | /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ 1046 | CINIT(SSL_VERIFYPEER, LONG, 64), 1047 | 1048 | /* The CApath or CAfile used to validate the peer certificate 1049 | this option is used only if SSL_VERIFYPEER is true */ 1050 | CINIT(CAINFO, OBJECTPOINT, 65), 1051 | 1052 | /* 66 = OBSOLETE */ 1053 | /* 67 = OBSOLETE */ 1054 | 1055 | /* Maximum number of http redirects to follow */ 1056 | CINIT(MAXREDIRS, LONG, 68), 1057 | 1058 | /* Pass a long set to 1 to get the date of the requested document (if 1059 | possible)! Pass a zero to shut it off. */ 1060 | CINIT(FILETIME, LONG, 69), 1061 | 1062 | /* This points to a linked list of telnet options */ 1063 | CINIT(TELNETOPTIONS, OBJECTPOINT, 70), 1064 | 1065 | /* Max amount of cached alive connections */ 1066 | CINIT(MAXCONNECTS, LONG, 71), 1067 | 1068 | CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */ 1069 | 1070 | /* 73 = OBSOLETE */ 1071 | 1072 | /* Set to explicitly use a new connection for the upcoming transfer. 1073 | Do not use this unless you're absolutely sure of this, as it makes the 1074 | operation slower and is less friendly for the network. */ 1075 | CINIT(FRESH_CONNECT, LONG, 74), 1076 | 1077 | /* Set to explicitly forbid the upcoming transfer's connection to be re-used 1078 | when done. Do not use this unless you're absolutely sure of this, as it 1079 | makes the operation slower and is less friendly for the network. */ 1080 | CINIT(FORBID_REUSE, LONG, 75), 1081 | 1082 | /* Set to a file name that contains random data for libcurl to use to 1083 | seed the random engine when doing SSL connects. */ 1084 | CINIT(RANDOM_FILE, OBJECTPOINT, 76), 1085 | 1086 | /* Set to the Entropy Gathering Daemon socket pathname */ 1087 | CINIT(EGDSOCKET, OBJECTPOINT, 77), 1088 | 1089 | /* Time-out connect operations after this amount of seconds, if connects are 1090 | OK within this time, then fine... This only aborts the connect phase. */ 1091 | CINIT(CONNECTTIMEOUT, LONG, 78), 1092 | 1093 | /* Function that will be called to store headers (instead of fwrite). The 1094 | * parameters will use fwrite() syntax, make sure to follow them. */ 1095 | CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), 1096 | 1097 | /* Set this to force the HTTP request to get back to GET. Only really usable 1098 | if POST, PUT or a custom request have been used first. 1099 | */ 1100 | CINIT(HTTPGET, LONG, 80), 1101 | 1102 | /* Set if we should verify the Common name from the peer certificate in ssl 1103 | * handshake, set 1 to check existence, 2 to ensure that it matches the 1104 | * provided hostname. */ 1105 | CINIT(SSL_VERIFYHOST, LONG, 81), 1106 | 1107 | /* Specify which file name to write all known cookies in after completed 1108 | operation. Set file name to "-" (dash) to make it go to stdout. */ 1109 | CINIT(COOKIEJAR, OBJECTPOINT, 82), 1110 | 1111 | /* Specify which SSL ciphers to use */ 1112 | CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), 1113 | 1114 | /* Specify which HTTP version to use! This must be set to one of the 1115 | CURL_HTTP_VERSION* enums set below. */ 1116 | CINIT(HTTP_VERSION, LONG, 84), 1117 | 1118 | /* Specifically switch on or off the FTP engine's use of the EPSV command. By 1119 | default, that one will always be attempted before the more traditional 1120 | PASV command. */ 1121 | CINIT(FTP_USE_EPSV, LONG, 85), 1122 | 1123 | /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ 1124 | CINIT(SSLCERTTYPE, OBJECTPOINT, 86), 1125 | 1126 | /* name of the file keeping your private SSL-key */ 1127 | CINIT(SSLKEY, OBJECTPOINT, 87), 1128 | 1129 | /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ 1130 | CINIT(SSLKEYTYPE, OBJECTPOINT, 88), 1131 | 1132 | /* crypto engine for the SSL-sub system */ 1133 | CINIT(SSLENGINE, OBJECTPOINT, 89), 1134 | 1135 | /* set the crypto engine for the SSL-sub system as default 1136 | the param has no meaning... 1137 | */ 1138 | CINIT(SSLENGINE_DEFAULT, LONG, 90), 1139 | 1140 | /* Non-zero value means to use the global dns cache */ 1141 | CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ 1142 | 1143 | /* DNS cache timeout */ 1144 | CINIT(DNS_CACHE_TIMEOUT, LONG, 92), 1145 | 1146 | /* send linked-list of pre-transfer QUOTE commands */ 1147 | CINIT(PREQUOTE, OBJECTPOINT, 93), 1148 | 1149 | /* set the debug function */ 1150 | CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), 1151 | 1152 | /* set the data for the debug function */ 1153 | CINIT(DEBUGDATA, OBJECTPOINT, 95), 1154 | 1155 | /* mark this as start of a cookie session */ 1156 | CINIT(COOKIESESSION, LONG, 96), 1157 | 1158 | /* The CApath directory used to validate the peer certificate 1159 | this option is used only if SSL_VERIFYPEER is true */ 1160 | CINIT(CAPATH, OBJECTPOINT, 97), 1161 | 1162 | /* Instruct libcurl to use a smaller receive buffer */ 1163 | CINIT(BUFFERSIZE, LONG, 98), 1164 | 1165 | /* Instruct libcurl to not use any signal/alarm handlers, even when using 1166 | timeouts. This option is useful for multi-threaded applications. 1167 | See libcurl-the-guide for more background information. */ 1168 | CINIT(NOSIGNAL, LONG, 99), 1169 | 1170 | /* Provide a CURLShare for mutexing non-ts data */ 1171 | CINIT(SHARE, OBJECTPOINT, 100), 1172 | 1173 | /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), 1174 | CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ 1175 | CINIT(PROXYTYPE, LONG, 101), 1176 | 1177 | /* Set the Accept-Encoding string. Use this to tell a server you would like 1178 | the response to be compressed. Before 7.21.6, this was known as 1179 | CURLOPT_ENCODING */ 1180 | CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), 1181 | 1182 | /* Set pointer to private data */ 1183 | CINIT(PRIVATE, OBJECTPOINT, 103), 1184 | 1185 | /* Set aliases for HTTP 200 in the HTTP Response header */ 1186 | CINIT(HTTP200ALIASES, OBJECTPOINT, 104), 1187 | 1188 | /* Continue to send authentication (user+password) when following locations, 1189 | even when hostname changed. This can potentially send off the name 1190 | and password to whatever host the server decides. */ 1191 | CINIT(UNRESTRICTED_AUTH, LONG, 105), 1192 | 1193 | /* Specifically switch on or off the FTP engine's use of the EPRT command ( 1194 | it also disables the LPRT attempt). By default, those ones will always be 1195 | attempted before the good old traditional PORT command. */ 1196 | CINIT(FTP_USE_EPRT, LONG, 106), 1197 | 1198 | /* Set this to a bitmask value to enable the particular authentications 1199 | methods you like. Use this in combination with CURLOPT_USERPWD. 1200 | Note that setting multiple bits may cause extra network round-trips. */ 1201 | CINIT(HTTPAUTH, LONG, 107), 1202 | 1203 | /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx 1204 | in second argument. The function must be matching the 1205 | curl_ssl_ctx_callback proto. */ 1206 | CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), 1207 | 1208 | /* Set the userdata for the ssl context callback function's third 1209 | argument */ 1210 | CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), 1211 | 1212 | /* FTP Option that causes missing dirs to be created on the remote server. 1213 | In 7.19.4 we introduced the convenience enums for this option using the 1214 | CURLFTP_CREATE_DIR prefix. 1215 | */ 1216 | CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), 1217 | 1218 | /* Set this to a bitmask value to enable the particular authentications 1219 | methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. 1220 | Note that setting multiple bits may cause extra network round-trips. */ 1221 | CINIT(PROXYAUTH, LONG, 111), 1222 | 1223 | /* FTP option that changes the timeout, in seconds, associated with 1224 | getting a response. This is different from transfer timeout time and 1225 | essentially places a demand on the FTP server to acknowledge commands 1226 | in a timely manner. */ 1227 | CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), 1228 | #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT 1229 | 1230 | /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to 1231 | tell libcurl to resolve names to those IP versions only. This only has 1232 | affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ 1233 | CINIT(IPRESOLVE, LONG, 113), 1234 | 1235 | /* Set this option to limit the size of a file that will be downloaded from 1236 | an HTTP or FTP server. 1237 | 1238 | Note there is also _LARGE version which adds large file support for 1239 | platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ 1240 | CINIT(MAXFILESIZE, LONG, 114), 1241 | 1242 | /* See the comment for INFILESIZE above, but in short, specifies 1243 | * the size of the file being uploaded. -1 means unknown. 1244 | */ 1245 | CINIT(INFILESIZE_LARGE, OFF_T, 115), 1246 | 1247 | /* Sets the continuation offset. There is also a LONG version of this; 1248 | * look above for RESUME_FROM. 1249 | */ 1250 | CINIT(RESUME_FROM_LARGE, OFF_T, 116), 1251 | 1252 | /* Sets the maximum size of data that will be downloaded from 1253 | * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. 1254 | */ 1255 | CINIT(MAXFILESIZE_LARGE, OFF_T, 117), 1256 | 1257 | /* Set this option to the file name of your .netrc file you want libcurl 1258 | to parse (using the CURLOPT_NETRC option). If not set, libcurl will do 1259 | a poor attempt to find the user's home directory and check for a .netrc 1260 | file in there. */ 1261 | CINIT(NETRC_FILE, OBJECTPOINT, 118), 1262 | 1263 | /* Enable SSL/TLS for FTP, pick one of: 1264 | CURLUSESSL_TRY - try using SSL, proceed anyway otherwise 1265 | CURLUSESSL_CONTROL - SSL for the control connection or fail 1266 | CURLUSESSL_ALL - SSL for all communication or fail 1267 | */ 1268 | CINIT(USE_SSL, LONG, 119), 1269 | 1270 | /* The _LARGE version of the standard POSTFIELDSIZE option */ 1271 | CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), 1272 | 1273 | /* Enable/disable the TCP Nagle algorithm */ 1274 | CINIT(TCP_NODELAY, LONG, 121), 1275 | 1276 | /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1277 | /* 123 OBSOLETE. Gone in 7.16.0 */ 1278 | /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1279 | /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1280 | /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1281 | /* 127 OBSOLETE. Gone in 7.16.0 */ 1282 | /* 128 OBSOLETE. Gone in 7.16.0 */ 1283 | 1284 | /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option 1285 | can be used to change libcurl's default action which is to first try 1286 | "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK 1287 | response has been received. 1288 | 1289 | Available parameters are: 1290 | CURLFTPAUTH_DEFAULT - let libcurl decide 1291 | CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS 1292 | CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL 1293 | */ 1294 | CINIT(FTPSSLAUTH, LONG, 129), 1295 | 1296 | CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), 1297 | CINIT(IOCTLDATA, OBJECTPOINT, 131), 1298 | 1299 | /* 132 OBSOLETE. Gone in 7.16.0 */ 1300 | /* 133 OBSOLETE. Gone in 7.16.0 */ 1301 | 1302 | /* zero terminated string for pass on to the FTP server when asked for 1303 | "account" info */ 1304 | CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), 1305 | 1306 | /* feed cookies into cookie engine */ 1307 | CINIT(COOKIELIST, OBJECTPOINT, 135), 1308 | 1309 | /* ignore Content-Length */ 1310 | CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), 1311 | 1312 | /* Set to non-zero to skip the IP address received in a 227 PASV FTP server 1313 | response. Typically used for FTP-SSL purposes but is not restricted to 1314 | that. libcurl will then instead use the same IP address it used for the 1315 | control connection. */ 1316 | CINIT(FTP_SKIP_PASV_IP, LONG, 137), 1317 | 1318 | /* Select "file method" to use when doing FTP, see the curl_ftpmethod 1319 | above. */ 1320 | CINIT(FTP_FILEMETHOD, LONG, 138), 1321 | 1322 | /* Local port number to bind the socket to */ 1323 | CINIT(LOCALPORT, LONG, 139), 1324 | 1325 | /* Number of ports to try, including the first one set with LOCALPORT. 1326 | Thus, setting it to 1 will make no additional attempts but the first. 1327 | */ 1328 | CINIT(LOCALPORTRANGE, LONG, 140), 1329 | 1330 | /* no transfer, set up connection and let application use the socket by 1331 | extracting it with CURLINFO_LASTSOCKET */ 1332 | CINIT(CONNECT_ONLY, LONG, 141), 1333 | 1334 | /* Function that will be called to convert from the 1335 | network encoding (instead of using the iconv calls in libcurl) */ 1336 | CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), 1337 | 1338 | /* Function that will be called to convert to the 1339 | network encoding (instead of using the iconv calls in libcurl) */ 1340 | CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), 1341 | 1342 | /* Function that will be called to convert from UTF8 1343 | (instead of using the iconv calls in libcurl) 1344 | Note that this is used only for SSL certificate processing */ 1345 | CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), 1346 | 1347 | /* if the connection proceeds too quickly then need to slow it down */ 1348 | /* limit-rate: maximum number of bytes per second to send or receive */ 1349 | CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), 1350 | CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), 1351 | 1352 | /* Pointer to command string to send if USER/PASS fails. */ 1353 | CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), 1354 | 1355 | /* callback function for setting socket options */ 1356 | CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), 1357 | CINIT(SOCKOPTDATA, OBJECTPOINT, 149), 1358 | 1359 | /* set to 0 to disable session ID re-use for this transfer, default is 1360 | enabled (== 1) */ 1361 | CINIT(SSL_SESSIONID_CACHE, LONG, 150), 1362 | 1363 | /* allowed SSH authentication methods */ 1364 | CINIT(SSH_AUTH_TYPES, LONG, 151), 1365 | 1366 | /* Used by scp/sftp to do public/private key authentication */ 1367 | CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), 1368 | CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), 1369 | 1370 | /* Send CCC (Clear Command Channel) after authentication */ 1371 | CINIT(FTP_SSL_CCC, LONG, 154), 1372 | 1373 | /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ 1374 | CINIT(TIMEOUT_MS, LONG, 155), 1375 | CINIT(CONNECTTIMEOUT_MS, LONG, 156), 1376 | 1377 | /* set to zero to disable the libcurl's decoding and thus pass the raw body 1378 | data to the application even when it is encoded/compressed */ 1379 | CINIT(HTTP_TRANSFER_DECODING, LONG, 157), 1380 | CINIT(HTTP_CONTENT_DECODING, LONG, 158), 1381 | 1382 | /* Permission used when creating new files and directories on the remote 1383 | server for protocols that support it, SFTP/SCP/FILE */ 1384 | CINIT(NEW_FILE_PERMS, LONG, 159), 1385 | CINIT(NEW_DIRECTORY_PERMS, LONG, 160), 1386 | 1387 | /* Set the behaviour of POST when redirecting. Values must be set to one 1388 | of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ 1389 | CINIT(POSTREDIR, LONG, 161), 1390 | 1391 | /* used by scp/sftp to verify the host's public key */ 1392 | CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), 1393 | 1394 | /* Callback function for opening socket (instead of socket(2)). Optionally, 1395 | callback is able change the address or refuse to connect returning 1396 | CURL_SOCKET_BAD. The callback should have type 1397 | curl_opensocket_callback */ 1398 | CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), 1399 | CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), 1400 | 1401 | /* POST volatile input fields. */ 1402 | CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), 1403 | 1404 | /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ 1405 | CINIT(PROXY_TRANSFER_MODE, LONG, 166), 1406 | 1407 | /* Callback function for seeking in the input stream */ 1408 | CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), 1409 | CINIT(SEEKDATA, OBJECTPOINT, 168), 1410 | 1411 | /* CRL file */ 1412 | CINIT(CRLFILE, OBJECTPOINT, 169), 1413 | 1414 | /* Issuer certificate */ 1415 | CINIT(ISSUERCERT, OBJECTPOINT, 170), 1416 | 1417 | /* (IPv6) Address scope */ 1418 | CINIT(ADDRESS_SCOPE, LONG, 171), 1419 | 1420 | /* Collect certificate chain info and allow it to get retrievable with 1421 | CURLINFO_CERTINFO after the transfer is complete. */ 1422 | CINIT(CERTINFO, LONG, 172), 1423 | 1424 | /* "name" and "pwd" to use when fetching. */ 1425 | CINIT(USERNAME, OBJECTPOINT, 173), 1426 | CINIT(PASSWORD, OBJECTPOINT, 174), 1427 | 1428 | /* "name" and "pwd" to use with Proxy when fetching. */ 1429 | CINIT(PROXYUSERNAME, OBJECTPOINT, 175), 1430 | CINIT(PROXYPASSWORD, OBJECTPOINT, 176), 1431 | 1432 | /* Comma separated list of hostnames defining no-proxy zones. These should 1433 | match both hostnames directly, and hostnames within a domain. For 1434 | example, local.com will match local.com and www.local.com, but NOT 1435 | notlocal.com or www.notlocal.com. For compatibility with other 1436 | implementations of this, .local.com will be considered to be the same as 1437 | local.com. A single * is the only valid wildcard, and effectively 1438 | disables the use of proxy. */ 1439 | CINIT(NOPROXY, OBJECTPOINT, 177), 1440 | 1441 | /* block size for TFTP transfers */ 1442 | CINIT(TFTP_BLKSIZE, LONG, 178), 1443 | 1444 | /* Socks Service */ 1445 | CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), 1446 | 1447 | /* Socks Service */ 1448 | CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), 1449 | 1450 | /* set the bitmask for the protocols that are allowed to be used for the 1451 | transfer, which thus helps the app which takes URLs from users or other 1452 | external inputs and want to restrict what protocol(s) to deal 1453 | with. Defaults to CURLPROTO_ALL. */ 1454 | CINIT(PROTOCOLS, LONG, 181), 1455 | 1456 | /* set the bitmask for the protocols that libcurl is allowed to follow to, 1457 | as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs 1458 | to be set in both bitmasks to be allowed to get redirected to. Defaults 1459 | to all protocols except FILE and SCP. */ 1460 | CINIT(REDIR_PROTOCOLS, LONG, 182), 1461 | 1462 | /* set the SSH knownhost file name to use */ 1463 | CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), 1464 | 1465 | /* set the SSH host key callback, must point to a curl_sshkeycallback 1466 | function */ 1467 | CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), 1468 | 1469 | /* set the SSH host key callback custom pointer */ 1470 | CINIT(SSH_KEYDATA, OBJECTPOINT, 185), 1471 | 1472 | /* set the SMTP mail originator */ 1473 | CINIT(MAIL_FROM, OBJECTPOINT, 186), 1474 | 1475 | /* set the SMTP mail receiver(s) */ 1476 | CINIT(MAIL_RCPT, OBJECTPOINT, 187), 1477 | 1478 | /* FTP: send PRET before PASV */ 1479 | CINIT(FTP_USE_PRET, LONG, 188), 1480 | 1481 | /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ 1482 | CINIT(RTSP_REQUEST, LONG, 189), 1483 | 1484 | /* The RTSP session identifier */ 1485 | CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190), 1486 | 1487 | /* The RTSP stream URI */ 1488 | CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191), 1489 | 1490 | /* The Transport: header to use in RTSP requests */ 1491 | CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192), 1492 | 1493 | /* Manually initialize the client RTSP CSeq for this handle */ 1494 | CINIT(RTSP_CLIENT_CSEQ, LONG, 193), 1495 | 1496 | /* Manually initialize the server RTSP CSeq for this handle */ 1497 | CINIT(RTSP_SERVER_CSEQ, LONG, 194), 1498 | 1499 | /* The stream to pass to INTERLEAVEFUNCTION. */ 1500 | CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), 1501 | 1502 | /* Let the application define a custom write method for RTP data */ 1503 | CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), 1504 | 1505 | /* Turn on wildcard matching */ 1506 | CINIT(WILDCARDMATCH, LONG, 197), 1507 | 1508 | /* Directory matching callback called before downloading of an 1509 | individual file (chunk) started */ 1510 | CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), 1511 | 1512 | /* Directory matching callback called after the file (chunk) 1513 | was downloaded, or skipped */ 1514 | CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), 1515 | 1516 | /* Change match (fnmatch-like) callback for wildcard matching */ 1517 | CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), 1518 | 1519 | /* Let the application define custom chunk data pointer */ 1520 | CINIT(CHUNK_DATA, OBJECTPOINT, 201), 1521 | 1522 | /* FNMATCH_FUNCTION user pointer */ 1523 | CINIT(FNMATCH_DATA, OBJECTPOINT, 202), 1524 | 1525 | /* send linked-list of name:port:address sets */ 1526 | CINIT(RESOLVE, OBJECTPOINT, 203), 1527 | 1528 | /* Set a username for authenticated TLS */ 1529 | CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204), 1530 | 1531 | /* Set a password for authenticated TLS */ 1532 | CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205), 1533 | 1534 | /* Set authentication type for authenticated TLS */ 1535 | CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), 1536 | 1537 | /* Set to 1 to enable the "TE:" header in HTTP requests to ask for 1538 | compressed transfer-encoded responses. Set to 0 to disable the use of TE: 1539 | in outgoing requests. The current default is 0, but it might change in a 1540 | future libcurl release. 1541 | 1542 | libcurl will ask for the compressed methods it knows of, and if that 1543 | isn't any, it will not ask for transfer-encoding at all even if this 1544 | option is set to 1. 1545 | 1546 | */ 1547 | CINIT(TRANSFER_ENCODING, LONG, 207), 1548 | 1549 | /* Callback function for closing socket (instead of close(2)). The callback 1550 | should have type curl_closesocket_callback */ 1551 | CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), 1552 | CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), 1553 | 1554 | /* allow GSSAPI credential delegation */ 1555 | CINIT(GSSAPI_DELEGATION, LONG, 210), 1556 | 1557 | /* Set the name servers to use for DNS resolution */ 1558 | CINIT(DNS_SERVERS, OBJECTPOINT, 211), 1559 | 1560 | /* Time-out accept operations (currently for FTP only) after this amount 1561 | of miliseconds. */ 1562 | CINIT(ACCEPTTIMEOUT_MS, LONG, 212), 1563 | 1564 | /* Set TCP keepalive */ 1565 | CINIT(TCP_KEEPALIVE, LONG, 213), 1566 | 1567 | /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ 1568 | CINIT(TCP_KEEPIDLE, LONG, 214), 1569 | CINIT(TCP_KEEPINTVL, LONG, 215), 1570 | 1571 | /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ 1572 | CINIT(SSL_OPTIONS, LONG, 216), 1573 | 1574 | /* Set the SMTP auth originator */ 1575 | CINIT(MAIL_AUTH, OBJECTPOINT, 217), 1576 | 1577 | /* Enable/disable SASL initial response */ 1578 | CINIT(SASL_IR, LONG, 218), 1579 | 1580 | /* Function that will be called instead of the internal progress display 1581 | * function. This function should be defined as the curl_xferinfo_callback 1582 | * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */ 1583 | CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219), 1584 | 1585 | /* The XOAUTH2 bearer token */ 1586 | CINIT(XOAUTH2_BEARER, OBJECTPOINT, 220), 1587 | 1588 | /* Set the interface string to use as outgoing network 1589 | * interface for DNS requests. 1590 | * Only supported by the c-ares DNS backend */ 1591 | CINIT(DNS_INTERFACE, OBJECTPOINT, 221), 1592 | 1593 | /* Set the local IPv4 address to use for outgoing DNS requests. 1594 | * Only supported by the c-ares DNS backend */ 1595 | CINIT(DNS_LOCAL_IP4, OBJECTPOINT, 222), 1596 | 1597 | /* Set the local IPv4 address to use for outgoing DNS requests. 1598 | * Only supported by the c-ares DNS backend */ 1599 | CINIT(DNS_LOCAL_IP6, OBJECTPOINT, 223), 1600 | 1601 | /* Set authentication options directly */ 1602 | CINIT(LOGIN_OPTIONS, OBJECTPOINT, 224), 1603 | 1604 | /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */ 1605 | CINIT(SSL_ENABLE_NPN, LONG, 225), 1606 | 1607 | /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */ 1608 | CINIT(SSL_ENABLE_ALPN, LONG, 226), 1609 | 1610 | /* Time to wait for a response to a HTTP request containing an 1611 | * Expect: 100-continue header before sending the data anyway. */ 1612 | CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227), 1613 | 1614 | /* This points to a linked list of headers used for proxy requests only, 1615 | struct curl_slist kind */ 1616 | CINIT(PROXYHEADER, OBJECTPOINT, 228), 1617 | 1618 | /* Pass in a bitmask of "header options" */ 1619 | CINIT(HEADEROPT, LONG, 229), 1620 | 1621 | /* The public key in DER form used to validate the peer public key 1622 | this option is used only if SSL_VERIFYPEER is true */ 1623 | CINIT(PINNEDPUBLICKEY, OBJECTPOINT, 230), 1624 | 1625 | /* Path to Unix domain socket */ 1626 | CINIT(UNIX_SOCKET_PATH, OBJECTPOINT, 231), 1627 | 1628 | /* Set if we should verify the certificate status. */ 1629 | CINIT(SSL_VERIFYSTATUS, LONG, 232), 1630 | 1631 | /* Set if we should enable TLS false start. */ 1632 | CINIT(SSL_FALSESTART, LONG, 233), 1633 | 1634 | /* Do not squash dot-dot sequences */ 1635 | CINIT(PATH_AS_IS, LONG, 234), 1636 | 1637 | /* Proxy Service Name */ 1638 | CINIT(PROXY_SERVICE_NAME, OBJECTPOINT, 235), 1639 | 1640 | /* Service Name */ 1641 | CINIT(SERVICE_NAME, OBJECTPOINT, 236), 1642 | 1643 | /* Wait/don't wait for pipe/mutex to clarify */ 1644 | CINIT(PIPEWAIT, LONG, 237), 1645 | 1646 | CURLOPT_LASTENTRY /* the last unused */ 1647 | } CURLoption; 1648 | 1649 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 1650 | the obsolete stuff removed! */ 1651 | 1652 | /* Backwards compatibility with older names */ 1653 | /* These are scheduled to disappear by 2011 */ 1654 | 1655 | /* This was added in version 7.19.1 */ 1656 | #define CURLOPT_POST301 CURLOPT_POSTREDIR 1657 | 1658 | /* These are scheduled to disappear by 2009 */ 1659 | 1660 | /* The following were added in 7.17.0 */ 1661 | #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD 1662 | #define CURLOPT_FTPAPPEND CURLOPT_APPEND 1663 | #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY 1664 | #define CURLOPT_FTP_SSL CURLOPT_USE_SSL 1665 | 1666 | /* The following were added earlier */ 1667 | 1668 | #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD 1669 | #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL 1670 | 1671 | #else 1672 | /* This is set if CURL_NO_OLDIES is defined at compile-time */ 1673 | #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ 1674 | #endif 1675 | 1676 | 1677 | /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host 1678 | name resolves addresses using more than one IP protocol version, this 1679 | option might be handy to force libcurl to use a specific IP version. */ 1680 | #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP 1681 | versions that your system allows */ 1682 | #define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */ 1683 | #define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */ 1684 | 1685 | /* three convenient "aliases" that follow the name scheme better */ 1686 | #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER 1687 | 1688 | /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ 1689 | enum { 1690 | CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd 1691 | like the library to choose the best possible 1692 | for us! */ 1693 | CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ 1694 | CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ 1695 | CURL_HTTP_VERSION_2_0, /* please use HTTP 2.0 in the request */ 1696 | 1697 | CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ 1698 | }; 1699 | 1700 | /* Convenience definition simple because the name of the version is HTTP/2 and 1701 | not 2.0. The 2_0 version of the enum name was set while the version was 1702 | still planned to be 2.0 and we stick to it for compatibility. */ 1703 | #define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0 1704 | 1705 | /* 1706 | * Public API enums for RTSP requests 1707 | */ 1708 | enum { 1709 | CURL_RTSPREQ_NONE, /* first in list */ 1710 | CURL_RTSPREQ_OPTIONS, 1711 | CURL_RTSPREQ_DESCRIBE, 1712 | CURL_RTSPREQ_ANNOUNCE, 1713 | CURL_RTSPREQ_SETUP, 1714 | CURL_RTSPREQ_PLAY, 1715 | CURL_RTSPREQ_PAUSE, 1716 | CURL_RTSPREQ_TEARDOWN, 1717 | CURL_RTSPREQ_GET_PARAMETER, 1718 | CURL_RTSPREQ_SET_PARAMETER, 1719 | CURL_RTSPREQ_RECORD, 1720 | CURL_RTSPREQ_RECEIVE, 1721 | CURL_RTSPREQ_LAST /* last in list */ 1722 | }; 1723 | 1724 | /* These enums are for use with the CURLOPT_NETRC option. */ 1725 | enum CURL_NETRC_OPTION { 1726 | CURL_NETRC_IGNORED, /* The .netrc will never be read. 1727 | * This is the default. */ 1728 | CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred 1729 | * to one in the .netrc. */ 1730 | CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. 1731 | * Unless one is set programmatically, the .netrc 1732 | * will be queried. */ 1733 | CURL_NETRC_LAST 1734 | }; 1735 | 1736 | enum { 1737 | CURL_SSLVERSION_DEFAULT, 1738 | CURL_SSLVERSION_TLSv1, /* TLS 1.x */ 1739 | CURL_SSLVERSION_SSLv2, 1740 | CURL_SSLVERSION_SSLv3, 1741 | CURL_SSLVERSION_TLSv1_0, 1742 | CURL_SSLVERSION_TLSv1_1, 1743 | CURL_SSLVERSION_TLSv1_2, 1744 | 1745 | CURL_SSLVERSION_LAST /* never use, keep last */ 1746 | }; 1747 | 1748 | enum CURL_TLSAUTH { 1749 | CURL_TLSAUTH_NONE, 1750 | CURL_TLSAUTH_SRP, 1751 | CURL_TLSAUTH_LAST /* never use, keep last */ 1752 | }; 1753 | 1754 | /* symbols to use with CURLOPT_POSTREDIR. 1755 | CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 1756 | can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 1757 | | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ 1758 | 1759 | #define CURL_REDIR_GET_ALL 0 1760 | #define CURL_REDIR_POST_301 1 1761 | #define CURL_REDIR_POST_302 2 1762 | #define CURL_REDIR_POST_303 4 1763 | #define CURL_REDIR_POST_ALL \ 1764 | (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) 1765 | 1766 | typedef enum { 1767 | CURL_TIMECOND_NONE, 1768 | 1769 | CURL_TIMECOND_IFMODSINCE, 1770 | CURL_TIMECOND_IFUNMODSINCE, 1771 | CURL_TIMECOND_LASTMOD, 1772 | 1773 | CURL_TIMECOND_LAST 1774 | } curl_TimeCond; 1775 | 1776 | 1777 | /* curl_strequal() and curl_strnequal() are subject for removal in a future 1778 | libcurl, see lib/README.curlx for details */ 1779 | CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); 1780 | CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); 1781 | 1782 | /* name is uppercase CURLFORM_ */ 1783 | #ifdef CFINIT 1784 | #undef CFINIT 1785 | #endif 1786 | 1787 | #ifdef CURL_ISOCPP 1788 | #define CFINIT(name) CURLFORM_ ## name 1789 | #else 1790 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 1791 | #define CFINIT(name) CURLFORM_/**/name 1792 | #endif 1793 | 1794 | typedef enum { 1795 | CFINIT(NOTHING), /********* the first one is unused ************/ 1796 | 1797 | /* */ 1798 | CFINIT(COPYNAME), 1799 | CFINIT(PTRNAME), 1800 | CFINIT(NAMELENGTH), 1801 | CFINIT(COPYCONTENTS), 1802 | CFINIT(PTRCONTENTS), 1803 | CFINIT(CONTENTSLENGTH), 1804 | CFINIT(FILECONTENT), 1805 | CFINIT(ARRAY), 1806 | CFINIT(OBSOLETE), 1807 | CFINIT(FILE), 1808 | 1809 | CFINIT(BUFFER), 1810 | CFINIT(BUFFERPTR), 1811 | CFINIT(BUFFERLENGTH), 1812 | 1813 | CFINIT(CONTENTTYPE), 1814 | CFINIT(CONTENTHEADER), 1815 | CFINIT(FILENAME), 1816 | CFINIT(END), 1817 | CFINIT(OBSOLETE2), 1818 | 1819 | CFINIT(STREAM), 1820 | 1821 | CURLFORM_LASTENTRY /* the last unused */ 1822 | } CURLformoption; 1823 | 1824 | #undef CFINIT /* done */ 1825 | 1826 | /* structure to be used as parameter for CURLFORM_ARRAY */ 1827 | struct curl_forms { 1828 | CURLformoption option; 1829 | const char *value; 1830 | }; 1831 | 1832 | /* use this for multipart formpost building */ 1833 | /* Returns code for curl_formadd() 1834 | * 1835 | * Returns: 1836 | * CURL_FORMADD_OK on success 1837 | * CURL_FORMADD_MEMORY if the FormInfo allocation fails 1838 | * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form 1839 | * CURL_FORMADD_NULL if a null pointer was given for a char 1840 | * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed 1841 | * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used 1842 | * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) 1843 | * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated 1844 | * CURL_FORMADD_MEMORY if some allocation for string copying failed. 1845 | * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array 1846 | * 1847 | ***************************************************************************/ 1848 | typedef enum { 1849 | CURL_FORMADD_OK, /* first, no error */ 1850 | 1851 | CURL_FORMADD_MEMORY, 1852 | CURL_FORMADD_OPTION_TWICE, 1853 | CURL_FORMADD_NULL, 1854 | CURL_FORMADD_UNKNOWN_OPTION, 1855 | CURL_FORMADD_INCOMPLETE, 1856 | CURL_FORMADD_ILLEGAL_ARRAY, 1857 | CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ 1858 | 1859 | CURL_FORMADD_LAST /* last */ 1860 | } CURLFORMcode; 1861 | 1862 | /* 1863 | * NAME curl_formadd() 1864 | * 1865 | * DESCRIPTION 1866 | * 1867 | * Pretty advanced function for building multi-part formposts. Each invoke 1868 | * adds one part that together construct a full post. Then use 1869 | * CURLOPT_HTTPPOST to send it off to libcurl. 1870 | */ 1871 | CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, 1872 | struct curl_httppost **last_post, 1873 | ...); 1874 | 1875 | /* 1876 | * callback function for curl_formget() 1877 | * The void *arg pointer will be the one passed as second argument to 1878 | * curl_formget(). 1879 | * The character buffer passed to it must not be freed. 1880 | * Should return the buffer length passed to it as the argument "len" on 1881 | * success. 1882 | */ 1883 | typedef size_t (*curl_formget_callback)(void *arg, const char *buf, 1884 | size_t len); 1885 | 1886 | /* 1887 | * NAME curl_formget() 1888 | * 1889 | * DESCRIPTION 1890 | * 1891 | * Serialize a curl_httppost struct built with curl_formadd(). 1892 | * Accepts a void pointer as second argument which will be passed to 1893 | * the curl_formget_callback function. 1894 | * Returns 0 on success. 1895 | */ 1896 | CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, 1897 | curl_formget_callback append); 1898 | /* 1899 | * NAME curl_formfree() 1900 | * 1901 | * DESCRIPTION 1902 | * 1903 | * Free a multipart formpost previously built with curl_formadd(). 1904 | */ 1905 | CURL_EXTERN void curl_formfree(struct curl_httppost *form); 1906 | 1907 | /* 1908 | * NAME curl_getenv() 1909 | * 1910 | * DESCRIPTION 1911 | * 1912 | * Returns a malloc()'ed string that MUST be curl_free()ed after usage is 1913 | * complete. DEPRECATED - see lib/README.curlx 1914 | */ 1915 | CURL_EXTERN char *curl_getenv(const char *variable); 1916 | 1917 | /* 1918 | * NAME curl_version() 1919 | * 1920 | * DESCRIPTION 1921 | * 1922 | * Returns a static ascii string of the libcurl version. 1923 | */ 1924 | CURL_EXTERN char *curl_version(void); 1925 | 1926 | /* 1927 | * NAME curl_easy_escape() 1928 | * 1929 | * DESCRIPTION 1930 | * 1931 | * Escapes URL strings (converts all letters consider illegal in URLs to their 1932 | * %XX versions). This function returns a new allocated string or NULL if an 1933 | * error occurred. 1934 | */ 1935 | CURL_EXTERN char *curl_easy_escape(CURL *handle, 1936 | const char *string, 1937 | int length); 1938 | 1939 | /* the previous version: */ 1940 | CURL_EXTERN char *curl_escape(const char *string, 1941 | int length); 1942 | 1943 | 1944 | /* 1945 | * NAME curl_easy_unescape() 1946 | * 1947 | * DESCRIPTION 1948 | * 1949 | * Unescapes URL encoding in strings (converts all %XX codes to their 8bit 1950 | * versions). This function returns a new allocated string or NULL if an error 1951 | * occurred. 1952 | * Conversion Note: On non-ASCII platforms the ASCII %XX codes are 1953 | * converted into the host encoding. 1954 | */ 1955 | CURL_EXTERN char *curl_easy_unescape(CURL *handle, 1956 | const char *string, 1957 | int length, 1958 | int *outlength); 1959 | 1960 | /* the previous version */ 1961 | CURL_EXTERN char *curl_unescape(const char *string, 1962 | int length); 1963 | 1964 | /* 1965 | * NAME curl_free() 1966 | * 1967 | * DESCRIPTION 1968 | * 1969 | * Provided for de-allocation in the same translation unit that did the 1970 | * allocation. Added in libcurl 7.10 1971 | */ 1972 | CURL_EXTERN void curl_free(void *p); 1973 | 1974 | /* 1975 | * NAME curl_global_init() 1976 | * 1977 | * DESCRIPTION 1978 | * 1979 | * curl_global_init() should be invoked exactly once for each application that 1980 | * uses libcurl and before any call of other libcurl functions. 1981 | * 1982 | * This function is not thread-safe! 1983 | */ 1984 | CURL_EXTERN CURLcode curl_global_init(long flags); 1985 | 1986 | /* 1987 | * NAME curl_global_init_mem() 1988 | * 1989 | * DESCRIPTION 1990 | * 1991 | * curl_global_init() or curl_global_init_mem() should be invoked exactly once 1992 | * for each application that uses libcurl. This function can be used to 1993 | * initialize libcurl and set user defined memory management callback 1994 | * functions. Users can implement memory management routines to check for 1995 | * memory leaks, check for mis-use of the curl library etc. User registered 1996 | * callback routines with be invoked by this library instead of the system 1997 | * memory management routines like malloc, free etc. 1998 | */ 1999 | CURL_EXTERN CURLcode curl_global_init_mem(long flags, 2000 | curl_malloc_callback m, 2001 | curl_free_callback f, 2002 | curl_realloc_callback r, 2003 | curl_strdup_callback s, 2004 | curl_calloc_callback c); 2005 | 2006 | /* 2007 | * NAME curl_global_cleanup() 2008 | * 2009 | * DESCRIPTION 2010 | * 2011 | * curl_global_cleanup() should be invoked exactly once for each application 2012 | * that uses libcurl 2013 | */ 2014 | CURL_EXTERN void curl_global_cleanup(void); 2015 | 2016 | /* linked-list structure for the CURLOPT_QUOTE option (and other) */ 2017 | struct curl_slist { 2018 | char *data; 2019 | struct curl_slist *next; 2020 | }; 2021 | 2022 | /* 2023 | * NAME curl_slist_append() 2024 | * 2025 | * DESCRIPTION 2026 | * 2027 | * Appends a string to a linked list. If no list exists, it will be created 2028 | * first. Returns the new list, after appending. 2029 | */ 2030 | CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, 2031 | const char *); 2032 | 2033 | /* 2034 | * NAME curl_slist_free_all() 2035 | * 2036 | * DESCRIPTION 2037 | * 2038 | * free a previously built curl_slist. 2039 | */ 2040 | CURL_EXTERN void curl_slist_free_all(struct curl_slist *); 2041 | 2042 | /* 2043 | * NAME curl_getdate() 2044 | * 2045 | * DESCRIPTION 2046 | * 2047 | * Returns the time, in seconds since 1 Jan 1970 of the time string given in 2048 | * the first argument. The time argument in the second parameter is unused 2049 | * and should be set to NULL. 2050 | */ 2051 | CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); 2052 | 2053 | /* info about the certificate chain, only for OpenSSL builds. Asked 2054 | for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ 2055 | struct curl_certinfo { 2056 | int num_of_certs; /* number of certificates with information */ 2057 | struct curl_slist **certinfo; /* for each index in this array, there's a 2058 | linked list with textual information in the 2059 | format "name: value" */ 2060 | }; 2061 | 2062 | /* enum for the different supported SSL backends */ 2063 | typedef enum { 2064 | CURLSSLBACKEND_NONE = 0, 2065 | CURLSSLBACKEND_OPENSSL = 1, 2066 | CURLSSLBACKEND_GNUTLS = 2, 2067 | CURLSSLBACKEND_NSS = 3, 2068 | CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */ 2069 | CURLSSLBACKEND_GSKIT = 5, 2070 | CURLSSLBACKEND_POLARSSL = 6, 2071 | CURLSSLBACKEND_CYASSL = 7, 2072 | CURLSSLBACKEND_SCHANNEL = 8, 2073 | CURLSSLBACKEND_DARWINSSL = 9, 2074 | CURLSSLBACKEND_AXTLS = 10 2075 | } curl_sslbackend; 2076 | 2077 | /* Information about the SSL library used and the respective internal SSL 2078 | handle, which can be used to obtain further information regarding the 2079 | connection. Asked for with CURLINFO_TLS_SESSION. */ 2080 | struct curl_tlssessioninfo { 2081 | curl_sslbackend backend; 2082 | void *internals; 2083 | }; 2084 | 2085 | #define CURLINFO_STRING 0x100000 2086 | #define CURLINFO_LONG 0x200000 2087 | #define CURLINFO_DOUBLE 0x300000 2088 | #define CURLINFO_SLIST 0x400000 2089 | #define CURLINFO_MASK 0x0fffff 2090 | #define CURLINFO_TYPEMASK 0xf00000 2091 | 2092 | typedef enum { 2093 | CURLINFO_NONE, /* first, never use this */ 2094 | CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, 2095 | CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, 2096 | CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, 2097 | CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, 2098 | CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, 2099 | CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, 2100 | CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, 2101 | CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, 2102 | CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, 2103 | CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, 2104 | CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, 2105 | CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, 2106 | CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, 2107 | CURLINFO_FILETIME = CURLINFO_LONG + 14, 2108 | CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, 2109 | CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, 2110 | CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, 2111 | CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, 2112 | CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, 2113 | CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, 2114 | CURLINFO_PRIVATE = CURLINFO_STRING + 21, 2115 | CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, 2116 | CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, 2117 | CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, 2118 | CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, 2119 | CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, 2120 | CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, 2121 | CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, 2122 | CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, 2123 | CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, 2124 | CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, 2125 | CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, 2126 | CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, 2127 | CURLINFO_CERTINFO = CURLINFO_SLIST + 34, 2128 | CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, 2129 | CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, 2130 | CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, 2131 | CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, 2132 | CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, 2133 | CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, 2134 | CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, 2135 | CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, 2136 | CURLINFO_TLS_SESSION = CURLINFO_SLIST + 43, 2137 | /* Fill in new entries below here! */ 2138 | 2139 | CURLINFO_LASTONE = 43 2140 | } CURLINFO; 2141 | 2142 | /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as 2143 | CURLINFO_HTTP_CODE */ 2144 | #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE 2145 | 2146 | typedef enum { 2147 | CURLCLOSEPOLICY_NONE, /* first, never use this */ 2148 | 2149 | CURLCLOSEPOLICY_OLDEST, 2150 | CURLCLOSEPOLICY_LEAST_RECENTLY_USED, 2151 | CURLCLOSEPOLICY_LEAST_TRAFFIC, 2152 | CURLCLOSEPOLICY_SLOWEST, 2153 | CURLCLOSEPOLICY_CALLBACK, 2154 | 2155 | CURLCLOSEPOLICY_LAST /* last, never use this */ 2156 | } curl_closepolicy; 2157 | 2158 | #define CURL_GLOBAL_SSL (1<<0) 2159 | #define CURL_GLOBAL_WIN32 (1<<1) 2160 | #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) 2161 | #define CURL_GLOBAL_NOTHING 0 2162 | #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL 2163 | #define CURL_GLOBAL_ACK_EINTR (1<<2) 2164 | 2165 | 2166 | /***************************************************************************** 2167 | * Setup defines, protos etc for the sharing stuff. 2168 | */ 2169 | 2170 | /* Different data locks for a single share */ 2171 | typedef enum { 2172 | CURL_LOCK_DATA_NONE = 0, 2173 | /* CURL_LOCK_DATA_SHARE is used internally to say that 2174 | * the locking is just made to change the internal state of the share 2175 | * itself. 2176 | */ 2177 | CURL_LOCK_DATA_SHARE, 2178 | CURL_LOCK_DATA_COOKIE, 2179 | CURL_LOCK_DATA_DNS, 2180 | CURL_LOCK_DATA_SSL_SESSION, 2181 | CURL_LOCK_DATA_CONNECT, 2182 | CURL_LOCK_DATA_LAST 2183 | } curl_lock_data; 2184 | 2185 | /* Different lock access types */ 2186 | typedef enum { 2187 | CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ 2188 | CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ 2189 | CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ 2190 | CURL_LOCK_ACCESS_LAST /* never use */ 2191 | } curl_lock_access; 2192 | 2193 | typedef void (*curl_lock_function)(CURL *handle, 2194 | curl_lock_data data, 2195 | curl_lock_access locktype, 2196 | void *userptr); 2197 | typedef void (*curl_unlock_function)(CURL *handle, 2198 | curl_lock_data data, 2199 | void *userptr); 2200 | 2201 | typedef void CURLSH; 2202 | 2203 | typedef enum { 2204 | CURLSHE_OK, /* all is fine */ 2205 | CURLSHE_BAD_OPTION, /* 1 */ 2206 | CURLSHE_IN_USE, /* 2 */ 2207 | CURLSHE_INVALID, /* 3 */ 2208 | CURLSHE_NOMEM, /* 4 out of memory */ 2209 | CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ 2210 | CURLSHE_LAST /* never use */ 2211 | } CURLSHcode; 2212 | 2213 | typedef enum { 2214 | CURLSHOPT_NONE, /* don't use */ 2215 | CURLSHOPT_SHARE, /* specify a data type to share */ 2216 | CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ 2217 | CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ 2218 | CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ 2219 | CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock 2220 | callback functions */ 2221 | CURLSHOPT_LAST /* never use */ 2222 | } CURLSHoption; 2223 | 2224 | CURL_EXTERN CURLSH *curl_share_init(void); 2225 | CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); 2226 | CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); 2227 | 2228 | /**************************************************************************** 2229 | * Structures for querying information about the curl library at runtime. 2230 | */ 2231 | 2232 | typedef enum { 2233 | CURLVERSION_FIRST, 2234 | CURLVERSION_SECOND, 2235 | CURLVERSION_THIRD, 2236 | CURLVERSION_FOURTH, 2237 | CURLVERSION_LAST /* never actually use this */ 2238 | } CURLversion; 2239 | 2240 | /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by 2241 | basically all programs ever that want to get version information. It is 2242 | meant to be a built-in version number for what kind of struct the caller 2243 | expects. If the struct ever changes, we redefine the NOW to another enum 2244 | from above. */ 2245 | #define CURLVERSION_NOW CURLVERSION_FOURTH 2246 | 2247 | typedef struct { 2248 | CURLversion age; /* age of the returned struct */ 2249 | const char *version; /* LIBCURL_VERSION */ 2250 | unsigned int version_num; /* LIBCURL_VERSION_NUM */ 2251 | const char *host; /* OS/host/cpu/machine when configured */ 2252 | int features; /* bitmask, see defines below */ 2253 | const char *ssl_version; /* human readable string */ 2254 | long ssl_version_num; /* not used anymore, always 0 */ 2255 | const char *libz_version; /* human readable string */ 2256 | /* protocols is terminated by an entry with a NULL protoname */ 2257 | const char * const *protocols; 2258 | 2259 | /* The fields below this were added in CURLVERSION_SECOND */ 2260 | const char *ares; 2261 | int ares_num; 2262 | 2263 | /* This field was added in CURLVERSION_THIRD */ 2264 | const char *libidn; 2265 | 2266 | /* These field were added in CURLVERSION_FOURTH */ 2267 | 2268 | /* Same as '_libiconv_version' if built with HAVE_ICONV */ 2269 | int iconv_ver_num; 2270 | 2271 | const char *libssh_version; /* human readable string */ 2272 | 2273 | } curl_version_info_data; 2274 | 2275 | #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ 2276 | #define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported 2277 | (deprecated) */ 2278 | #define CURL_VERSION_SSL (1<<2) /* SSL options are present */ 2279 | #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ 2280 | #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ 2281 | #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported 2282 | (deprecated) */ 2283 | #define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */ 2284 | #define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */ 2285 | #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */ 2286 | #define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */ 2287 | #define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are 2288 | supported */ 2289 | #define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */ 2290 | #define CURL_VERSION_CONV (1<<12) /* Character conversions supported */ 2291 | #define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */ 2292 | #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ 2293 | #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper 2294 | is suported */ 2295 | #define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */ 2296 | #define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */ 2297 | #define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */ 2298 | #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */ 2299 | 2300 | /* 2301 | * NAME curl_version_info() 2302 | * 2303 | * DESCRIPTION 2304 | * 2305 | * This function returns a pointer to a static copy of the version info 2306 | * struct. See above. 2307 | */ 2308 | CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); 2309 | 2310 | /* 2311 | * NAME curl_easy_strerror() 2312 | * 2313 | * DESCRIPTION 2314 | * 2315 | * The curl_easy_strerror function may be used to turn a CURLcode value 2316 | * into the equivalent human readable error string. This is useful 2317 | * for printing meaningful error messages. 2318 | */ 2319 | CURL_EXTERN const char *curl_easy_strerror(CURLcode); 2320 | 2321 | /* 2322 | * NAME curl_share_strerror() 2323 | * 2324 | * DESCRIPTION 2325 | * 2326 | * The curl_share_strerror function may be used to turn a CURLSHcode value 2327 | * into the equivalent human readable error string. This is useful 2328 | * for printing meaningful error messages. 2329 | */ 2330 | CURL_EXTERN const char *curl_share_strerror(CURLSHcode); 2331 | 2332 | /* 2333 | * NAME curl_easy_pause() 2334 | * 2335 | * DESCRIPTION 2336 | * 2337 | * The curl_easy_pause function pauses or unpauses transfers. Select the new 2338 | * state by setting the bitmask, use the convenience defines below. 2339 | * 2340 | */ 2341 | CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); 2342 | 2343 | #define CURLPAUSE_RECV (1<<0) 2344 | #define CURLPAUSE_RECV_CONT (0) 2345 | 2346 | #define CURLPAUSE_SEND (1<<2) 2347 | #define CURLPAUSE_SEND_CONT (0) 2348 | 2349 | #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) 2350 | #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) 2351 | 2352 | #ifdef __cplusplus 2353 | } 2354 | #endif 2355 | 2356 | /* unfortunately, the easy.h and multi.h include files need options and info 2357 | stuff before they can be included! */ 2358 | #include "easy.h" /* nothing in curl is fun without the easy stuff */ 2359 | #include "multi.h" 2360 | 2361 | /* the typechecker doesn't work in C++ (yet) */ 2362 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ 2363 | ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ 2364 | !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) 2365 | #include "typecheck-gcc.h" 2366 | #else 2367 | #if defined(__STDC__) && (__STDC__ >= 1) 2368 | /* This preprocessor magic that replaces a call with the exact same call is 2369 | only done to make sure application authors pass exactly three arguments 2370 | to these functions. */ 2371 | #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) 2372 | #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) 2373 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 2374 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 2375 | #endif /* __STDC__ >= 1 */ 2376 | #endif /* gcc >= 4.3 && !__cplusplus */ 2377 | 2378 | #endif /* __CURL_CURL_H */ 2379 | -------------------------------------------------------------------------------- /HttpClient/include/curl/curlbuild.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLBUILD_H 2 | #define __CURL_CURLBUILD_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* ================================================================ */ 26 | /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ 27 | /* ================================================================ */ 28 | 29 | /* 30 | * NOTE 1: 31 | * ------- 32 | * 33 | * See file include/curl/curlbuild.h.in, run configure, and forget 34 | * that this file exists it is only used for non-configure systems. 35 | * But you can keep reading if you want ;-) 36 | * 37 | */ 38 | 39 | /* ================================================================ */ 40 | /* NOTES FOR NON-CONFIGURE SYSTEMS */ 41 | /* ================================================================ */ 42 | 43 | /* 44 | * NOTE 1: 45 | * ------- 46 | * 47 | * Nothing in this file is intended to be modified or adjusted by the 48 | * curl library user nor by the curl library builder. 49 | * 50 | * If you think that something actually needs to be changed, adjusted 51 | * or fixed in this file, then, report it on the libcurl development 52 | * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ 53 | * 54 | * Try to keep one section per platform, compiler and architecture, 55 | * otherwise, if an existing section is reused for a different one and 56 | * later on the original is adjusted, probably the piggybacking one can 57 | * be adversely changed. 58 | * 59 | * In order to differentiate between platforms/compilers/architectures 60 | * use only compiler built in predefined preprocessor symbols. 61 | * 62 | * This header file shall only export symbols which are 'curl' or 'CURL' 63 | * prefixed, otherwise public name space would be polluted. 64 | * 65 | * NOTE 2: 66 | * ------- 67 | * 68 | * For any given platform/compiler curl_off_t must be typedef'ed to a 69 | * 64-bit wide signed integral data type. The width of this data type 70 | * must remain constant and independent of any possible large file 71 | * support settings. 72 | * 73 | * As an exception to the above, curl_off_t shall be typedef'ed to a 74 | * 32-bit wide signed integral data type if there is no 64-bit type. 75 | * 76 | * As a general rule, curl_off_t shall not be mapped to off_t. This 77 | * rule shall only be violated if off_t is the only 64-bit data type 78 | * available and the size of off_t is independent of large file support 79 | * settings. Keep your build on the safe side avoiding an off_t gating. 80 | * If you have a 64-bit off_t then take for sure that another 64-bit 81 | * data type exists, dig deeper and you will find it. 82 | * 83 | * NOTE 3: 84 | * ------- 85 | * 86 | * Right now you might be staring at file include/curl/curlbuild.h.dist or 87 | * at file include/curl/curlbuild.h, this is due to the following reason: 88 | * file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h 89 | * when the libcurl source code distribution archive file is created. 90 | * 91 | * File include/curl/curlbuild.h.dist is not included in the distribution 92 | * archive. File include/curl/curlbuild.h is not present in the git tree. 93 | * 94 | * The distributed include/curl/curlbuild.h file is only intended to be used 95 | * on systems which can not run the also distributed configure script. 96 | * 97 | * On systems capable of running the configure script, the configure process 98 | * will overwrite the distributed include/curl/curlbuild.h file with one that 99 | * is suitable and specific to the library being configured and built, which 100 | * is generated from the include/curl/curlbuild.h.in template file. 101 | * 102 | * If you check out from git on a non-configure platform, you must run the 103 | * appropriate buildconf* script to set up curlbuild.h and other local files. 104 | * 105 | */ 106 | 107 | /* ================================================================ */ 108 | /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ 109 | /* ================================================================ */ 110 | 111 | #ifdef CURL_SIZEOF_LONG 112 | # error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" 113 | Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined 114 | #endif 115 | 116 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 117 | # error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" 118 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined 119 | #endif 120 | 121 | #ifdef CURL_SIZEOF_CURL_SOCKLEN_T 122 | # error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" 123 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined 124 | #endif 125 | 126 | #ifdef CURL_TYPEOF_CURL_OFF_T 127 | # error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" 128 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined 129 | #endif 130 | 131 | #ifdef CURL_FORMAT_CURL_OFF_T 132 | # error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" 133 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined 134 | #endif 135 | 136 | #ifdef CURL_FORMAT_CURL_OFF_TU 137 | # error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" 138 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined 139 | #endif 140 | 141 | #ifdef CURL_FORMAT_OFF_T 142 | # error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" 143 | Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined 144 | #endif 145 | 146 | #ifdef CURL_SIZEOF_CURL_OFF_T 147 | # error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" 148 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined 149 | #endif 150 | 151 | #ifdef CURL_SUFFIX_CURL_OFF_T 152 | # error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" 153 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined 154 | #endif 155 | 156 | #ifdef CURL_SUFFIX_CURL_OFF_TU 157 | # error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" 158 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined 159 | #endif 160 | 161 | /* ================================================================ */ 162 | /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ 163 | /* ================================================================ */ 164 | 165 | #if defined(__DJGPP__) || defined(__GO32__) 166 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 167 | # define CURL_SIZEOF_LONG 4 168 | # define CURL_TYPEOF_CURL_OFF_T long long 169 | # define CURL_FORMAT_CURL_OFF_T "lld" 170 | # define CURL_FORMAT_CURL_OFF_TU "llu" 171 | # define CURL_FORMAT_OFF_T "%lld" 172 | # define CURL_SIZEOF_CURL_OFF_T 8 173 | # define CURL_SUFFIX_CURL_OFF_T LL 174 | # define CURL_SUFFIX_CURL_OFF_TU ULL 175 | # else 176 | # define CURL_SIZEOF_LONG 4 177 | # define CURL_TYPEOF_CURL_OFF_T long 178 | # define CURL_FORMAT_CURL_OFF_T "ld" 179 | # define CURL_FORMAT_CURL_OFF_TU "lu" 180 | # define CURL_FORMAT_OFF_T "%ld" 181 | # define CURL_SIZEOF_CURL_OFF_T 4 182 | # define CURL_SUFFIX_CURL_OFF_T L 183 | # define CURL_SUFFIX_CURL_OFF_TU UL 184 | # endif 185 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 186 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 187 | 188 | #elif defined(__SALFORDC__) 189 | # define CURL_SIZEOF_LONG 4 190 | # define CURL_TYPEOF_CURL_OFF_T long 191 | # define CURL_FORMAT_CURL_OFF_T "ld" 192 | # define CURL_FORMAT_CURL_OFF_TU "lu" 193 | # define CURL_FORMAT_OFF_T "%ld" 194 | # define CURL_SIZEOF_CURL_OFF_T 4 195 | # define CURL_SUFFIX_CURL_OFF_T L 196 | # define CURL_SUFFIX_CURL_OFF_TU UL 197 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 198 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 199 | 200 | #elif defined(__BORLANDC__) 201 | # if (__BORLANDC__ < 0x520) 202 | # define CURL_SIZEOF_LONG 4 203 | # define CURL_TYPEOF_CURL_OFF_T long 204 | # define CURL_FORMAT_CURL_OFF_T "ld" 205 | # define CURL_FORMAT_CURL_OFF_TU "lu" 206 | # define CURL_FORMAT_OFF_T "%ld" 207 | # define CURL_SIZEOF_CURL_OFF_T 4 208 | # define CURL_SUFFIX_CURL_OFF_T L 209 | # define CURL_SUFFIX_CURL_OFF_TU UL 210 | # else 211 | # define CURL_SIZEOF_LONG 4 212 | # define CURL_TYPEOF_CURL_OFF_T __int64 213 | # define CURL_FORMAT_CURL_OFF_T "I64d" 214 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 215 | # define CURL_FORMAT_OFF_T "%I64d" 216 | # define CURL_SIZEOF_CURL_OFF_T 8 217 | # define CURL_SUFFIX_CURL_OFF_T i64 218 | # define CURL_SUFFIX_CURL_OFF_TU ui64 219 | # endif 220 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 221 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 222 | 223 | #elif defined(__TURBOC__) 224 | # define CURL_SIZEOF_LONG 4 225 | # define CURL_TYPEOF_CURL_OFF_T long 226 | # define CURL_FORMAT_CURL_OFF_T "ld" 227 | # define CURL_FORMAT_CURL_OFF_TU "lu" 228 | # define CURL_FORMAT_OFF_T "%ld" 229 | # define CURL_SIZEOF_CURL_OFF_T 4 230 | # define CURL_SUFFIX_CURL_OFF_T L 231 | # define CURL_SUFFIX_CURL_OFF_TU UL 232 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 233 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 234 | 235 | #elif defined(__WATCOMC__) 236 | # if defined(__386__) 237 | # define CURL_SIZEOF_LONG 4 238 | # define CURL_TYPEOF_CURL_OFF_T __int64 239 | # define CURL_FORMAT_CURL_OFF_T "I64d" 240 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 241 | # define CURL_FORMAT_OFF_T "%I64d" 242 | # define CURL_SIZEOF_CURL_OFF_T 8 243 | # define CURL_SUFFIX_CURL_OFF_T i64 244 | # define CURL_SUFFIX_CURL_OFF_TU ui64 245 | # else 246 | # define CURL_SIZEOF_LONG 4 247 | # define CURL_TYPEOF_CURL_OFF_T long 248 | # define CURL_FORMAT_CURL_OFF_T "ld" 249 | # define CURL_FORMAT_CURL_OFF_TU "lu" 250 | # define CURL_FORMAT_OFF_T "%ld" 251 | # define CURL_SIZEOF_CURL_OFF_T 4 252 | # define CURL_SUFFIX_CURL_OFF_T L 253 | # define CURL_SUFFIX_CURL_OFF_TU UL 254 | # endif 255 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 256 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 257 | 258 | #elif defined(__POCC__) 259 | # if (__POCC__ < 280) 260 | # define CURL_SIZEOF_LONG 4 261 | # define CURL_TYPEOF_CURL_OFF_T long 262 | # define CURL_FORMAT_CURL_OFF_T "ld" 263 | # define CURL_FORMAT_CURL_OFF_TU "lu" 264 | # define CURL_FORMAT_OFF_T "%ld" 265 | # define CURL_SIZEOF_CURL_OFF_T 4 266 | # define CURL_SUFFIX_CURL_OFF_T L 267 | # define CURL_SUFFIX_CURL_OFF_TU UL 268 | # elif defined(_MSC_VER) 269 | # define CURL_SIZEOF_LONG 4 270 | # define CURL_TYPEOF_CURL_OFF_T __int64 271 | # define CURL_FORMAT_CURL_OFF_T "I64d" 272 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 273 | # define CURL_FORMAT_OFF_T "%I64d" 274 | # define CURL_SIZEOF_CURL_OFF_T 8 275 | # define CURL_SUFFIX_CURL_OFF_T i64 276 | # define CURL_SUFFIX_CURL_OFF_TU ui64 277 | # else 278 | # define CURL_SIZEOF_LONG 4 279 | # define CURL_TYPEOF_CURL_OFF_T long long 280 | # define CURL_FORMAT_CURL_OFF_T "lld" 281 | # define CURL_FORMAT_CURL_OFF_TU "llu" 282 | # define CURL_FORMAT_OFF_T "%lld" 283 | # define CURL_SIZEOF_CURL_OFF_T 8 284 | # define CURL_SUFFIX_CURL_OFF_T LL 285 | # define CURL_SUFFIX_CURL_OFF_TU ULL 286 | # endif 287 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 288 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 289 | 290 | #elif defined(__LCC__) 291 | # define CURL_SIZEOF_LONG 4 292 | # define CURL_TYPEOF_CURL_OFF_T long 293 | # define CURL_FORMAT_CURL_OFF_T "ld" 294 | # define CURL_FORMAT_CURL_OFF_TU "lu" 295 | # define CURL_FORMAT_OFF_T "%ld" 296 | # define CURL_SIZEOF_CURL_OFF_T 4 297 | # define CURL_SUFFIX_CURL_OFF_T L 298 | # define CURL_SUFFIX_CURL_OFF_TU UL 299 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 300 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 301 | 302 | #elif defined(__SYMBIAN32__) 303 | # if defined(__EABI__) /* Treat all ARM compilers equally */ 304 | # define CURL_SIZEOF_LONG 4 305 | # define CURL_TYPEOF_CURL_OFF_T long long 306 | # define CURL_FORMAT_CURL_OFF_T "lld" 307 | # define CURL_FORMAT_CURL_OFF_TU "llu" 308 | # define CURL_FORMAT_OFF_T "%lld" 309 | # define CURL_SIZEOF_CURL_OFF_T 8 310 | # define CURL_SUFFIX_CURL_OFF_T LL 311 | # define CURL_SUFFIX_CURL_OFF_TU ULL 312 | # elif defined(__CW32__) 313 | # pragma longlong on 314 | # define CURL_SIZEOF_LONG 4 315 | # define CURL_TYPEOF_CURL_OFF_T long long 316 | # define CURL_FORMAT_CURL_OFF_T "lld" 317 | # define CURL_FORMAT_CURL_OFF_TU "llu" 318 | # define CURL_FORMAT_OFF_T "%lld" 319 | # define CURL_SIZEOF_CURL_OFF_T 8 320 | # define CURL_SUFFIX_CURL_OFF_T LL 321 | # define CURL_SUFFIX_CURL_OFF_TU ULL 322 | # elif defined(__VC32__) 323 | # define CURL_SIZEOF_LONG 4 324 | # define CURL_TYPEOF_CURL_OFF_T __int64 325 | # define CURL_FORMAT_CURL_OFF_T "lld" 326 | # define CURL_FORMAT_CURL_OFF_TU "llu" 327 | # define CURL_FORMAT_OFF_T "%lld" 328 | # define CURL_SIZEOF_CURL_OFF_T 8 329 | # define CURL_SUFFIX_CURL_OFF_T LL 330 | # define CURL_SUFFIX_CURL_OFF_TU ULL 331 | # endif 332 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 333 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 334 | 335 | #elif defined(__MWERKS__) 336 | # define CURL_SIZEOF_LONG 4 337 | # define CURL_TYPEOF_CURL_OFF_T long long 338 | # define CURL_FORMAT_CURL_OFF_T "lld" 339 | # define CURL_FORMAT_CURL_OFF_TU "llu" 340 | # define CURL_FORMAT_OFF_T "%lld" 341 | # define CURL_SIZEOF_CURL_OFF_T 8 342 | # define CURL_SUFFIX_CURL_OFF_T LL 343 | # define CURL_SUFFIX_CURL_OFF_TU ULL 344 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 345 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 346 | 347 | #elif defined(_WIN32_WCE) 348 | # define CURL_SIZEOF_LONG 4 349 | # define CURL_TYPEOF_CURL_OFF_T __int64 350 | # define CURL_FORMAT_CURL_OFF_T "I64d" 351 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 352 | # define CURL_FORMAT_OFF_T "%I64d" 353 | # define CURL_SIZEOF_CURL_OFF_T 8 354 | # define CURL_SUFFIX_CURL_OFF_T i64 355 | # define CURL_SUFFIX_CURL_OFF_TU ui64 356 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 357 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 358 | 359 | #elif defined(__MINGW32__) 360 | # define CURL_SIZEOF_LONG 4 361 | # define CURL_TYPEOF_CURL_OFF_T long long 362 | # define CURL_FORMAT_CURL_OFF_T "I64d" 363 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 364 | # define CURL_FORMAT_OFF_T "%I64d" 365 | # define CURL_SIZEOF_CURL_OFF_T 8 366 | # define CURL_SUFFIX_CURL_OFF_T LL 367 | # define CURL_SUFFIX_CURL_OFF_TU ULL 368 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 369 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 370 | 371 | #elif defined(__VMS) 372 | # if defined(__VAX) 373 | # define CURL_SIZEOF_LONG 4 374 | # define CURL_TYPEOF_CURL_OFF_T long 375 | # define CURL_FORMAT_CURL_OFF_T "ld" 376 | # define CURL_FORMAT_CURL_OFF_TU "lu" 377 | # define CURL_FORMAT_OFF_T "%ld" 378 | # define CURL_SIZEOF_CURL_OFF_T 4 379 | # define CURL_SUFFIX_CURL_OFF_T L 380 | # define CURL_SUFFIX_CURL_OFF_TU UL 381 | # else 382 | # define CURL_SIZEOF_LONG 4 383 | # define CURL_TYPEOF_CURL_OFF_T long long 384 | # define CURL_FORMAT_CURL_OFF_T "lld" 385 | # define CURL_FORMAT_CURL_OFF_TU "llu" 386 | # define CURL_FORMAT_OFF_T "%lld" 387 | # define CURL_SIZEOF_CURL_OFF_T 8 388 | # define CURL_SUFFIX_CURL_OFF_T LL 389 | # define CURL_SUFFIX_CURL_OFF_TU ULL 390 | # endif 391 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 392 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 393 | 394 | #elif defined(__OS400__) 395 | # if defined(__ILEC400__) 396 | # define CURL_SIZEOF_LONG 4 397 | # define CURL_TYPEOF_CURL_OFF_T long long 398 | # define CURL_FORMAT_CURL_OFF_T "lld" 399 | # define CURL_FORMAT_CURL_OFF_TU "llu" 400 | # define CURL_FORMAT_OFF_T "%lld" 401 | # define CURL_SIZEOF_CURL_OFF_T 8 402 | # define CURL_SUFFIX_CURL_OFF_T LL 403 | # define CURL_SUFFIX_CURL_OFF_TU ULL 404 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 405 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 406 | # define CURL_PULL_SYS_TYPES_H 1 407 | # define CURL_PULL_SYS_SOCKET_H 1 408 | # endif 409 | 410 | #elif defined(__MVS__) 411 | # if defined(__IBMC__) || defined(__IBMCPP__) 412 | # if defined(_ILP32) 413 | # define CURL_SIZEOF_LONG 4 414 | # elif defined(_LP64) 415 | # define CURL_SIZEOF_LONG 8 416 | # endif 417 | # if defined(_LONG_LONG) 418 | # define CURL_TYPEOF_CURL_OFF_T long long 419 | # define CURL_FORMAT_CURL_OFF_T "lld" 420 | # define CURL_FORMAT_CURL_OFF_TU "llu" 421 | # define CURL_FORMAT_OFF_T "%lld" 422 | # define CURL_SIZEOF_CURL_OFF_T 8 423 | # define CURL_SUFFIX_CURL_OFF_T LL 424 | # define CURL_SUFFIX_CURL_OFF_TU ULL 425 | # elif defined(_LP64) 426 | # define CURL_TYPEOF_CURL_OFF_T long 427 | # define CURL_FORMAT_CURL_OFF_T "ld" 428 | # define CURL_FORMAT_CURL_OFF_TU "lu" 429 | # define CURL_FORMAT_OFF_T "%ld" 430 | # define CURL_SIZEOF_CURL_OFF_T 8 431 | # define CURL_SUFFIX_CURL_OFF_T L 432 | # define CURL_SUFFIX_CURL_OFF_TU UL 433 | # else 434 | # define CURL_TYPEOF_CURL_OFF_T long 435 | # define CURL_FORMAT_CURL_OFF_T "ld" 436 | # define CURL_FORMAT_CURL_OFF_TU "lu" 437 | # define CURL_FORMAT_OFF_T "%ld" 438 | # define CURL_SIZEOF_CURL_OFF_T 4 439 | # define CURL_SUFFIX_CURL_OFF_T L 440 | # define CURL_SUFFIX_CURL_OFF_TU UL 441 | # endif 442 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 443 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 444 | # define CURL_PULL_SYS_TYPES_H 1 445 | # define CURL_PULL_SYS_SOCKET_H 1 446 | # endif 447 | 448 | #elif defined(__370__) 449 | # if defined(__IBMC__) || defined(__IBMCPP__) 450 | # if defined(_ILP32) 451 | # define CURL_SIZEOF_LONG 4 452 | # elif defined(_LP64) 453 | # define CURL_SIZEOF_LONG 8 454 | # endif 455 | # if defined(_LONG_LONG) 456 | # define CURL_TYPEOF_CURL_OFF_T long long 457 | # define CURL_FORMAT_CURL_OFF_T "lld" 458 | # define CURL_FORMAT_CURL_OFF_TU "llu" 459 | # define CURL_FORMAT_OFF_T "%lld" 460 | # define CURL_SIZEOF_CURL_OFF_T 8 461 | # define CURL_SUFFIX_CURL_OFF_T LL 462 | # define CURL_SUFFIX_CURL_OFF_TU ULL 463 | # elif defined(_LP64) 464 | # define CURL_TYPEOF_CURL_OFF_T long 465 | # define CURL_FORMAT_CURL_OFF_T "ld" 466 | # define CURL_FORMAT_CURL_OFF_TU "lu" 467 | # define CURL_FORMAT_OFF_T "%ld" 468 | # define CURL_SIZEOF_CURL_OFF_T 8 469 | # define CURL_SUFFIX_CURL_OFF_T L 470 | # define CURL_SUFFIX_CURL_OFF_TU UL 471 | # else 472 | # define CURL_TYPEOF_CURL_OFF_T long 473 | # define CURL_FORMAT_CURL_OFF_T "ld" 474 | # define CURL_FORMAT_CURL_OFF_TU "lu" 475 | # define CURL_FORMAT_OFF_T "%ld" 476 | # define CURL_SIZEOF_CURL_OFF_T 4 477 | # define CURL_SUFFIX_CURL_OFF_T L 478 | # define CURL_SUFFIX_CURL_OFF_TU UL 479 | # endif 480 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 481 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 482 | # define CURL_PULL_SYS_TYPES_H 1 483 | # define CURL_PULL_SYS_SOCKET_H 1 484 | # endif 485 | 486 | #elif defined(TPF) 487 | # define CURL_SIZEOF_LONG 8 488 | # define CURL_TYPEOF_CURL_OFF_T long 489 | # define CURL_FORMAT_CURL_OFF_T "ld" 490 | # define CURL_FORMAT_CURL_OFF_TU "lu" 491 | # define CURL_FORMAT_OFF_T "%ld" 492 | # define CURL_SIZEOF_CURL_OFF_T 8 493 | # define CURL_SUFFIX_CURL_OFF_T L 494 | # define CURL_SUFFIX_CURL_OFF_TU UL 495 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 496 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 497 | 498 | /* ===================================== */ 499 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 500 | /* ===================================== */ 501 | 502 | #elif defined(_MSC_VER) 503 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 504 | # define CURL_SIZEOF_LONG 4 505 | # define CURL_TYPEOF_CURL_OFF_T __int64 506 | # define CURL_FORMAT_CURL_OFF_T "I64d" 507 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 508 | # define CURL_FORMAT_OFF_T "%I64d" 509 | # define CURL_SIZEOF_CURL_OFF_T 8 510 | # define CURL_SUFFIX_CURL_OFF_T i64 511 | # define CURL_SUFFIX_CURL_OFF_TU ui64 512 | # else 513 | # define CURL_SIZEOF_LONG 4 514 | # define CURL_TYPEOF_CURL_OFF_T long 515 | # define CURL_FORMAT_CURL_OFF_T "ld" 516 | # define CURL_FORMAT_CURL_OFF_TU "lu" 517 | # define CURL_FORMAT_OFF_T "%ld" 518 | # define CURL_SIZEOF_CURL_OFF_T 4 519 | # define CURL_SUFFIX_CURL_OFF_T L 520 | # define CURL_SUFFIX_CURL_OFF_TU UL 521 | # endif 522 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 523 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 524 | 525 | /* ===================================== */ 526 | /* KEEP GENERIC GCC THE LAST ENTRY */ 527 | /* ===================================== */ 528 | 529 | #elif defined(__GNUC__) 530 | # if defined(__ILP32__) || \ 531 | defined(__i386__) || defined(__ppc__) || defined(__arm__) || defined(__sparc__) 532 | # define CURL_SIZEOF_LONG 4 533 | # define CURL_TYPEOF_CURL_OFF_T long long 534 | # define CURL_FORMAT_CURL_OFF_T "lld" 535 | # define CURL_FORMAT_CURL_OFF_TU "llu" 536 | # define CURL_FORMAT_OFF_T "%lld" 537 | # define CURL_SIZEOF_CURL_OFF_T 8 538 | # define CURL_SUFFIX_CURL_OFF_T LL 539 | # define CURL_SUFFIX_CURL_OFF_TU ULL 540 | # elif defined(__LP64__) || \ 541 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) 542 | # define CURL_SIZEOF_LONG 8 543 | # define CURL_TYPEOF_CURL_OFF_T long 544 | # define CURL_FORMAT_CURL_OFF_T "ld" 545 | # define CURL_FORMAT_CURL_OFF_TU "lu" 546 | # define CURL_FORMAT_OFF_T "%ld" 547 | # define CURL_SIZEOF_CURL_OFF_T 8 548 | # define CURL_SUFFIX_CURL_OFF_T L 549 | # define CURL_SUFFIX_CURL_OFF_TU UL 550 | # endif 551 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 552 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 553 | # define CURL_PULL_SYS_TYPES_H 1 554 | # define CURL_PULL_SYS_SOCKET_H 1 555 | 556 | #else 557 | # error "Unknown non-configure build target!" 558 | Error Compilation_aborted_Unknown_non_configure_build_target 559 | #endif 560 | 561 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 562 | /* sys/types.h is required here to properly make type definitions below. */ 563 | #ifdef CURL_PULL_SYS_TYPES_H 564 | # include 565 | #endif 566 | 567 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 568 | /* sys/socket.h is required here to properly make type definitions below. */ 569 | #ifdef CURL_PULL_SYS_SOCKET_H 570 | # include 571 | #endif 572 | 573 | /* Data type definition of curl_socklen_t. */ 574 | 575 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 576 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 577 | #endif 578 | 579 | /* Data type definition of curl_off_t. */ 580 | 581 | #ifdef CURL_TYPEOF_CURL_OFF_T 582 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 583 | #endif 584 | 585 | #endif /* __CURL_CURLBUILD_H */ 586 | -------------------------------------------------------------------------------- /HttpClient/include/curl/curlrules.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLRULES_H 2 | #define __CURL_CURLRULES_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* ================================================================ */ 26 | /* COMPILE TIME SANITY CHECKS */ 27 | /* ================================================================ */ 28 | 29 | /* 30 | * NOTE 1: 31 | * ------- 32 | * 33 | * All checks done in this file are intentionally placed in a public 34 | * header file which is pulled by curl/curl.h when an application is 35 | * being built using an already built libcurl library. Additionally 36 | * this file is also included and used when building the library. 37 | * 38 | * If compilation fails on this file it is certainly sure that the 39 | * problem is elsewhere. It could be a problem in the curlbuild.h 40 | * header file, or simply that you are using different compilation 41 | * settings than those used to build the library. 42 | * 43 | * Nothing in this file is intended to be modified or adjusted by the 44 | * curl library user nor by the curl library builder. 45 | * 46 | * Do not deactivate any check, these are done to make sure that the 47 | * library is properly built and used. 48 | * 49 | * You can find further help on the libcurl development mailing list: 50 | * http://cool.haxx.se/mailman/listinfo/curl-library/ 51 | * 52 | * NOTE 2 53 | * ------ 54 | * 55 | * Some of the following compile time checks are based on the fact 56 | * that the dimension of a constant array can not be a negative one. 57 | * In this way if the compile time verification fails, the compilation 58 | * will fail issuing an error. The error description wording is compiler 59 | * dependent but it will be quite similar to one of the following: 60 | * 61 | * "negative subscript or subscript is too large" 62 | * "array must have at least one element" 63 | * "-1 is an illegal array size" 64 | * "size of array is negative" 65 | * 66 | * If you are building an application which tries to use an already 67 | * built libcurl library and you are getting this kind of errors on 68 | * this file, it is a clear indication that there is a mismatch between 69 | * how the library was built and how you are trying to use it for your 70 | * application. Your already compiled or binary library provider is the 71 | * only one who can give you the details you need to properly use it. 72 | */ 73 | 74 | /* 75 | * Verify that some macros are actually defined. 76 | */ 77 | 78 | #ifndef CURL_SIZEOF_LONG 79 | # error "CURL_SIZEOF_LONG definition is missing!" 80 | Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing 81 | #endif 82 | 83 | #ifndef CURL_TYPEOF_CURL_SOCKLEN_T 84 | # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" 85 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing 86 | #endif 87 | 88 | #ifndef CURL_SIZEOF_CURL_SOCKLEN_T 89 | # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" 90 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing 91 | #endif 92 | 93 | #ifndef CURL_TYPEOF_CURL_OFF_T 94 | # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" 95 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing 96 | #endif 97 | 98 | #ifndef CURL_FORMAT_CURL_OFF_T 99 | # error "CURL_FORMAT_CURL_OFF_T definition is missing!" 100 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing 101 | #endif 102 | 103 | #ifndef CURL_FORMAT_CURL_OFF_TU 104 | # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" 105 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing 106 | #endif 107 | 108 | #ifndef CURL_FORMAT_OFF_T 109 | # error "CURL_FORMAT_OFF_T definition is missing!" 110 | Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing 111 | #endif 112 | 113 | #ifndef CURL_SIZEOF_CURL_OFF_T 114 | # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" 115 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing 116 | #endif 117 | 118 | #ifndef CURL_SUFFIX_CURL_OFF_T 119 | # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" 120 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing 121 | #endif 122 | 123 | #ifndef CURL_SUFFIX_CURL_OFF_TU 124 | # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" 125 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing 126 | #endif 127 | 128 | /* 129 | * Macros private to this header file. 130 | */ 131 | 132 | #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 133 | 134 | #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 135 | 136 | /* 137 | * Verify that the size previously defined and expected for long 138 | * is the same as the one reported by sizeof() at compile time. 139 | */ 140 | 141 | typedef char 142 | __curl_rule_01__ 143 | [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; 144 | 145 | /* 146 | * Verify that the size previously defined and expected for 147 | * curl_off_t is actually the the same as the one reported 148 | * by sizeof() at compile time. 149 | */ 150 | 151 | typedef char 152 | __curl_rule_02__ 153 | [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; 154 | 155 | /* 156 | * Verify at compile time that the size of curl_off_t as reported 157 | * by sizeof() is greater or equal than the one reported for long 158 | * for the current compilation. 159 | */ 160 | 161 | typedef char 162 | __curl_rule_03__ 163 | [CurlchkszGE(curl_off_t, long)]; 164 | 165 | /* 166 | * Verify that the size previously defined and expected for 167 | * curl_socklen_t is actually the the same as the one reported 168 | * by sizeof() at compile time. 169 | */ 170 | 171 | typedef char 172 | __curl_rule_04__ 173 | [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; 174 | 175 | /* 176 | * Verify at compile time that the size of curl_socklen_t as reported 177 | * by sizeof() is greater or equal than the one reported for int for 178 | * the current compilation. 179 | */ 180 | 181 | typedef char 182 | __curl_rule_05__ 183 | [CurlchkszGE(curl_socklen_t, int)]; 184 | 185 | /* ================================================================ */ 186 | /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ 187 | /* ================================================================ */ 188 | 189 | /* 190 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 191 | * these to be visible and exported by the external libcurl interface API, 192 | * while also making them visible to the library internals, simply including 193 | * curl_setup.h, without actually needing to include curl.h internally. 194 | * If some day this section would grow big enough, all this should be moved 195 | * to its own header file. 196 | */ 197 | 198 | /* 199 | * Figure out if we can use the ## preprocessor operator, which is supported 200 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 201 | * or __cplusplus so we need to carefully check for them too. 202 | */ 203 | 204 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 205 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 206 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 207 | defined(__ILEC400__) 208 | /* This compiler is believed to have an ISO compatible preprocessor */ 209 | #define CURL_ISOCPP 210 | #else 211 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 212 | #undef CURL_ISOCPP 213 | #endif 214 | 215 | /* 216 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 217 | */ 218 | 219 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 220 | # define __CURL_OFF_T_C_HLPR2(x) x 221 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) 222 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 223 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 224 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 225 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 226 | #else 227 | # ifdef CURL_ISOCPP 228 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 229 | # else 230 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 231 | # endif 232 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) 233 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 234 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 235 | #endif 236 | 237 | /* 238 | * Get rid of macros private to this header file. 239 | */ 240 | 241 | #undef CurlchkszEQ 242 | #undef CurlchkszGE 243 | 244 | /* 245 | * Get rid of macros not intended to exist beyond this point. 246 | */ 247 | 248 | #undef CURL_PULL_WS2TCPIP_H 249 | #undef CURL_PULL_SYS_TYPES_H 250 | #undef CURL_PULL_SYS_SOCKET_H 251 | #undef CURL_PULL_SYS_POLL_H 252 | #undef CURL_PULL_STDINT_H 253 | #undef CURL_PULL_INTTYPES_H 254 | 255 | #undef CURL_TYPEOF_CURL_SOCKLEN_T 256 | #undef CURL_TYPEOF_CURL_OFF_T 257 | 258 | #ifdef CURL_NO_OLDIES 259 | #undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ 260 | #endif 261 | 262 | #endif /* __CURL_CURLRULES_H */ 263 | -------------------------------------------------------------------------------- /HttpClient/include/curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLVER_H 2 | #define __CURL_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* This header file contains nothing but libcurl version info, generated by 26 | a script at release-time. This was made its own header file in 7.11.2 */ 27 | 28 | /* This is the global package copyright */ 29 | #define LIBCURL_COPYRIGHT "1996 - 2015 Daniel Stenberg, ." 30 | 31 | /* This is the version number of the libcurl package from which this header 32 | file origins: */ 33 | #define LIBCURL_VERSION "7.43.0" 34 | 35 | /* The numeric version number is also available "in parts" by using these 36 | defines: */ 37 | #define LIBCURL_VERSION_MAJOR 7 38 | #define LIBCURL_VERSION_MINOR 43 39 | #define LIBCURL_VERSION_PATCH 0 40 | 41 | /* This is the numeric version of the libcurl version number, meant for easier 42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will 43 | always follow this syntax: 44 | 45 | 0xXXYYZZ 46 | 47 | Where XX, YY and ZZ are the main version, release and patch numbers in 48 | hexadecimal (using 8 bits each). All three numbers are always represented 49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 50 | appears as "0x090b07". 51 | 52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 53 | and it is always a greater number in a more recent release. It makes 54 | comparisons with greater than and less than work. 55 | 56 | Note: This define is the full hex number and _does not_ use the 57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 58 | and needs it to contain the full number. 59 | */ 60 | #define LIBCURL_VERSION_NUM 0x072b00 61 | 62 | /* 63 | * This is the date and time when the full source package was created. The 64 | * timestamp is not stored in git, as the timestamp is properly set in the 65 | * tarballs by the maketgz script. 66 | * 67 | * The format of the date should follow this template: 68 | * 69 | * "Mon Feb 12 11:35:33 UTC 2007" 70 | */ 71 | #define LIBCURL_TIMESTAMP "Wed Jun 17 05:56:00 UTC 2015" 72 | 73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z) 74 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 76 | 77 | #endif /* __CURL_CURLVER_H */ 78 | -------------------------------------------------------------------------------- /HttpClient/include/curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_EASY_H 2 | #define __CURL_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | CURL_EXTERN CURL *curl_easy_init(void); 29 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 30 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 31 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 32 | 33 | /* 34 | * NAME curl_easy_getinfo() 35 | * 36 | * DESCRIPTION 37 | * 38 | * Request internal information from the curl session with this function. The 39 | * third argument MUST be a pointer to a long, a pointer to a char * or a 40 | * pointer to a double (as the documentation describes elsewhere). The data 41 | * pointed to will be filled in accordingly and can be relied upon only if the 42 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 43 | * performed transfer, all results from this function are undefined until the 44 | * transfer is completed. 45 | */ 46 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 47 | 48 | 49 | /* 50 | * NAME curl_easy_duphandle() 51 | * 52 | * DESCRIPTION 53 | * 54 | * Creates a new curl session handle with the same options set for the handle 55 | * passed in. Duplicating a handle could only be a matter of cloning data and 56 | * options, internal state info and things like persistent connections cannot 57 | * be transferred. It is useful in multithreaded applications when you can run 58 | * curl_easy_duphandle() for each new thread to avoid a series of identical 59 | * curl_easy_setopt() invokes in every thread. 60 | */ 61 | CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); 62 | 63 | /* 64 | * NAME curl_easy_reset() 65 | * 66 | * DESCRIPTION 67 | * 68 | * Re-initializes a CURL handle to the default values. This puts back the 69 | * handle to the same state as it was in when it was just created. 70 | * 71 | * It does keep: live connections, the Session ID cache, the DNS cache and the 72 | * cookies. 73 | */ 74 | CURL_EXTERN void curl_easy_reset(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_recv() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Receives data from the connected socket. Use after successful 82 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 83 | */ 84 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 85 | size_t *n); 86 | 87 | /* 88 | * NAME curl_easy_send() 89 | * 90 | * DESCRIPTION 91 | * 92 | * Sends data over the connected socket. Use after successful 93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 | */ 95 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 96 | size_t buflen, size_t *n); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /HttpClient/include/curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MPRINTF_H 2 | #define __CURL_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | #include /* needed for FILE */ 27 | 28 | #include "curl.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | CURL_EXTERN int curl_mprintf(const char *format, ...); 35 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 36 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 37 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 38 | const char *format, ...); 39 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 40 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 41 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 42 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 43 | const char *format, va_list args); 44 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 45 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 46 | 47 | #ifdef _MPRINTF_REPLACE 48 | # undef printf 49 | # undef fprintf 50 | # undef sprintf 51 | # undef vsprintf 52 | # undef snprintf 53 | # undef vprintf 54 | # undef vfprintf 55 | # undef vsnprintf 56 | # undef aprintf 57 | # undef vaprintf 58 | # define printf curl_mprintf 59 | # define fprintf curl_mfprintf 60 | # define sprintf curl_msprintf 61 | # define vsprintf curl_mvsprintf 62 | # define snprintf curl_msnprintf 63 | # define vprintf curl_mvprintf 64 | # define vfprintf curl_mvfprintf 65 | # define vsnprintf curl_mvsnprintf 66 | # define aprintf curl_maprintf 67 | # define vaprintf curl_mvaprintf 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif /* __CURL_MPRINTF_H */ 75 | -------------------------------------------------------------------------------- /HttpClient/include/curl/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MULTI_H 2 | #define __CURL_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | /* 25 | This is an "external" header file. Don't give away any internals here! 26 | 27 | GOALS 28 | 29 | o Enable a "pull" interface. The application that uses libcurl decides where 30 | and when to ask libcurl to get/send data. 31 | 32 | o Enable multiple simultaneous transfers in the same thread without making it 33 | complicated for the application. 34 | 35 | o Enable the application to select() on its own file descriptors and curl's 36 | file descriptors simultaneous easily. 37 | 38 | */ 39 | 40 | /* 41 | * This header file should not really need to include "curl.h" since curl.h 42 | * itself includes this file and we expect user applications to do #include 43 | * without the need for especially including multi.h. 44 | * 45 | * For some reason we added this include here at one point, and rather than to 46 | * break existing (wrongly written) libcurl applications, we leave it as-is 47 | * but with this warning attached. 48 | */ 49 | #include "curl.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | typedef void CURLM; 56 | 57 | typedef enum { 58 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 59 | curl_multi_socket*() soon */ 60 | CURLM_OK, 61 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 62 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 63 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 64 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 65 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 66 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 67 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 68 | attempted to get added - again */ 69 | CURLM_LAST 70 | } CURLMcode; 71 | 72 | /* just to make code nicer when using curl_multi_socket() you can now check 73 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 74 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 75 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 76 | 77 | /* bitmask bits for CURLMOPT_PIPELINING */ 78 | #define CURLPIPE_NOTHING 0L 79 | #define CURLPIPE_HTTP1 1L 80 | #define CURLPIPE_MULTIPLEX 2L 81 | 82 | typedef enum { 83 | CURLMSG_NONE, /* first, not used */ 84 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 85 | the CURLcode of the transfer */ 86 | CURLMSG_LAST /* last, not used */ 87 | } CURLMSG; 88 | 89 | struct CURLMsg { 90 | CURLMSG msg; /* what this message means */ 91 | CURL *easy_handle; /* the handle it concerns */ 92 | union { 93 | void *whatever; /* message-specific data */ 94 | CURLcode result; /* return code for transfer */ 95 | } data; 96 | }; 97 | typedef struct CURLMsg CURLMsg; 98 | 99 | /* Based on poll(2) structure and values. 100 | * We don't use pollfd and POLL* constants explicitly 101 | * to cover platforms without poll(). */ 102 | #define CURL_WAIT_POLLIN 0x0001 103 | #define CURL_WAIT_POLLPRI 0x0002 104 | #define CURL_WAIT_POLLOUT 0x0004 105 | 106 | struct curl_waitfd { 107 | curl_socket_t fd; 108 | short events; 109 | short revents; /* not supported yet */ 110 | }; 111 | 112 | /* 113 | * Name: curl_multi_init() 114 | * 115 | * Desc: inititalize multi-style curl usage 116 | * 117 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 118 | */ 119 | CURL_EXTERN CURLM *curl_multi_init(void); 120 | 121 | /* 122 | * Name: curl_multi_add_handle() 123 | * 124 | * Desc: add a standard curl handle to the multi stack 125 | * 126 | * Returns: CURLMcode type, general multi error code. 127 | */ 128 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 129 | CURL *curl_handle); 130 | 131 | /* 132 | * Name: curl_multi_remove_handle() 133 | * 134 | * Desc: removes a curl handle from the multi stack again 135 | * 136 | * Returns: CURLMcode type, general multi error code. 137 | */ 138 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 139 | CURL *curl_handle); 140 | 141 | /* 142 | * Name: curl_multi_fdset() 143 | * 144 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 145 | * poll() on. We want curl_multi_perform() called as soon as one of 146 | * them are ready. 147 | * 148 | * Returns: CURLMcode type, general multi error code. 149 | */ 150 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 151 | fd_set *read_fd_set, 152 | fd_set *write_fd_set, 153 | fd_set *exc_fd_set, 154 | int *max_fd); 155 | 156 | /* 157 | * Name: curl_multi_wait() 158 | * 159 | * Desc: Poll on all fds within a CURLM set as well as any 160 | * additional fds passed to the function. 161 | * 162 | * Returns: CURLMcode type, general multi error code. 163 | */ 164 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 165 | struct curl_waitfd extra_fds[], 166 | unsigned int extra_nfds, 167 | int timeout_ms, 168 | int *ret); 169 | 170 | /* 171 | * Name: curl_multi_perform() 172 | * 173 | * Desc: When the app thinks there's data available for curl it calls this 174 | * function to read/write whatever there is right now. This returns 175 | * as soon as the reads and writes are done. This function does not 176 | * require that there actually is data available for reading or that 177 | * data can be written, it can be called just in case. It returns 178 | * the number of handles that still transfer data in the second 179 | * argument's integer-pointer. 180 | * 181 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 182 | * returns errors etc regarding the whole multi stack. There might 183 | * still have occurred problems on invidual transfers even when this 184 | * returns OK. 185 | */ 186 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 187 | int *running_handles); 188 | 189 | /* 190 | * Name: curl_multi_cleanup() 191 | * 192 | * Desc: Cleans up and removes a whole multi stack. It does not free or 193 | * touch any individual easy handles in any way. We need to define 194 | * in what state those handles will be if this function is called 195 | * in the middle of a transfer. 196 | * 197 | * Returns: CURLMcode type, general multi error code. 198 | */ 199 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 200 | 201 | /* 202 | * Name: curl_multi_info_read() 203 | * 204 | * Desc: Ask the multi handle if there's any messages/informationals from 205 | * the individual transfers. Messages include informationals such as 206 | * error code from the transfer or just the fact that a transfer is 207 | * completed. More details on these should be written down as well. 208 | * 209 | * Repeated calls to this function will return a new struct each 210 | * time, until a special "end of msgs" struct is returned as a signal 211 | * that there is no more to get at this point. 212 | * 213 | * The data the returned pointer points to will not survive calling 214 | * curl_multi_cleanup(). 215 | * 216 | * The 'CURLMsg' struct is meant to be very simple and only contain 217 | * very basic informations. If more involved information is wanted, 218 | * we will provide the particular "transfer handle" in that struct 219 | * and that should/could/would be used in subsequent 220 | * curl_easy_getinfo() calls (or similar). The point being that we 221 | * must never expose complex structs to applications, as then we'll 222 | * undoubtably get backwards compatibility problems in the future. 223 | * 224 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 225 | * of structs. It also writes the number of messages left in the 226 | * queue (after this read) in the integer the second argument points 227 | * to. 228 | */ 229 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 230 | int *msgs_in_queue); 231 | 232 | /* 233 | * Name: curl_multi_strerror() 234 | * 235 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 236 | * value into the equivalent human readable error string. This is 237 | * useful for printing meaningful error messages. 238 | * 239 | * Returns: A pointer to a zero-terminated error message. 240 | */ 241 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 242 | 243 | /* 244 | * Name: curl_multi_socket() and 245 | * curl_multi_socket_all() 246 | * 247 | * Desc: An alternative version of curl_multi_perform() that allows the 248 | * application to pass in one of the file descriptors that have been 249 | * detected to have "action" on them and let libcurl perform. 250 | * See man page for details. 251 | */ 252 | #define CURL_POLL_NONE 0 253 | #define CURL_POLL_IN 1 254 | #define CURL_POLL_OUT 2 255 | #define CURL_POLL_INOUT 3 256 | #define CURL_POLL_REMOVE 4 257 | 258 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 259 | 260 | #define CURL_CSELECT_IN 0x01 261 | #define CURL_CSELECT_OUT 0x02 262 | #define CURL_CSELECT_ERR 0x04 263 | 264 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 265 | curl_socket_t s, /* socket */ 266 | int what, /* see above */ 267 | void *userp, /* private callback 268 | pointer */ 269 | void *socketp); /* private socket 270 | pointer */ 271 | /* 272 | * Name: curl_multi_timer_callback 273 | * 274 | * Desc: Called by libcurl whenever the library detects a change in the 275 | * maximum number of milliseconds the app is allowed to wait before 276 | * curl_multi_socket() or curl_multi_perform() must be called 277 | * (to allow libcurl's timed events to take place). 278 | * 279 | * Returns: The callback should return zero. 280 | */ 281 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 282 | long timeout_ms, /* see above */ 283 | void *userp); /* private callback 284 | pointer */ 285 | 286 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 287 | int *running_handles); 288 | 289 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 290 | curl_socket_t s, 291 | int ev_bitmask, 292 | int *running_handles); 293 | 294 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 295 | int *running_handles); 296 | 297 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 298 | /* This macro below was added in 7.16.3 to push users who recompile to use 299 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 300 | */ 301 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 302 | #endif 303 | 304 | /* 305 | * Name: curl_multi_timeout() 306 | * 307 | * Desc: Returns the maximum number of milliseconds the app is allowed to 308 | * wait before curl_multi_socket() or curl_multi_perform() must be 309 | * called (to allow libcurl's timed events to take place). 310 | * 311 | * Returns: CURLM error code. 312 | */ 313 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 314 | long *milliseconds); 315 | 316 | #undef CINIT /* re-using the same name as in curl.h */ 317 | 318 | #ifdef CURL_ISOCPP 319 | #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num 320 | #else 321 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 322 | #define LONG CURLOPTTYPE_LONG 323 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT 324 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT 325 | #define OFF_T CURLOPTTYPE_OFF_T 326 | #define CINIT(name,type,number) CURLMOPT_/**/name = type + number 327 | #endif 328 | 329 | typedef enum { 330 | /* This is the socket callback function pointer */ 331 | CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), 332 | 333 | /* This is the argument passed to the socket callback */ 334 | CINIT(SOCKETDATA, OBJECTPOINT, 2), 335 | 336 | /* set to 1 to enable pipelining for this multi handle */ 337 | CINIT(PIPELINING, LONG, 3), 338 | 339 | /* This is the timer callback function pointer */ 340 | CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), 341 | 342 | /* This is the argument passed to the timer callback */ 343 | CINIT(TIMERDATA, OBJECTPOINT, 5), 344 | 345 | /* maximum number of entries in the connection cache */ 346 | CINIT(MAXCONNECTS, LONG, 6), 347 | 348 | /* maximum number of (pipelining) connections to one host */ 349 | CINIT(MAX_HOST_CONNECTIONS, LONG, 7), 350 | 351 | /* maximum number of requests in a pipeline */ 352 | CINIT(MAX_PIPELINE_LENGTH, LONG, 8), 353 | 354 | /* a connection with a content-length longer than this 355 | will not be considered for pipelining */ 356 | CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9), 357 | 358 | /* a connection with a chunk length longer than this 359 | will not be considered for pipelining */ 360 | CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10), 361 | 362 | /* a list of site names(+port) that are blacklisted from 363 | pipelining */ 364 | CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11), 365 | 366 | /* a list of server types that are blacklisted from 367 | pipelining */ 368 | CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12), 369 | 370 | /* maximum number of open connections in total */ 371 | CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13), 372 | 373 | CURLMOPT_LASTENTRY /* the last unused */ 374 | } CURLMoption; 375 | 376 | 377 | /* 378 | * Name: curl_multi_setopt() 379 | * 380 | * Desc: Sets options for the multi handle. 381 | * 382 | * Returns: CURLM error code. 383 | */ 384 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 385 | CURLMoption option, ...); 386 | 387 | 388 | /* 389 | * Name: curl_multi_assign() 390 | * 391 | * Desc: This function sets an association in the multi handle between the 392 | * given socket and a private pointer of the application. This is 393 | * (only) useful for curl_multi_socket uses. 394 | * 395 | * Returns: CURLM error code. 396 | */ 397 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 398 | curl_socket_t sockfd, void *sockp); 399 | 400 | #ifdef __cplusplus 401 | } /* end of extern "C" */ 402 | #endif 403 | 404 | #endif 405 | -------------------------------------------------------------------------------- /HttpClient/include/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDC_HEADERS_H 2 | #define __STDC_HEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread (void *, size_t, size_t, FILE *); 28 | size_t fwrite (const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* __STDC_HEADERS_H */ 34 | -------------------------------------------------------------------------------- /HttpClient/include/curl/typecheck-gcc.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_TYPECHECK_GCC_H 2 | #define __CURL_TYPECHECK_GCC_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* wraps curl_easy_setopt() with typechecking */ 26 | 27 | /* To add a new kind of warning, add an 28 | * if(_curl_is_sometype_option(_curl_opt)) 29 | * if(!_curl_is_sometype(value)) 30 | * _curl_easy_setopt_err_sometype(); 31 | * block and define _curl_is_sometype_option, _curl_is_sometype and 32 | * _curl_easy_setopt_err_sometype below 33 | * 34 | * NOTE: We use two nested 'if' statements here instead of the && operator, in 35 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x 36 | * when compiling with -Wlogical-op. 37 | * 38 | * To add an option that uses the same type as an existing option, you'll just 39 | * need to extend the appropriate _curl_*_option macro 40 | */ 41 | #define curl_easy_setopt(handle, option, value) \ 42 | __extension__ ({ \ 43 | __typeof__ (option) _curl_opt = option; \ 44 | if(__builtin_constant_p(_curl_opt)) { \ 45 | if(_curl_is_long_option(_curl_opt)) \ 46 | if(!_curl_is_long(value)) \ 47 | _curl_easy_setopt_err_long(); \ 48 | if(_curl_is_off_t_option(_curl_opt)) \ 49 | if(!_curl_is_off_t(value)) \ 50 | _curl_easy_setopt_err_curl_off_t(); \ 51 | if(_curl_is_string_option(_curl_opt)) \ 52 | if(!_curl_is_string(value)) \ 53 | _curl_easy_setopt_err_string(); \ 54 | if(_curl_is_write_cb_option(_curl_opt)) \ 55 | if(!_curl_is_write_cb(value)) \ 56 | _curl_easy_setopt_err_write_callback(); \ 57 | if((_curl_opt) == CURLOPT_READFUNCTION) \ 58 | if(!_curl_is_read_cb(value)) \ 59 | _curl_easy_setopt_err_read_cb(); \ 60 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ 61 | if(!_curl_is_ioctl_cb(value)) \ 62 | _curl_easy_setopt_err_ioctl_cb(); \ 63 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ 64 | if(!_curl_is_sockopt_cb(value)) \ 65 | _curl_easy_setopt_err_sockopt_cb(); \ 66 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ 67 | if(!_curl_is_opensocket_cb(value)) \ 68 | _curl_easy_setopt_err_opensocket_cb(); \ 69 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ 70 | if(!_curl_is_progress_cb(value)) \ 71 | _curl_easy_setopt_err_progress_cb(); \ 72 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ 73 | if(!_curl_is_debug_cb(value)) \ 74 | _curl_easy_setopt_err_debug_cb(); \ 75 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ 76 | if(!_curl_is_ssl_ctx_cb(value)) \ 77 | _curl_easy_setopt_err_ssl_ctx_cb(); \ 78 | if(_curl_is_conv_cb_option(_curl_opt)) \ 79 | if(!_curl_is_conv_cb(value)) \ 80 | _curl_easy_setopt_err_conv_cb(); \ 81 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ 82 | if(!_curl_is_seek_cb(value)) \ 83 | _curl_easy_setopt_err_seek_cb(); \ 84 | if(_curl_is_cb_data_option(_curl_opt)) \ 85 | if(!_curl_is_cb_data(value)) \ 86 | _curl_easy_setopt_err_cb_data(); \ 87 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \ 88 | if(!_curl_is_error_buffer(value)) \ 89 | _curl_easy_setopt_err_error_buffer(); \ 90 | if((_curl_opt) == CURLOPT_STDERR) \ 91 | if(!_curl_is_FILE(value)) \ 92 | _curl_easy_setopt_err_FILE(); \ 93 | if(_curl_is_postfields_option(_curl_opt)) \ 94 | if(!_curl_is_postfields(value)) \ 95 | _curl_easy_setopt_err_postfields(); \ 96 | if((_curl_opt) == CURLOPT_HTTPPOST) \ 97 | if(!_curl_is_arr((value), struct curl_httppost)) \ 98 | _curl_easy_setopt_err_curl_httpost(); \ 99 | if(_curl_is_slist_option(_curl_opt)) \ 100 | if(!_curl_is_arr((value), struct curl_slist)) \ 101 | _curl_easy_setopt_err_curl_slist(); \ 102 | if((_curl_opt) == CURLOPT_SHARE) \ 103 | if(!_curl_is_ptr((value), CURLSH)) \ 104 | _curl_easy_setopt_err_CURLSH(); \ 105 | } \ 106 | curl_easy_setopt(handle, _curl_opt, value); \ 107 | }) 108 | 109 | /* wraps curl_easy_getinfo() with typechecking */ 110 | /* FIXME: don't allow const pointers */ 111 | #define curl_easy_getinfo(handle, info, arg) \ 112 | __extension__ ({ \ 113 | __typeof__ (info) _curl_info = info; \ 114 | if(__builtin_constant_p(_curl_info)) { \ 115 | if(_curl_is_string_info(_curl_info)) \ 116 | if(!_curl_is_arr((arg), char *)) \ 117 | _curl_easy_getinfo_err_string(); \ 118 | if(_curl_is_long_info(_curl_info)) \ 119 | if(!_curl_is_arr((arg), long)) \ 120 | _curl_easy_getinfo_err_long(); \ 121 | if(_curl_is_double_info(_curl_info)) \ 122 | if(!_curl_is_arr((arg), double)) \ 123 | _curl_easy_getinfo_err_double(); \ 124 | if(_curl_is_slist_info(_curl_info)) \ 125 | if(!_curl_is_arr((arg), struct curl_slist *)) \ 126 | _curl_easy_getinfo_err_curl_slist(); \ 127 | } \ 128 | curl_easy_getinfo(handle, _curl_info, arg); \ 129 | }) 130 | 131 | /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(), 132 | * for now just make sure that the functions are called with three 133 | * arguments 134 | */ 135 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 136 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 137 | 138 | 139 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err* 140 | * functions */ 141 | 142 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */ 143 | #define _CURL_WARNING(id, message) \ 144 | static void __attribute__((__warning__(message))) \ 145 | __attribute__((__unused__)) __attribute__((__noinline__)) \ 146 | id(void) { __asm__(""); } 147 | 148 | _CURL_WARNING(_curl_easy_setopt_err_long, 149 | "curl_easy_setopt expects a long argument for this option") 150 | _CURL_WARNING(_curl_easy_setopt_err_curl_off_t, 151 | "curl_easy_setopt expects a curl_off_t argument for this option") 152 | _CURL_WARNING(_curl_easy_setopt_err_string, 153 | "curl_easy_setopt expects a " 154 | "string (char* or char[]) argument for this option" 155 | ) 156 | _CURL_WARNING(_curl_easy_setopt_err_write_callback, 157 | "curl_easy_setopt expects a curl_write_callback argument for this option") 158 | _CURL_WARNING(_curl_easy_setopt_err_read_cb, 159 | "curl_easy_setopt expects a curl_read_callback argument for this option") 160 | _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, 161 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option") 162 | _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, 163 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option") 164 | _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, 165 | "curl_easy_setopt expects a " 166 | "curl_opensocket_callback argument for this option" 167 | ) 168 | _CURL_WARNING(_curl_easy_setopt_err_progress_cb, 169 | "curl_easy_setopt expects a curl_progress_callback argument for this option") 170 | _CURL_WARNING(_curl_easy_setopt_err_debug_cb, 171 | "curl_easy_setopt expects a curl_debug_callback argument for this option") 172 | _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, 173 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") 174 | _CURL_WARNING(_curl_easy_setopt_err_conv_cb, 175 | "curl_easy_setopt expects a curl_conv_callback argument for this option") 176 | _CURL_WARNING(_curl_easy_setopt_err_seek_cb, 177 | "curl_easy_setopt expects a curl_seek_callback argument for this option") 178 | _CURL_WARNING(_curl_easy_setopt_err_cb_data, 179 | "curl_easy_setopt expects a " 180 | "private data pointer as argument for this option") 181 | _CURL_WARNING(_curl_easy_setopt_err_error_buffer, 182 | "curl_easy_setopt expects a " 183 | "char buffer of CURL_ERROR_SIZE as argument for this option") 184 | _CURL_WARNING(_curl_easy_setopt_err_FILE, 185 | "curl_easy_setopt expects a FILE* argument for this option") 186 | _CURL_WARNING(_curl_easy_setopt_err_postfields, 187 | "curl_easy_setopt expects a void* or char* argument for this option") 188 | _CURL_WARNING(_curl_easy_setopt_err_curl_httpost, 189 | "curl_easy_setopt expects a struct curl_httppost* argument for this option") 190 | _CURL_WARNING(_curl_easy_setopt_err_curl_slist, 191 | "curl_easy_setopt expects a struct curl_slist* argument for this option") 192 | _CURL_WARNING(_curl_easy_setopt_err_CURLSH, 193 | "curl_easy_setopt expects a CURLSH* argument for this option") 194 | 195 | _CURL_WARNING(_curl_easy_getinfo_err_string, 196 | "curl_easy_getinfo expects a pointer to char * for this info") 197 | _CURL_WARNING(_curl_easy_getinfo_err_long, 198 | "curl_easy_getinfo expects a pointer to long for this info") 199 | _CURL_WARNING(_curl_easy_getinfo_err_double, 200 | "curl_easy_getinfo expects a pointer to double for this info") 201 | _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, 202 | "curl_easy_getinfo expects a pointer to struct curl_slist * for this info") 203 | 204 | /* groups of curl_easy_setops options that take the same type of argument */ 205 | 206 | /* To add a new option to one of the groups, just add 207 | * (option) == CURLOPT_SOMETHING 208 | * to the or-expression. If the option takes a long or curl_off_t, you don't 209 | * have to do anything 210 | */ 211 | 212 | /* evaluates to true if option takes a long argument */ 213 | #define _curl_is_long_option(option) \ 214 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) 215 | 216 | #define _curl_is_off_t_option(option) \ 217 | ((option) > CURLOPTTYPE_OFF_T) 218 | 219 | /* evaluates to true if option takes a char* argument */ 220 | #define _curl_is_string_option(option) \ 221 | ((option) == CURLOPT_URL || \ 222 | (option) == CURLOPT_PROXY || \ 223 | (option) == CURLOPT_INTERFACE || \ 224 | (option) == CURLOPT_NETRC_FILE || \ 225 | (option) == CURLOPT_USERPWD || \ 226 | (option) == CURLOPT_USERNAME || \ 227 | (option) == CURLOPT_PASSWORD || \ 228 | (option) == CURLOPT_PROXYUSERPWD || \ 229 | (option) == CURLOPT_PROXYUSERNAME || \ 230 | (option) == CURLOPT_PROXYPASSWORD || \ 231 | (option) == CURLOPT_NOPROXY || \ 232 | (option) == CURLOPT_ACCEPT_ENCODING || \ 233 | (option) == CURLOPT_REFERER || \ 234 | (option) == CURLOPT_USERAGENT || \ 235 | (option) == CURLOPT_COOKIE || \ 236 | (option) == CURLOPT_COOKIEFILE || \ 237 | (option) == CURLOPT_COOKIEJAR || \ 238 | (option) == CURLOPT_COOKIELIST || \ 239 | (option) == CURLOPT_FTPPORT || \ 240 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ 241 | (option) == CURLOPT_FTP_ACCOUNT || \ 242 | (option) == CURLOPT_RANGE || \ 243 | (option) == CURLOPT_CUSTOMREQUEST || \ 244 | (option) == CURLOPT_SSLCERT || \ 245 | (option) == CURLOPT_SSLCERTTYPE || \ 246 | (option) == CURLOPT_SSLKEY || \ 247 | (option) == CURLOPT_SSLKEYTYPE || \ 248 | (option) == CURLOPT_KEYPASSWD || \ 249 | (option) == CURLOPT_SSLENGINE || \ 250 | (option) == CURLOPT_CAINFO || \ 251 | (option) == CURLOPT_CAPATH || \ 252 | (option) == CURLOPT_RANDOM_FILE || \ 253 | (option) == CURLOPT_EGDSOCKET || \ 254 | (option) == CURLOPT_SSL_CIPHER_LIST || \ 255 | (option) == CURLOPT_KRBLEVEL || \ 256 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ 257 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ 258 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ 259 | (option) == CURLOPT_CRLFILE || \ 260 | (option) == CURLOPT_ISSUERCERT || \ 261 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ 262 | (option) == CURLOPT_SSH_KNOWNHOSTS || \ 263 | (option) == CURLOPT_MAIL_FROM || \ 264 | (option) == CURLOPT_RTSP_SESSION_ID || \ 265 | (option) == CURLOPT_RTSP_STREAM_URI || \ 266 | (option) == CURLOPT_RTSP_TRANSPORT || \ 267 | (option) == CURLOPT_XOAUTH2_BEARER || \ 268 | (option) == CURLOPT_DNS_SERVERS || \ 269 | (option) == CURLOPT_DNS_INTERFACE || \ 270 | (option) == CURLOPT_DNS_LOCAL_IP4 || \ 271 | (option) == CURLOPT_DNS_LOCAL_IP6 || \ 272 | (option) == CURLOPT_LOGIN_OPTIONS || \ 273 | (option) == CURLOPT_PROXY_SERVICE_NAME || \ 274 | (option) == CURLOPT_SERVICE_NAME || \ 275 | 0) 276 | 277 | /* evaluates to true if option takes a curl_write_callback argument */ 278 | #define _curl_is_write_cb_option(option) \ 279 | ((option) == CURLOPT_HEADERFUNCTION || \ 280 | (option) == CURLOPT_WRITEFUNCTION) 281 | 282 | /* evaluates to true if option takes a curl_conv_callback argument */ 283 | #define _curl_is_conv_cb_option(option) \ 284 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ 285 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ 286 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) 287 | 288 | /* evaluates to true if option takes a data argument to pass to a callback */ 289 | #define _curl_is_cb_data_option(option) \ 290 | ((option) == CURLOPT_WRITEDATA || \ 291 | (option) == CURLOPT_READDATA || \ 292 | (option) == CURLOPT_IOCTLDATA || \ 293 | (option) == CURLOPT_SOCKOPTDATA || \ 294 | (option) == CURLOPT_OPENSOCKETDATA || \ 295 | (option) == CURLOPT_PROGRESSDATA || \ 296 | (option) == CURLOPT_HEADERDATA || \ 297 | (option) == CURLOPT_DEBUGDATA || \ 298 | (option) == CURLOPT_SSL_CTX_DATA || \ 299 | (option) == CURLOPT_SEEKDATA || \ 300 | (option) == CURLOPT_PRIVATE || \ 301 | (option) == CURLOPT_SSH_KEYDATA || \ 302 | (option) == CURLOPT_INTERLEAVEDATA || \ 303 | (option) == CURLOPT_CHUNK_DATA || \ 304 | (option) == CURLOPT_FNMATCH_DATA || \ 305 | 0) 306 | 307 | /* evaluates to true if option takes a POST data argument (void* or char*) */ 308 | #define _curl_is_postfields_option(option) \ 309 | ((option) == CURLOPT_POSTFIELDS || \ 310 | (option) == CURLOPT_COPYPOSTFIELDS || \ 311 | 0) 312 | 313 | /* evaluates to true if option takes a struct curl_slist * argument */ 314 | #define _curl_is_slist_option(option) \ 315 | ((option) == CURLOPT_HTTPHEADER || \ 316 | (option) == CURLOPT_HTTP200ALIASES || \ 317 | (option) == CURLOPT_QUOTE || \ 318 | (option) == CURLOPT_POSTQUOTE || \ 319 | (option) == CURLOPT_PREQUOTE || \ 320 | (option) == CURLOPT_TELNETOPTIONS || \ 321 | (option) == CURLOPT_MAIL_RCPT || \ 322 | 0) 323 | 324 | /* groups of curl_easy_getinfo infos that take the same type of argument */ 325 | 326 | /* evaluates to true if info expects a pointer to char * argument */ 327 | #define _curl_is_string_info(info) \ 328 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) 329 | 330 | /* evaluates to true if info expects a pointer to long argument */ 331 | #define _curl_is_long_info(info) \ 332 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) 333 | 334 | /* evaluates to true if info expects a pointer to double argument */ 335 | #define _curl_is_double_info(info) \ 336 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) 337 | 338 | /* true if info expects a pointer to struct curl_slist * argument */ 339 | #define _curl_is_slist_info(info) \ 340 | (CURLINFO_SLIST < (info)) 341 | 342 | 343 | /* typecheck helpers -- check whether given expression has requested type*/ 344 | 345 | /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, 346 | * otherwise define a new macro. Search for __builtin_types_compatible_p 347 | * in the GCC manual. 348 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is 349 | * the actual expression passed to the curl_easy_setopt macro. This 350 | * means that you can only apply the sizeof and __typeof__ operators, no 351 | * == or whatsoever. 352 | */ 353 | 354 | /* XXX: should evaluate to true iff expr is a pointer */ 355 | #define _curl_is_any_ptr(expr) \ 356 | (sizeof(expr) == sizeof(void*)) 357 | 358 | /* evaluates to true if expr is NULL */ 359 | /* XXX: must not evaluate expr, so this check is not accurate */ 360 | #define _curl_is_NULL(expr) \ 361 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) 362 | 363 | /* evaluates to true if expr is type*, const type* or NULL */ 364 | #define _curl_is_ptr(expr, type) \ 365 | (_curl_is_NULL(expr) || \ 366 | __builtin_types_compatible_p(__typeof__(expr), type *) || \ 367 | __builtin_types_compatible_p(__typeof__(expr), const type *)) 368 | 369 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */ 370 | #define _curl_is_arr(expr, type) \ 371 | (_curl_is_ptr((expr), type) || \ 372 | __builtin_types_compatible_p(__typeof__(expr), type [])) 373 | 374 | /* evaluates to true if expr is a string */ 375 | #define _curl_is_string(expr) \ 376 | (_curl_is_arr((expr), char) || \ 377 | _curl_is_arr((expr), signed char) || \ 378 | _curl_is_arr((expr), unsigned char)) 379 | 380 | /* evaluates to true if expr is a long (no matter the signedness) 381 | * XXX: for now, int is also accepted (and therefore short and char, which 382 | * are promoted to int when passed to a variadic function) */ 383 | #define _curl_is_long(expr) \ 384 | (__builtin_types_compatible_p(__typeof__(expr), long) || \ 385 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \ 386 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ 387 | __builtin_types_compatible_p(__typeof__(expr), int) || \ 388 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \ 389 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ 390 | __builtin_types_compatible_p(__typeof__(expr), short) || \ 391 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \ 392 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ 393 | __builtin_types_compatible_p(__typeof__(expr), char) || \ 394 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \ 395 | __builtin_types_compatible_p(__typeof__(expr), unsigned char)) 396 | 397 | /* evaluates to true if expr is of type curl_off_t */ 398 | #define _curl_is_off_t(expr) \ 399 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) 400 | 401 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ 402 | /* XXX: also check size of an char[] array? */ 403 | #define _curl_is_error_buffer(expr) \ 404 | (_curl_is_NULL(expr) || \ 405 | __builtin_types_compatible_p(__typeof__(expr), char *) || \ 406 | __builtin_types_compatible_p(__typeof__(expr), char[])) 407 | 408 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */ 409 | #if 0 410 | #define _curl_is_cb_data(expr) \ 411 | (_curl_is_ptr((expr), void) || \ 412 | _curl_is_ptr((expr), FILE)) 413 | #else /* be less strict */ 414 | #define _curl_is_cb_data(expr) \ 415 | _curl_is_any_ptr(expr) 416 | #endif 417 | 418 | /* evaluates to true if expr is of type FILE* */ 419 | #define _curl_is_FILE(expr) \ 420 | (__builtin_types_compatible_p(__typeof__(expr), FILE *)) 421 | 422 | /* evaluates to true if expr can be passed as POST data (void* or char*) */ 423 | #define _curl_is_postfields(expr) \ 424 | (_curl_is_ptr((expr), void) || \ 425 | _curl_is_arr((expr), char)) 426 | 427 | /* FIXME: the whole callback checking is messy... 428 | * The idea is to tolerate char vs. void and const vs. not const 429 | * pointers in arguments at least 430 | */ 431 | /* helper: __builtin_types_compatible_p distinguishes between functions and 432 | * function pointers, hide it */ 433 | #define _curl_callback_compatible(func, type) \ 434 | (__builtin_types_compatible_p(__typeof__(func), type) || \ 435 | __builtin_types_compatible_p(__typeof__(func), type*)) 436 | 437 | /* evaluates to true if expr is of type curl_read_callback or "similar" */ 438 | #define _curl_is_read_cb(expr) \ 439 | (_curl_is_NULL(expr) || \ 440 | __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \ 441 | __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \ 442 | _curl_callback_compatible((expr), _curl_read_callback1) || \ 443 | _curl_callback_compatible((expr), _curl_read_callback2) || \ 444 | _curl_callback_compatible((expr), _curl_read_callback3) || \ 445 | _curl_callback_compatible((expr), _curl_read_callback4) || \ 446 | _curl_callback_compatible((expr), _curl_read_callback5) || \ 447 | _curl_callback_compatible((expr), _curl_read_callback6)) 448 | typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*); 449 | typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*); 450 | typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*); 451 | typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*); 452 | typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*); 453 | typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*); 454 | 455 | /* evaluates to true if expr is of type curl_write_callback or "similar" */ 456 | #define _curl_is_write_cb(expr) \ 457 | (_curl_is_read_cb(expr) || \ 458 | __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \ 459 | __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \ 460 | _curl_callback_compatible((expr), _curl_write_callback1) || \ 461 | _curl_callback_compatible((expr), _curl_write_callback2) || \ 462 | _curl_callback_compatible((expr), _curl_write_callback3) || \ 463 | _curl_callback_compatible((expr), _curl_write_callback4) || \ 464 | _curl_callback_compatible((expr), _curl_write_callback5) || \ 465 | _curl_callback_compatible((expr), _curl_write_callback6)) 466 | typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*); 467 | typedef size_t (_curl_write_callback2)(const char *, size_t, size_t, 468 | const void*); 469 | typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*); 470 | typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*); 471 | typedef size_t (_curl_write_callback5)(const void *, size_t, size_t, 472 | const void*); 473 | typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*); 474 | 475 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ 476 | #define _curl_is_ioctl_cb(expr) \ 477 | (_curl_is_NULL(expr) || \ 478 | __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \ 479 | _curl_callback_compatible((expr), _curl_ioctl_callback1) || \ 480 | _curl_callback_compatible((expr), _curl_ioctl_callback2) || \ 481 | _curl_callback_compatible((expr), _curl_ioctl_callback3) || \ 482 | _curl_callback_compatible((expr), _curl_ioctl_callback4)) 483 | typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*); 484 | typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*); 485 | typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*); 486 | typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*); 487 | 488 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ 489 | #define _curl_is_sockopt_cb(expr) \ 490 | (_curl_is_NULL(expr) || \ 491 | __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \ 492 | _curl_callback_compatible((expr), _curl_sockopt_callback1) || \ 493 | _curl_callback_compatible((expr), _curl_sockopt_callback2)) 494 | typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); 495 | typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, 496 | curlsocktype); 497 | 498 | /* evaluates to true if expr is of type curl_opensocket_callback or 499 | "similar" */ 500 | #define _curl_is_opensocket_cb(expr) \ 501 | (_curl_is_NULL(expr) || \ 502 | __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ 503 | _curl_callback_compatible((expr), _curl_opensocket_callback1) || \ 504 | _curl_callback_compatible((expr), _curl_opensocket_callback2) || \ 505 | _curl_callback_compatible((expr), _curl_opensocket_callback3) || \ 506 | _curl_callback_compatible((expr), _curl_opensocket_callback4)) 507 | typedef curl_socket_t (_curl_opensocket_callback1) 508 | (void *, curlsocktype, struct curl_sockaddr *); 509 | typedef curl_socket_t (_curl_opensocket_callback2) 510 | (void *, curlsocktype, const struct curl_sockaddr *); 511 | typedef curl_socket_t (_curl_opensocket_callback3) 512 | (const void *, curlsocktype, struct curl_sockaddr *); 513 | typedef curl_socket_t (_curl_opensocket_callback4) 514 | (const void *, curlsocktype, const struct curl_sockaddr *); 515 | 516 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */ 517 | #define _curl_is_progress_cb(expr) \ 518 | (_curl_is_NULL(expr) || \ 519 | __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \ 520 | _curl_callback_compatible((expr), _curl_progress_callback1) || \ 521 | _curl_callback_compatible((expr), _curl_progress_callback2)) 522 | typedef int (_curl_progress_callback1)(void *, 523 | double, double, double, double); 524 | typedef int (_curl_progress_callback2)(const void *, 525 | double, double, double, double); 526 | 527 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */ 528 | #define _curl_is_debug_cb(expr) \ 529 | (_curl_is_NULL(expr) || \ 530 | __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \ 531 | _curl_callback_compatible((expr), _curl_debug_callback1) || \ 532 | _curl_callback_compatible((expr), _curl_debug_callback2) || \ 533 | _curl_callback_compatible((expr), _curl_debug_callback3) || \ 534 | _curl_callback_compatible((expr), _curl_debug_callback4) || \ 535 | _curl_callback_compatible((expr), _curl_debug_callback5) || \ 536 | _curl_callback_compatible((expr), _curl_debug_callback6) || \ 537 | _curl_callback_compatible((expr), _curl_debug_callback7) || \ 538 | _curl_callback_compatible((expr), _curl_debug_callback8)) 539 | typedef int (_curl_debug_callback1) (CURL *, 540 | curl_infotype, char *, size_t, void *); 541 | typedef int (_curl_debug_callback2) (CURL *, 542 | curl_infotype, char *, size_t, const void *); 543 | typedef int (_curl_debug_callback3) (CURL *, 544 | curl_infotype, const char *, size_t, void *); 545 | typedef int (_curl_debug_callback4) (CURL *, 546 | curl_infotype, const char *, size_t, const void *); 547 | typedef int (_curl_debug_callback5) (CURL *, 548 | curl_infotype, unsigned char *, size_t, void *); 549 | typedef int (_curl_debug_callback6) (CURL *, 550 | curl_infotype, unsigned char *, size_t, const void *); 551 | typedef int (_curl_debug_callback7) (CURL *, 552 | curl_infotype, const unsigned char *, size_t, void *); 553 | typedef int (_curl_debug_callback8) (CURL *, 554 | curl_infotype, const unsigned char *, size_t, const void *); 555 | 556 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ 557 | /* this is getting even messier... */ 558 | #define _curl_is_ssl_ctx_cb(expr) \ 559 | (_curl_is_NULL(expr) || \ 560 | __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \ 561 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ 562 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ 563 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ 564 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ 565 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ 566 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ 567 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ 568 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) 569 | typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *); 570 | typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *); 571 | typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *); 572 | typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); 573 | #ifdef HEADER_SSL_H 574 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX 575 | * this will of course break if we're included before OpenSSL headers... 576 | */ 577 | typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); 578 | typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); 579 | typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); 580 | typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, 581 | const void *); 582 | #else 583 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; 584 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; 585 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; 586 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; 587 | #endif 588 | 589 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */ 590 | #define _curl_is_conv_cb(expr) \ 591 | (_curl_is_NULL(expr) || \ 592 | __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \ 593 | _curl_callback_compatible((expr), _curl_conv_callback1) || \ 594 | _curl_callback_compatible((expr), _curl_conv_callback2) || \ 595 | _curl_callback_compatible((expr), _curl_conv_callback3) || \ 596 | _curl_callback_compatible((expr), _curl_conv_callback4)) 597 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); 598 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); 599 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); 600 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); 601 | 602 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */ 603 | #define _curl_is_seek_cb(expr) \ 604 | (_curl_is_NULL(expr) || \ 605 | __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \ 606 | _curl_callback_compatible((expr), _curl_seek_callback1) || \ 607 | _curl_callback_compatible((expr), _curl_seek_callback2)) 608 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); 609 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); 610 | 611 | 612 | #endif /* __CURL_TYPECHECK_GCC_H */ 613 | -------------------------------------------------------------------------------- /HttpClient/lib/libcurl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailxy/HttpClient/97f63987ed9eee0651c3b52c475757b8cfa6a045/HttpClient/lib/libcurl.a -------------------------------------------------------------------------------- /HttpClient/lib/libcurl_a_md_vs2015_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sailxy/HttpClient/97f63987ed9eee0651c3b52c475757b8cfa6a045/HttpClient/lib/libcurl_a_md_vs2015_x86.lib -------------------------------------------------------------------------------- /HttpClient/main.cpp: -------------------------------------------------------------------------------- 1 | #include "include/HttpClient.h" 2 | 3 | void progress_callback(void *userdata, double download_speed, double remaining_time, double progress_percentage) 4 | { 5 | //qDebug()< 1024 * 1024 * 1024) 17 | { 18 | unit = "G"; 19 | download_speed /= 1024 * 1024 * 1024; 20 | } 21 | else if (download_speed > 1024 * 1024) 22 | { 23 | unit = "M"; 24 | download_speed /= 1024 * 1024; 25 | } 26 | else if (download_speed > 1024) 27 | { 28 | unit = "kB"; 29 | download_speed /= 1024; 30 | } 31 | 32 | char speedFormat[15] = { 0 }; 33 | char timeFormat[10] = { 0 }; 34 | char progressFormat[8] = { 0 }; 35 | 36 | #ifdef _WIN32 37 | sprintf_s(speedFormat, sizeof(speedFormat), "%.2f%s/s", download_speed, unit.c_str()); 38 | sprintf_s(timeFormat, sizeof(timeFormat), "%02d:%02d:%02d", hours, minutes, seconds); 39 | sprintf_s(progressFormat, sizeof(progressFormat), "%.2f", progress_percentage); 40 | #else 41 | sprintf(speedFormat, "%.2f%s/s", download_speed, unit.c_str()); 42 | sprintf(timeFormat, "%02d:%02d:%02d", hours, minutes, seconds); 43 | sprintf(progressFormat, "%.2f", progress_percentage); 44 | #endif 45 | 46 | //AnyClass *eg = static_cast(userdata); 47 | //eg->func(speedFormat, timeFormat, progressFormat); 48 | } 49 | 50 | int main() 51 | { 52 | HttpClient::getInstance()->HttpGet("http://speedtest.wdc01.softlayer.com/downloads/test10.zip", "test10.zip", NULL, NULL); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 zyu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HttpClient 2 | A cross platform Http client with libcurl. 3 | It can build on Windows, Mac OS and Linux. 4 | Support for the file download, support resume from the break-point. 5 | --------------------------------------------------------------------------------