├── .gitignore ├── LICENSE.md ├── Platanium.vcxproj ├── Platanium.vcxproj.filters ├── README.md ├── Resource.rc ├── curl.h ├── curlhooks.h ├── curlver.h ├── detver.h ├── dllmain.cpp ├── framework.h ├── manifest.rc ├── pch.cpp ├── pch.h ├── resource.h ├── system.h └── url.h /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.vspscc 94 | *.vssscc 95 | .builds 96 | *.pidb 97 | *.svclog 98 | *.scc 99 | 100 | # Chutzpah Test files 101 | _Chutzpah* 102 | 103 | # Visual C++ cache files 104 | ipch/ 105 | *.aps 106 | *.ncb 107 | *.opendb 108 | *.opensdf 109 | *.sdf 110 | *.cachefile 111 | *.VC.db 112 | *.VC.VC.opendb 113 | 114 | # Visual Studio profiler 115 | *.psess 116 | *.vsp 117 | *.vspx 118 | *.sap 119 | 120 | # Visual Studio Trace Files 121 | *.e2e 122 | 123 | # TFS 2012 Local Workspace 124 | $tf/ 125 | 126 | # Guidance Automation Toolkit 127 | *.gpState 128 | 129 | # ReSharper is a .NET coding add-in 130 | _ReSharper*/ 131 | *.[Rr]e[Ss]harper 132 | *.DotSettings.user 133 | 134 | # TeamCity is a build add-in 135 | _TeamCity* 136 | 137 | # DotCover is a Code Coverage Tool 138 | *.dotCover 139 | 140 | # AxoCover is a Code Coverage Tool 141 | .axoCover/* 142 | !.axoCover/settings.json 143 | 144 | # Coverlet is a free, cross platform Code Coverage Tool 145 | coverage*[.json, .xml, .info] 146 | 147 | # Visual Studio code coverage results 148 | *.coverage 149 | *.coveragexml 150 | 151 | # NCrunch 152 | _NCrunch_* 153 | .*crunch*.local.xml 154 | nCrunchTemp_* 155 | 156 | # MightyMoose 157 | *.mm.* 158 | AutoTest.Net/ 159 | 160 | # Web workbench (sass) 161 | .sass-cache/ 162 | 163 | # Installshield output folder 164 | [Ee]xpress/ 165 | 166 | # DocProject is a documentation generator add-in 167 | DocProject/buildhelp/ 168 | DocProject/Help/*.HxT 169 | DocProject/Help/*.HxC 170 | DocProject/Help/*.hhc 171 | DocProject/Help/*.hhk 172 | DocProject/Help/*.hhp 173 | DocProject/Help/Html2 174 | DocProject/Help/html 175 | 176 | # Click-Once directory 177 | publish/ 178 | 179 | # Publish Web Output 180 | *.[Pp]ublish.xml 181 | *.azurePubxml 182 | # Note: Comment the next line if you want to checkin your web deploy settings, 183 | # but database connection strings (with potential passwords) will be unencrypted 184 | *.pubxml 185 | *.publishproj 186 | 187 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 188 | # checkin your Azure Web App publish settings, but sensitive information contained 189 | # in these scripts will be unencrypted 190 | PublishScripts/ 191 | 192 | # NuGet Packages 193 | *.nupkg 194 | # NuGet Symbol Packages 195 | *.snupkg 196 | # The packages folder can be ignored because of Package Restore 197 | **/[Pp]ackages/* 198 | # except build/, which is used as an MSBuild target. 199 | !**/[Pp]ackages/build/ 200 | # Uncomment if necessary however generally it will be regenerated when needed 201 | #!**/[Pp]ackages/repositories.config 202 | # NuGet v3's project.json files produces more ignorable files 203 | *.nuget.props 204 | *.nuget.targets 205 | 206 | # Microsoft Azure Build Output 207 | csx/ 208 | *.build.csdef 209 | 210 | # Microsoft Azure Emulator 211 | ecf/ 212 | rcf/ 213 | 214 | # Windows Store app package directories and files 215 | AppPackages/ 216 | BundleArtifacts/ 217 | Package.StoreAssociation.xml 218 | _pkginfo.txt 219 | *.appx 220 | *.appxbundle 221 | *.appxupload 222 | 223 | # Visual Studio cache files 224 | # files ending in .cache can be ignored 225 | *.[Cc]ache 226 | # but keep track of directories ending in .cache 227 | !?*.[Cc]ache/ 228 | 229 | # Others 230 | ClientBin/ 231 | ~$* 232 | *~ 233 | *.dbmdl 234 | *.dbproj.schemaview 235 | *.jfm 236 | *.pfx 237 | *.publishsettings 238 | orleans.codegen.cs 239 | 240 | # Including strong name files can present a security risk 241 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 242 | #*.snk 243 | 244 | # Since there are multiple workflows, uncomment next line to ignore bower_components 245 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 246 | #bower_components/ 247 | 248 | # RIA/Silverlight projects 249 | Generated_Code/ 250 | 251 | # Backup & report files from converting an old project file 252 | # to a newer Visual Studio version. Backup files are not needed, 253 | # because we have git ;-) 254 | _UpgradeReport_Files/ 255 | Backup*/ 256 | UpgradeLog*.XML 257 | UpgradeLog*.htm 258 | ServiceFabricBackup/ 259 | *.rptproj.bak 260 | 261 | # SQL Server files 262 | *.mdf 263 | *.ldf 264 | *.ndf 265 | 266 | # Business Intelligence projects 267 | *.rdl.data 268 | *.bim.layout 269 | *.bim_*.settings 270 | *.rptproj.rsuser 271 | *- [Bb]ackup.rdl 272 | *- [Bb]ackup ([0-9]).rdl 273 | *- [Bb]ackup ([0-9][0-9]).rdl 274 | 275 | # Microsoft Fakes 276 | FakesAssemblies/ 277 | 278 | # GhostDoc plugin setting file 279 | *.GhostDoc.xml 280 | 281 | # Node.js Tools for Visual Studio 282 | .ntvs_analysis.dat 283 | node_modules/ 284 | 285 | # Visual Studio 6 build log 286 | *.plg 287 | 288 | # Visual Studio 6 workspace options file 289 | *.opt 290 | 291 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 292 | *.vbw 293 | 294 | # Visual Studio LightSwitch build output 295 | **/*.HTMLClient/GeneratedArtifacts 296 | **/*.DesktopClient/GeneratedArtifacts 297 | **/*.DesktopClient/ModelManifest.xml 298 | **/*.Server/GeneratedArtifacts 299 | **/*.Server/ModelManifest.xml 300 | _Pvt_Extensions 301 | 302 | # Paket dependency manager 303 | .paket/paket.exe 304 | paket-files/ 305 | 306 | # FAKE - F# Make 307 | .fake/ 308 | 309 | # CodeRush personal settings 310 | .cr/personal 311 | 312 | # Python Tools for Visual Studio (PTVS) 313 | __pycache__/ 314 | *.pyc 315 | 316 | # Cake - Uncomment if you are using it 317 | # tools/** 318 | # !tools/packages.config 319 | 320 | # Tabs Studio 321 | *.tss 322 | 323 | # Telerik's JustMock configuration file 324 | *.jmconfig 325 | 326 | # BizTalk build output 327 | *.btp.cs 328 | *.btm.cs 329 | *.odx.cs 330 | *.xsd.cs 331 | 332 | # OpenCover UI analysis results 333 | OpenCover/ 334 | 335 | # Azure Stream Analytics local run output 336 | ASALocalRun/ 337 | 338 | # MSBuild Binary and Structured Log 339 | *.binlog 340 | 341 | # NVidia Nsight GPU debugger configuration file 342 | *.nvuser 343 | 344 | # MFractors (Xamarin productivity tool) working folder 345 | .mfractor/ 346 | 347 | # Local History for Visual Studio 348 | .localhistory/ 349 | 350 | # BeatPulse healthcheck temp database 351 | healthchecksdb 352 | 353 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 354 | MigrationBackup/ 355 | 356 | # Ionide (cross platform F# VS Code tools) working folder 357 | .ionide/ 358 | 359 | # Fody - auto-generated XML schema 360 | FodyWeavers.xsd -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | [![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/) 2 | 3 | To the extent possible under law, [Aleks Margarian](https://github.com/WorkingRobot/Platanium) has waived all copyright and related or neighboring rights to Platanium. This work is published from: United States. 4 | 5 | **NOTICE: The libcurl headers (specifically files `curlver.h`, `system.h`, and `curl.h`) are NOT under the Public Domain. For those files, refer to the libcurl license [here](https://curl.haxx.se/docs/copyright.html).** -------------------------------------------------------------------------------- /Platanium.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | 16.0 15 | {DAAF5B8E-D234-4154-B5EB-DF0D7A02DFC3} 16 | Win32Proj 17 | Platanium 18 | 10.0 19 | Platanium 20 | 21 | 22 | 23 | DynamicLibrary 24 | true 25 | v142 26 | Unicode 27 | 28 | 29 | DynamicLibrary 30 | false 31 | v142 32 | true 33 | Unicode 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | true 49 | bin\Debug\ 50 | obj\Debug\ 51 | $(IncludePath) 52 | $(LibraryPath) 53 | 54 | 55 | false 56 | $(IncludePath) 57 | $(LibraryPath) 58 | bin\Release\ 59 | obj\Release\ 60 | 61 | 62 | 63 | Use 64 | Level3 65 | true 66 | _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 67 | true 68 | pch.h 69 | stdcpplatest 70 | 71 | 72 | Windows 73 | true 74 | false 75 | 76 | 77 | 78 | 79 | Use 80 | Level3 81 | true 82 | true 83 | true 84 | NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 85 | true 86 | pch.h 87 | %(AdditionalIncludeDirectories) 88 | stdcpplatest 89 | 90 | 91 | Windows 92 | true 93 | true 94 | true 95 | false 96 | %(AdditionalDependencies) 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Create 113 | Create 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /Platanium.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Platanium 2 | 3 | Just inject the DLL and set the host you wanna use. 4 | 5 | ## License 6 | 7 | [![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/) 8 | 9 | To the extent possible under law, [Aleks Margarian](https://github.com/WorkingRobot/Platanium) has waived all copyright and related or neighboring rights to Platanium. This work is published from: United States. 10 | 11 | **NOTICE: The libcurl headers (specifically files `curlver.h`, `system.h`, and `curl.h`) are NOT under the Public Domain. For those files, refer to the libcurl license [here](https://curl.haxx.se/docs/copyright.html).** -------------------------------------------------------------------------------- /Resource.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Version 51 | // 52 | 53 | VS_VERSION_INFO VERSIONINFO 54 | FILEVERSION 1,0,0,0 55 | PRODUCTVERSION 1,0,0,0 56 | FILEFLAGSMASK 0x3fL 57 | #ifdef _DEBUG 58 | FILEFLAGS 0x1L 59 | #else 60 | FILEFLAGS 0x0L 61 | #endif 62 | FILEOS 0x40004L 63 | FILETYPE 0x2L 64 | FILESUBTYPE 0x0L 65 | BEGIN 66 | BLOCK "StringFileInfo" 67 | BEGIN 68 | BLOCK "040904b0" 69 | BEGIN 70 | VALUE "CompanyName", "WorkingRobot" 71 | VALUE "FileDescription", "Platanium" 72 | VALUE "FileVersion", "1.0.0.0" 73 | VALUE "InternalName", "Platanium.dll" 74 | VALUE "LegalCopyright", "Platanium (c) by Aleks Margarian (WorkingRobot)" 75 | VALUE "OriginalFilename", "Platanium.dll" 76 | VALUE "ProductName", "Platanium" 77 | VALUE "ProductVersion", "1.0.0.0" 78 | END 79 | END 80 | BLOCK "VarFileInfo" 81 | BEGIN 82 | VALUE "Translation", 0x409, 1200 83 | END 84 | END 85 | 86 | #endif // English (United States) resources 87 | ///////////////////////////////////////////////////////////////////////////// 88 | 89 | 90 | 91 | #ifndef APSTUDIO_INVOKED 92 | ///////////////////////////////////////////////////////////////////////////// 93 | // 94 | // Generated from the TEXTINCLUDE 3 resource. 95 | // 96 | 97 | 98 | ///////////////////////////////////////////////////////////////////////////// 99 | #endif // not APSTUDIO_INVOKED 100 | 101 | -------------------------------------------------------------------------------- /curl.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURL_H 2 | #define __CURL_CURL_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2017, 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 https://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 | * https://curl.haxx.se/libcurl/ 28 | * 29 | * curl-library mailing list subscription and unsubscription web interface: 30 | * https://cool.haxx.se/mailman/listinfo/curl-library/ 31 | */ 32 | 33 | #ifdef CURL_NO_OLDIES 34 | #define CURL_STRICTER 35 | #endif 36 | 37 | #include "curlver.h" /* libcurl version defines */ 38 | #include "system.h" /* determine things run-time */ 39 | 40 | /* 41 | * Define WIN32 when build target is Win32 API 42 | */ 43 | 44 | #if (defined(_WIN32) || defined(__WIN32__)) && \ 45 | !defined(WIN32) && !defined(__SYMBIAN32__) 46 | #define WIN32 47 | #endif 48 | 49 | #include 50 | #include 51 | 52 | #if defined(__FreeBSD__) && (__FreeBSD__ >= 2) 53 | /* Needed for __FreeBSD_version symbol definition */ 54 | #include 55 | #endif 56 | 57 | /* The include stuff here below is mainly for time_t! */ 58 | #include 59 | #include 60 | 61 | #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) 62 | #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \ 63 | defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)) 64 | /* The check above prevents the winsock2 inclusion if winsock.h already was 65 | included, since they can't co-exist without problems */ 66 | #include 67 | #include 68 | #endif 69 | #endif 70 | 71 | /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish 72 | libc5-based Linux systems. Only include it on systems that are known to 73 | require it! */ 74 | #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ 75 | defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ 76 | defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ 77 | (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) 78 | #include 79 | #endif 80 | 81 | #if !defined(WIN32) && !defined(_WIN32_WCE) 82 | #include 83 | #endif 84 | 85 | #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) 86 | #include 87 | #endif 88 | 89 | #ifdef __BEOS__ 90 | #include 91 | #endif 92 | 93 | #ifdef __cplusplus 94 | extern "C" { 95 | #endif 96 | 97 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 98 | typedef struct Curl_easy CURL; 99 | typedef struct Curl_share CURLSH; 100 | #else 101 | typedef void CURL; 102 | typedef void CURLSH; 103 | #endif 104 | 105 | /* 106 | * libcurl external API function linkage decorations. 107 | */ 108 | 109 | #ifdef CURL_STATICLIB 110 | # define CURL_EXTERN 111 | #elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) 112 | # if defined(BUILDING_LIBCURL) 113 | # define CURL_EXTERN __declspec(dllexport) 114 | # else 115 | # define CURL_EXTERN __declspec(dllimport) 116 | # endif 117 | #elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS) 118 | # define CURL_EXTERN CURL_EXTERN_SYMBOL 119 | #else 120 | # define CURL_EXTERN 121 | #endif 122 | 123 | #ifndef curl_socket_typedef 124 | /* socket typedef */ 125 | #if defined(WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H) 126 | typedef SOCKET curl_socket_t; 127 | #define CURL_SOCKET_BAD INVALID_SOCKET 128 | #else 129 | typedef int curl_socket_t; 130 | #define CURL_SOCKET_BAD -1 131 | #endif 132 | #define curl_socket_typedef 133 | #endif /* curl_socket_typedef */ 134 | 135 | struct curl_httppost { 136 | struct curl_httppost *next; /* next entry in the list */ 137 | char *name; /* pointer to allocated name */ 138 | long namelength; /* length of name length */ 139 | char *contents; /* pointer to allocated data contents */ 140 | long contentslength; /* length of contents field, see also 141 | CURL_HTTPPOST_LARGE */ 142 | char *buffer; /* pointer to allocated buffer contents */ 143 | long bufferlength; /* length of buffer field */ 144 | char *contenttype; /* Content-Type */ 145 | struct curl_slist *contentheader; /* list of extra headers for this form */ 146 | struct curl_httppost *more; /* if one field name has more than one 147 | file, this link should link to following 148 | files */ 149 | long flags; /* as defined below */ 150 | 151 | /* specified content is a file name */ 152 | #define CURL_HTTPPOST_FILENAME (1<<0) 153 | /* specified content is a file name */ 154 | #define CURL_HTTPPOST_READFILE (1<<1) 155 | /* name is only stored pointer do not free in formfree */ 156 | #define CURL_HTTPPOST_PTRNAME (1<<2) 157 | /* contents is only stored pointer do not free in formfree */ 158 | #define CURL_HTTPPOST_PTRCONTENTS (1<<3) 159 | /* upload file from buffer */ 160 | #define CURL_HTTPPOST_BUFFER (1<<4) 161 | /* upload file from pointer contents */ 162 | #define CURL_HTTPPOST_PTRBUFFER (1<<5) 163 | /* upload file contents by using the regular read callback to get the data and 164 | pass the given pointer as custom pointer */ 165 | #define CURL_HTTPPOST_CALLBACK (1<<6) 166 | /* use size in 'contentlen', added in 7.46.0 */ 167 | #define CURL_HTTPPOST_LARGE (1<<7) 168 | 169 | char *showfilename; /* The file name to show. If not set, the 170 | actual file name will be used (if this 171 | is a file part) */ 172 | void *userp; /* custom pointer used for 173 | HTTPPOST_CALLBACK posts */ 174 | curl_off_t contentlen; /* alternative length of contents 175 | field. Used if CURL_HTTPPOST_LARGE is 176 | set. Added in 7.46.0 */ 177 | }; 178 | 179 | /* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered 180 | deprecated but was the only choice up until 7.31.0 */ 181 | typedef int (*curl_progress_callback)(void *clientp, 182 | double dltotal, 183 | double dlnow, 184 | double ultotal, 185 | double ulnow); 186 | 187 | /* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in 188 | 7.32.0, it avoids floating point and provides more detailed information. */ 189 | typedef int (*curl_xferinfo_callback)(void *clientp, 190 | curl_off_t dltotal, 191 | curl_off_t dlnow, 192 | curl_off_t ultotal, 193 | curl_off_t ulnow); 194 | 195 | #ifndef CURL_MAX_READ_SIZE 196 | /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */ 197 | #define CURL_MAX_READ_SIZE 524288 198 | #endif 199 | 200 | #ifndef CURL_MAX_WRITE_SIZE 201 | /* Tests have proven that 20K is a very bad buffer size for uploads on 202 | Windows, while 16K for some odd reason performed a lot better. 203 | We do the ifndef check to allow this value to easier be changed at build 204 | time for those who feel adventurous. The practical minimum is about 205 | 400 bytes since libcurl uses a buffer of this size as a scratch area 206 | (unrelated to network send operations). */ 207 | #define CURL_MAX_WRITE_SIZE 16384 208 | #endif 209 | 210 | #ifndef CURL_MAX_HTTP_HEADER 211 | /* The only reason to have a max limit for this is to avoid the risk of a bad 212 | server feeding libcurl with a never-ending header that will cause reallocs 213 | infinitely */ 214 | #define CURL_MAX_HTTP_HEADER (100*1024) 215 | #endif 216 | 217 | /* This is a magic return code for the write callback that, when returned, 218 | will signal libcurl to pause receiving on the current transfer. */ 219 | #define CURL_WRITEFUNC_PAUSE 0x10000001 220 | 221 | typedef size_t (*curl_write_callback)(char *buffer, 222 | size_t size, 223 | size_t nitems, 224 | void *outstream); 225 | 226 | 227 | 228 | /* enumeration of file types */ 229 | typedef enum { 230 | CURLFILETYPE_FILE = 0, 231 | CURLFILETYPE_DIRECTORY, 232 | CURLFILETYPE_SYMLINK, 233 | CURLFILETYPE_DEVICE_BLOCK, 234 | CURLFILETYPE_DEVICE_CHAR, 235 | CURLFILETYPE_NAMEDPIPE, 236 | CURLFILETYPE_SOCKET, 237 | CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ 238 | 239 | CURLFILETYPE_UNKNOWN /* should never occur */ 240 | } curlfiletype; 241 | 242 | #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) 243 | #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) 244 | #define CURLFINFOFLAG_KNOWN_TIME (1<<2) 245 | #define CURLFINFOFLAG_KNOWN_PERM (1<<3) 246 | #define CURLFINFOFLAG_KNOWN_UID (1<<4) 247 | #define CURLFINFOFLAG_KNOWN_GID (1<<5) 248 | #define CURLFINFOFLAG_KNOWN_SIZE (1<<6) 249 | #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) 250 | 251 | /* Content of this structure depends on information which is known and is 252 | achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man 253 | page for callbacks returning this structure -- some fields are mandatory, 254 | some others are optional. The FLAG field has special meaning. */ 255 | struct curl_fileinfo { 256 | char *filename; 257 | curlfiletype filetype; 258 | time_t time; 259 | unsigned int perm; 260 | int uid; 261 | int gid; 262 | curl_off_t size; 263 | long int hardlinks; 264 | 265 | struct { 266 | /* If some of these fields is not NULL, it is a pointer to b_data. */ 267 | char *time; 268 | char *perm; 269 | char *user; 270 | char *group; 271 | char *target; /* pointer to the target filename of a symlink */ 272 | } strings; 273 | 274 | unsigned int flags; 275 | 276 | /* used internally */ 277 | char *b_data; 278 | size_t b_size; 279 | size_t b_used; 280 | }; 281 | 282 | /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ 283 | #define CURL_CHUNK_BGN_FUNC_OK 0 284 | #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ 285 | #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ 286 | 287 | /* if splitting of data transfer is enabled, this callback is called before 288 | download of an individual chunk started. Note that parameter "remains" works 289 | only for FTP wildcard downloading (for now), otherwise is not used */ 290 | typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, 291 | void *ptr, 292 | int remains); 293 | 294 | /* return codes for CURLOPT_CHUNK_END_FUNCTION */ 295 | #define CURL_CHUNK_END_FUNC_OK 0 296 | #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ 297 | 298 | /* If splitting of data transfer is enabled this callback is called after 299 | download of an individual chunk finished. 300 | Note! After this callback was set then it have to be called FOR ALL chunks. 301 | Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. 302 | This is the reason why we don't need "transfer_info" parameter in this 303 | callback and we are not interested in "remains" parameter too. */ 304 | typedef long (*curl_chunk_end_callback)(void *ptr); 305 | 306 | /* return codes for FNMATCHFUNCTION */ 307 | #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ 308 | #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ 309 | #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ 310 | 311 | /* callback type for wildcard downloading pattern matching. If the 312 | string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ 313 | typedef int (*curl_fnmatch_callback)(void *ptr, 314 | const char *pattern, 315 | const char *string); 316 | 317 | /* These are the return codes for the seek callbacks */ 318 | #define CURL_SEEKFUNC_OK 0 319 | #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ 320 | #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so 321 | libcurl might try other means instead */ 322 | typedef int (*curl_seek_callback)(void *instream, 323 | curl_off_t offset, 324 | int origin); /* 'whence' */ 325 | 326 | /* This is a return code for the read callback that, when returned, will 327 | signal libcurl to immediately abort the current transfer. */ 328 | #define CURL_READFUNC_ABORT 0x10000000 329 | /* This is a return code for the read callback that, when returned, will 330 | signal libcurl to pause sending data on the current transfer. */ 331 | #define CURL_READFUNC_PAUSE 0x10000001 332 | 333 | typedef size_t (*curl_read_callback)(char *buffer, 334 | size_t size, 335 | size_t nitems, 336 | void *instream); 337 | 338 | typedef enum { 339 | CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ 340 | CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ 341 | CURLSOCKTYPE_LAST /* never use */ 342 | } curlsocktype; 343 | 344 | /* The return code from the sockopt_callback can signal information back 345 | to libcurl: */ 346 | #define CURL_SOCKOPT_OK 0 347 | #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return 348 | CURLE_ABORTED_BY_CALLBACK */ 349 | #define CURL_SOCKOPT_ALREADY_CONNECTED 2 350 | 351 | typedef int (*curl_sockopt_callback)(void *clientp, 352 | curl_socket_t curlfd, 353 | curlsocktype purpose); 354 | 355 | struct curl_sockaddr { 356 | int family; 357 | int socktype; 358 | int protocol; 359 | unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it 360 | turned really ugly and painful on the systems that 361 | lack this type */ 362 | struct sockaddr addr; 363 | }; 364 | 365 | typedef curl_socket_t 366 | (*curl_opensocket_callback)(void *clientp, 367 | curlsocktype purpose, 368 | struct curl_sockaddr *address); 369 | 370 | typedef int 371 | (*curl_closesocket_callback)(void *clientp, curl_socket_t item); 372 | 373 | typedef enum { 374 | CURLIOE_OK, /* I/O operation successful */ 375 | CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ 376 | CURLIOE_FAILRESTART, /* failed to restart the read */ 377 | CURLIOE_LAST /* never use */ 378 | } curlioerr; 379 | 380 | typedef enum { 381 | CURLIOCMD_NOP, /* no operation */ 382 | CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ 383 | CURLIOCMD_LAST /* never use */ 384 | } curliocmd; 385 | 386 | typedef curlioerr (*curl_ioctl_callback)(CURL *handle, 387 | int cmd, 388 | void *clientp); 389 | 390 | #ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS 391 | /* 392 | * The following typedef's are signatures of malloc, free, realloc, strdup and 393 | * calloc respectively. Function pointers of these types can be passed to the 394 | * curl_global_init_mem() function to set user defined memory management 395 | * callback routines. 396 | */ 397 | typedef void *(*curl_malloc_callback)(size_t size); 398 | typedef void (*curl_free_callback)(void *ptr); 399 | typedef void *(*curl_realloc_callback)(void *ptr, size_t size); 400 | typedef char *(*curl_strdup_callback)(const char *str); 401 | typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); 402 | 403 | #define CURL_DID_MEMORY_FUNC_TYPEDEFS 404 | #endif 405 | 406 | /* the kind of data that is passed to information_callback*/ 407 | typedef enum { 408 | CURLINFO_TEXT = 0, 409 | CURLINFO_HEADER_IN, /* 1 */ 410 | CURLINFO_HEADER_OUT, /* 2 */ 411 | CURLINFO_DATA_IN, /* 3 */ 412 | CURLINFO_DATA_OUT, /* 4 */ 413 | CURLINFO_SSL_DATA_IN, /* 5 */ 414 | CURLINFO_SSL_DATA_OUT, /* 6 */ 415 | CURLINFO_END 416 | } curl_infotype; 417 | 418 | typedef int (*curl_debug_callback) 419 | (CURL *handle, /* the handle/transfer this concerns */ 420 | curl_infotype type, /* what kind of data */ 421 | char *data, /* points to the data */ 422 | size_t size, /* size of the data pointed to */ 423 | void *userptr); /* whatever the user please */ 424 | 425 | /* All possible error codes from all sorts of curl functions. Future versions 426 | may return other values, stay prepared. 427 | 428 | Always add new return codes last. Never *EVER* remove any. The return 429 | codes must remain the same! 430 | */ 431 | 432 | typedef enum { 433 | CURLE_OK = 0, 434 | CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ 435 | CURLE_FAILED_INIT, /* 2 */ 436 | CURLE_URL_MALFORMAT, /* 3 */ 437 | CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for 438 | 7.17.0, reused in April 2011 for 7.21.5] */ 439 | CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ 440 | CURLE_COULDNT_RESOLVE_HOST, /* 6 */ 441 | CURLE_COULDNT_CONNECT, /* 7 */ 442 | CURLE_WEIRD_SERVER_REPLY, /* 8 */ 443 | CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server 444 | due to lack of access - when login fails 445 | this is not returned. */ 446 | CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for 447 | 7.15.4, reused in Dec 2011 for 7.24.0]*/ 448 | CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ 449 | CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server 450 | [was obsoleted in August 2007 for 7.17.0, 451 | reused in Dec 2011 for 7.24.0]*/ 452 | CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ 453 | CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ 454 | CURLE_FTP_CANT_GET_HOST, /* 15 */ 455 | CURLE_HTTP2, /* 16 - A problem in the http2 framing layer. 456 | [was obsoleted in August 2007 for 7.17.0, 457 | reused in July 2014 for 7.38.0] */ 458 | CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ 459 | CURLE_PARTIAL_FILE, /* 18 */ 460 | CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ 461 | CURLE_OBSOLETE20, /* 20 - NOT USED */ 462 | CURLE_QUOTE_ERROR, /* 21 - quote command failure */ 463 | CURLE_HTTP_RETURNED_ERROR, /* 22 */ 464 | CURLE_WRITE_ERROR, /* 23 */ 465 | CURLE_OBSOLETE24, /* 24 - NOT USED */ 466 | CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ 467 | CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ 468 | CURLE_OUT_OF_MEMORY, /* 27 */ 469 | /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error 470 | instead of a memory allocation error if CURL_DOES_CONVERSIONS 471 | is defined 472 | */ 473 | CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ 474 | CURLE_OBSOLETE29, /* 29 - NOT USED */ 475 | CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ 476 | CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ 477 | CURLE_OBSOLETE32, /* 32 - NOT USED */ 478 | CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ 479 | CURLE_HTTP_POST_ERROR, /* 34 */ 480 | CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ 481 | CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ 482 | CURLE_FILE_COULDNT_READ_FILE, /* 37 */ 483 | CURLE_LDAP_CANNOT_BIND, /* 38 */ 484 | CURLE_LDAP_SEARCH_FAILED, /* 39 */ 485 | CURLE_OBSOLETE40, /* 40 - NOT USED */ 486 | CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */ 487 | CURLE_ABORTED_BY_CALLBACK, /* 42 */ 488 | CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ 489 | CURLE_OBSOLETE44, /* 44 - NOT USED */ 490 | CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ 491 | CURLE_OBSOLETE46, /* 46 - NOT USED */ 492 | CURLE_TOO_MANY_REDIRECTS, /* 47 - catch endless re-direct loops */ 493 | CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ 494 | CURLE_TELNET_OPTION_SYNTAX, /* 49 - Malformed telnet option */ 495 | CURLE_OBSOLETE50, /* 50 - NOT USED */ 496 | CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint 497 | wasn't verified fine */ 498 | CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ 499 | CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ 500 | CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as 501 | default */ 502 | CURLE_SEND_ERROR, /* 55 - failed sending network data */ 503 | CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ 504 | CURLE_OBSOLETE57, /* 57 - NOT IN USE */ 505 | CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ 506 | CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ 507 | CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ 508 | CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ 509 | CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ 510 | CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ 511 | CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ 512 | CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind 513 | that failed */ 514 | CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ 515 | CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not 516 | accepted and we failed to login */ 517 | CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ 518 | CURLE_TFTP_PERM, /* 69 - permission problem on server */ 519 | CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ 520 | CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ 521 | CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ 522 | CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ 523 | CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ 524 | CURLE_CONV_FAILED, /* 75 - conversion failed */ 525 | CURLE_CONV_REQD, /* 76 - caller must register conversion 526 | callbacks using curl_easy_setopt options 527 | CURLOPT_CONV_FROM_NETWORK_FUNCTION, 528 | CURLOPT_CONV_TO_NETWORK_FUNCTION, and 529 | CURLOPT_CONV_FROM_UTF8_FUNCTION */ 530 | CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing 531 | or wrong format */ 532 | CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ 533 | CURLE_SSH, /* 79 - error from the SSH layer, somewhat 534 | generic so the error message will be of 535 | interest when this has happened */ 536 | 537 | CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL 538 | connection */ 539 | CURLE_AGAIN, /* 81 - socket is not ready for send/recv, 540 | wait till it's ready and try again (Added 541 | in 7.18.2) */ 542 | CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or 543 | wrong format (Added in 7.19.0) */ 544 | CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in 545 | 7.19.0) */ 546 | CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ 547 | CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ 548 | CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ 549 | CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ 550 | CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ 551 | CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the 552 | session will be queued */ 553 | CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not 554 | match */ 555 | CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */ 556 | CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer 557 | */ 558 | CURL_LAST /* never use! */ 559 | } CURLcode; 560 | 561 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 562 | the obsolete stuff removed! */ 563 | 564 | /* Previously obsolete error code re-used in 7.38.0 */ 565 | #define CURLE_OBSOLETE16 CURLE_HTTP2 566 | 567 | /* Previously obsolete error codes re-used in 7.24.0 */ 568 | #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED 569 | #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT 570 | 571 | /* compatibility with older names */ 572 | #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING 573 | #define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY 574 | 575 | /* The following were added in 7.21.5, April 2011 */ 576 | #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION 577 | 578 | /* The following were added in 7.17.1 */ 579 | /* These are scheduled to disappear by 2009 */ 580 | #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION 581 | 582 | /* The following were added in 7.17.0 */ 583 | /* These are scheduled to disappear by 2009 */ 584 | #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ 585 | #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 586 | #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 587 | #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 588 | #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 589 | #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 590 | #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 591 | #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 592 | #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 593 | #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 594 | #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 595 | #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 596 | #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN 597 | 598 | #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED 599 | #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE 600 | #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR 601 | #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL 602 | #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS 603 | #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR 604 | #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED 605 | 606 | /* The following were added earlier */ 607 | 608 | #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT 609 | 610 | #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR 611 | #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED 612 | #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED 613 | 614 | #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE 615 | #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME 616 | 617 | /* This was the error code 50 in 7.7.3 and a few earlier versions, this 618 | is no longer used by libcurl but is instead #defined here only to not 619 | make programs break */ 620 | #define CURLE_ALREADY_COMPLETE 99999 621 | 622 | /* Provide defines for really old option names */ 623 | #define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */ 624 | #define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */ 625 | #define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA 626 | 627 | /* Since long deprecated options with no code in the lib that does anything 628 | with them. */ 629 | #define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40 630 | #define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72 631 | 632 | #endif /*!CURL_NO_OLDIES*/ 633 | 634 | /* This prototype applies to all conversion callbacks */ 635 | typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); 636 | 637 | typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ 638 | void *ssl_ctx, /* actually an 639 | OpenSSL SSL_CTX */ 640 | void *userptr); 641 | 642 | typedef enum { 643 | CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use 644 | CONNECT HTTP/1.1 */ 645 | CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT 646 | HTTP/1.0 */ 647 | CURLPROXY_HTTPS = 2, /* added in 7.52.0 */ 648 | CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already 649 | in 7.10 */ 650 | CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ 651 | CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ 652 | CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the 653 | host name rather than the IP address. added 654 | in 7.18.0 */ 655 | } curl_proxytype; /* this enum was added in 7.10 */ 656 | 657 | /* 658 | * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: 659 | * 660 | * CURLAUTH_NONE - No HTTP authentication 661 | * CURLAUTH_BASIC - HTTP Basic authentication (default) 662 | * CURLAUTH_DIGEST - HTTP Digest authentication 663 | * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication 664 | * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated) 665 | * CURLAUTH_NTLM - HTTP NTLM authentication 666 | * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour 667 | * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper 668 | * CURLAUTH_ONLY - Use together with a single other type to force no 669 | * authentication or just that single type 670 | * CURLAUTH_ANY - All fine types set 671 | * CURLAUTH_ANYSAFE - All fine types except Basic 672 | */ 673 | 674 | #define CURLAUTH_NONE ((unsigned long)0) 675 | #define CURLAUTH_BASIC (((unsigned long)1)<<0) 676 | #define CURLAUTH_DIGEST (((unsigned long)1)<<1) 677 | #define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2) 678 | /* Deprecated since the advent of CURLAUTH_NEGOTIATE */ 679 | #define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE 680 | /* Used for CURLOPT_SOCKS5_AUTH to stay terminologically correct */ 681 | #define CURLAUTH_GSSAPI CURLAUTH_NEGOTIATE 682 | #define CURLAUTH_NTLM (((unsigned long)1)<<3) 683 | #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) 684 | #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) 685 | #define CURLAUTH_ONLY (((unsigned long)1)<<31) 686 | #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) 687 | #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) 688 | 689 | #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ 690 | #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ 691 | #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ 692 | #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ 693 | #define CURLSSH_AUTH_HOST (1<<2) /* host key files */ 694 | #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ 695 | #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */ 696 | #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY 697 | 698 | #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ 699 | #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ 700 | #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ 701 | 702 | #define CURL_ERROR_SIZE 256 703 | 704 | enum curl_khtype { 705 | CURLKHTYPE_UNKNOWN, 706 | CURLKHTYPE_RSA1, 707 | CURLKHTYPE_RSA, 708 | CURLKHTYPE_DSS 709 | }; 710 | 711 | struct curl_khkey { 712 | const char *key; /* points to a zero-terminated string encoded with base64 713 | if len is zero, otherwise to the "raw" data */ 714 | size_t len; 715 | enum curl_khtype keytype; 716 | }; 717 | 718 | /* this is the set of return values expected from the curl_sshkeycallback 719 | callback */ 720 | enum curl_khstat { 721 | CURLKHSTAT_FINE_ADD_TO_FILE, 722 | CURLKHSTAT_FINE, 723 | CURLKHSTAT_REJECT, /* reject the connection, return an error */ 724 | CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so 725 | this causes a CURLE_DEFER error but otherwise the 726 | connection will be left intact etc */ 727 | CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ 728 | }; 729 | 730 | /* this is the set of status codes pass in to the callback */ 731 | enum curl_khmatch { 732 | CURLKHMATCH_OK, /* match */ 733 | CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ 734 | CURLKHMATCH_MISSING, /* no matching host/key found */ 735 | CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ 736 | }; 737 | 738 | typedef int 739 | (*curl_sshkeycallback) (CURL *easy, /* easy handle */ 740 | const struct curl_khkey *knownkey, /* known */ 741 | const struct curl_khkey *foundkey, /* found */ 742 | enum curl_khmatch, /* libcurl's view on the keys */ 743 | void *clientp); /* custom pointer passed from app */ 744 | 745 | /* parameter for the CURLOPT_USE_SSL option */ 746 | typedef enum { 747 | CURLUSESSL_NONE, /* do not attempt to use SSL */ 748 | CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ 749 | CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ 750 | CURLUSESSL_ALL, /* SSL for all communication or fail */ 751 | CURLUSESSL_LAST /* not an option, never use */ 752 | } curl_usessl; 753 | 754 | /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ 755 | 756 | /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the 757 | name of improving interoperability with older servers. Some SSL libraries 758 | have introduced work-arounds for this flaw but those work-arounds sometimes 759 | make the SSL communication fail. To regain functionality with those broken 760 | servers, a user can this way allow the vulnerability back. */ 761 | #define CURLSSLOPT_ALLOW_BEAST (1<<0) 762 | 763 | /* - NO_REVOKE tells libcurl to disable certificate revocation checks for those 764 | SSL backends where such behavior is present. */ 765 | #define CURLSSLOPT_NO_REVOKE (1<<1) 766 | 767 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 768 | the obsolete stuff removed! */ 769 | 770 | /* Backwards compatibility with older names */ 771 | /* These are scheduled to disappear by 2009 */ 772 | 773 | #define CURLFTPSSL_NONE CURLUSESSL_NONE 774 | #define CURLFTPSSL_TRY CURLUSESSL_TRY 775 | #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL 776 | #define CURLFTPSSL_ALL CURLUSESSL_ALL 777 | #define CURLFTPSSL_LAST CURLUSESSL_LAST 778 | #define curl_ftpssl curl_usessl 779 | #endif /*!CURL_NO_OLDIES*/ 780 | 781 | /* parameter for the CURLOPT_FTP_SSL_CCC option */ 782 | typedef enum { 783 | CURLFTPSSL_CCC_NONE, /* do not send CCC */ 784 | CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ 785 | CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ 786 | CURLFTPSSL_CCC_LAST /* not an option, never use */ 787 | } curl_ftpccc; 788 | 789 | /* parameter for the CURLOPT_FTPSSLAUTH option */ 790 | typedef enum { 791 | CURLFTPAUTH_DEFAULT, /* let libcurl decide */ 792 | CURLFTPAUTH_SSL, /* use "AUTH SSL" */ 793 | CURLFTPAUTH_TLS, /* use "AUTH TLS" */ 794 | CURLFTPAUTH_LAST /* not an option, never use */ 795 | } curl_ftpauth; 796 | 797 | /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ 798 | typedef enum { 799 | CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ 800 | CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD 801 | again if MKD succeeded, for SFTP this does 802 | similar magic */ 803 | CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD 804 | again even if MKD failed! */ 805 | CURLFTP_CREATE_DIR_LAST /* not an option, never use */ 806 | } curl_ftpcreatedir; 807 | 808 | /* parameter for the CURLOPT_FTP_FILEMETHOD option */ 809 | typedef enum { 810 | CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ 811 | CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ 812 | CURLFTPMETHOD_NOCWD, /* no CWD at all */ 813 | CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ 814 | CURLFTPMETHOD_LAST /* not an option, never use */ 815 | } curl_ftpmethod; 816 | 817 | /* bitmask defines for CURLOPT_HEADEROPT */ 818 | #define CURLHEADER_UNIFIED 0 819 | #define CURLHEADER_SEPARATE (1<<0) 820 | 821 | /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ 822 | #define CURLPROTO_HTTP (1<<0) 823 | #define CURLPROTO_HTTPS (1<<1) 824 | #define CURLPROTO_FTP (1<<2) 825 | #define CURLPROTO_FTPS (1<<3) 826 | #define CURLPROTO_SCP (1<<4) 827 | #define CURLPROTO_SFTP (1<<5) 828 | #define CURLPROTO_TELNET (1<<6) 829 | #define CURLPROTO_LDAP (1<<7) 830 | #define CURLPROTO_LDAPS (1<<8) 831 | #define CURLPROTO_DICT (1<<9) 832 | #define CURLPROTO_FILE (1<<10) 833 | #define CURLPROTO_TFTP (1<<11) 834 | #define CURLPROTO_IMAP (1<<12) 835 | #define CURLPROTO_IMAPS (1<<13) 836 | #define CURLPROTO_POP3 (1<<14) 837 | #define CURLPROTO_POP3S (1<<15) 838 | #define CURLPROTO_SMTP (1<<16) 839 | #define CURLPROTO_SMTPS (1<<17) 840 | #define CURLPROTO_RTSP (1<<18) 841 | #define CURLPROTO_RTMP (1<<19) 842 | #define CURLPROTO_RTMPT (1<<20) 843 | #define CURLPROTO_RTMPE (1<<21) 844 | #define CURLPROTO_RTMPTE (1<<22) 845 | #define CURLPROTO_RTMPS (1<<23) 846 | #define CURLPROTO_RTMPTS (1<<24) 847 | #define CURLPROTO_GOPHER (1<<25) 848 | #define CURLPROTO_SMB (1<<26) 849 | #define CURLPROTO_SMBS (1<<27) 850 | #define CURLPROTO_ALL (~0) /* enable everything */ 851 | 852 | /* long may be 32 or 64 bits, but we should never depend on anything else 853 | but 32 */ 854 | #define CURLOPTTYPE_LONG 0 855 | #define CURLOPTTYPE_OBJECTPOINT 10000 856 | #define CURLOPTTYPE_STRINGPOINT 10000 857 | #define CURLOPTTYPE_FUNCTIONPOINT 20000 858 | #define CURLOPTTYPE_OFF_T 30000 859 | 860 | /* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the 861 | string options from the header file */ 862 | 863 | /* name is uppercase CURLOPT_, 864 | type is one of the defined CURLOPTTYPE_ 865 | number is unique identifier */ 866 | #ifdef CINIT 867 | #undef CINIT 868 | #endif 869 | 870 | #ifdef CURL_ISOCPP 871 | #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu 872 | #else 873 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 874 | #define LONG CURLOPTTYPE_LONG 875 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT 876 | #define STRINGPOINT CURLOPTTYPE_OBJECTPOINT 877 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT 878 | #define OFF_T CURLOPTTYPE_OFF_T 879 | #define CINIT(name,type,number) CURLOPT_/**/name = type + number 880 | #endif 881 | 882 | /* 883 | * This macro-mania below setups the CURLOPT_[what] enum, to be used with 884 | * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] 885 | * word. 886 | */ 887 | 888 | typedef enum { 889 | /* This is the FILE * or void * the regular output should be written to. */ 890 | CINIT(WRITEDATA, OBJECTPOINT, 1), 891 | 892 | /* The full URL to get/put */ 893 | CINIT(URL, STRINGPOINT, 2), 894 | 895 | /* Port number to connect to, if other than default. */ 896 | CINIT(PORT, LONG, 3), 897 | 898 | /* Name of proxy to use. */ 899 | CINIT(PROXY, STRINGPOINT, 4), 900 | 901 | /* "user:password;options" to use when fetching. */ 902 | CINIT(USERPWD, STRINGPOINT, 5), 903 | 904 | /* "user:password" to use with proxy. */ 905 | CINIT(PROXYUSERPWD, STRINGPOINT, 6), 906 | 907 | /* Range to get, specified as an ASCII string. */ 908 | CINIT(RANGE, STRINGPOINT, 7), 909 | 910 | /* not used */ 911 | 912 | /* Specified file stream to upload from (use as input): */ 913 | CINIT(READDATA, OBJECTPOINT, 9), 914 | 915 | /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE 916 | * bytes big. If this is not used, error messages go to stderr instead: */ 917 | CINIT(ERRORBUFFER, OBJECTPOINT, 10), 918 | 919 | /* Function that will be called to store the output (instead of fwrite). The 920 | * parameters will use fwrite() syntax, make sure to follow them. */ 921 | CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), 922 | 923 | /* Function that will be called to read the input (instead of fread). The 924 | * parameters will use fread() syntax, make sure to follow them. */ 925 | CINIT(READFUNCTION, FUNCTIONPOINT, 12), 926 | 927 | /* Time-out the read operation after this amount of seconds */ 928 | CINIT(TIMEOUT, LONG, 13), 929 | 930 | /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about 931 | * how large the file being sent really is. That allows better error 932 | * checking and better verifies that the upload was successful. -1 means 933 | * unknown size. 934 | * 935 | * For large file support, there is also a _LARGE version of the key 936 | * which takes an off_t type, allowing platforms with larger off_t 937 | * sizes to handle larger files. See below for INFILESIZE_LARGE. 938 | */ 939 | CINIT(INFILESIZE, LONG, 14), 940 | 941 | /* POST static input fields. */ 942 | CINIT(POSTFIELDS, OBJECTPOINT, 15), 943 | 944 | /* Set the referrer page (needed by some CGIs) */ 945 | CINIT(REFERER, STRINGPOINT, 16), 946 | 947 | /* Set the FTP PORT string (interface name, named or numerical IP address) 948 | Use i.e '-' to use default address. */ 949 | CINIT(FTPPORT, STRINGPOINT, 17), 950 | 951 | /* Set the User-Agent string (examined by some CGIs) */ 952 | CINIT(USERAGENT, STRINGPOINT, 18), 953 | 954 | /* If the download receives less than "low speed limit" bytes/second 955 | * during "low speed time" seconds, the operations is aborted. 956 | * You could i.e if you have a pretty high speed connection, abort if 957 | * it is less than 2000 bytes/sec during 20 seconds. 958 | */ 959 | 960 | /* Set the "low speed limit" */ 961 | CINIT(LOW_SPEED_LIMIT, LONG, 19), 962 | 963 | /* Set the "low speed time" */ 964 | CINIT(LOW_SPEED_TIME, LONG, 20), 965 | 966 | /* Set the continuation offset. 967 | * 968 | * Note there is also a _LARGE version of this key which uses 969 | * off_t types, allowing for large file offsets on platforms which 970 | * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. 971 | */ 972 | CINIT(RESUME_FROM, LONG, 21), 973 | 974 | /* Set cookie in request: */ 975 | CINIT(COOKIE, STRINGPOINT, 22), 976 | 977 | /* This points to a linked list of headers, struct curl_slist kind. This 978 | list is also used for RTSP (in spite of its name) */ 979 | CINIT(HTTPHEADER, OBJECTPOINT, 23), 980 | 981 | /* This points to a linked list of post entries, struct curl_httppost */ 982 | CINIT(HTTPPOST, OBJECTPOINT, 24), 983 | 984 | /* name of the file keeping your private SSL-certificate */ 985 | CINIT(SSLCERT, STRINGPOINT, 25), 986 | 987 | /* password for the SSL or SSH private key */ 988 | CINIT(KEYPASSWD, STRINGPOINT, 26), 989 | 990 | /* send TYPE parameter? */ 991 | CINIT(CRLF, LONG, 27), 992 | 993 | /* send linked-list of QUOTE commands */ 994 | CINIT(QUOTE, OBJECTPOINT, 28), 995 | 996 | /* send FILE * or void * to store headers to, if you use a callback it 997 | is simply passed to the callback unmodified */ 998 | CINIT(HEADERDATA, OBJECTPOINT, 29), 999 | 1000 | /* point to a file to read the initial cookies from, also enables 1001 | "cookie awareness" */ 1002 | CINIT(COOKIEFILE, STRINGPOINT, 31), 1003 | 1004 | /* What version to specifically try to use. 1005 | See CURL_SSLVERSION defines below. */ 1006 | CINIT(SSLVERSION, LONG, 32), 1007 | 1008 | /* What kind of HTTP time condition to use, see defines */ 1009 | CINIT(TIMECONDITION, LONG, 33), 1010 | 1011 | /* Time to use with the above condition. Specified in number of seconds 1012 | since 1 Jan 1970 */ 1013 | CINIT(TIMEVALUE, LONG, 34), 1014 | 1015 | /* 35 = OBSOLETE */ 1016 | 1017 | /* Custom request, for customizing the get command like 1018 | HTTP: DELETE, TRACE and others 1019 | FTP: to use a different list command 1020 | */ 1021 | CINIT(CUSTOMREQUEST, STRINGPOINT, 36), 1022 | 1023 | /* FILE handle to use instead of stderr */ 1024 | CINIT(STDERR, OBJECTPOINT, 37), 1025 | 1026 | /* 38 is not used */ 1027 | 1028 | /* send linked-list of post-transfer QUOTE commands */ 1029 | CINIT(POSTQUOTE, OBJECTPOINT, 39), 1030 | 1031 | CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */ 1032 | 1033 | CINIT(VERBOSE, LONG, 41), /* talk a lot */ 1034 | CINIT(HEADER, LONG, 42), /* throw the header out too */ 1035 | CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ 1036 | CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ 1037 | CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */ 1038 | CINIT(UPLOAD, LONG, 46), /* this is an upload */ 1039 | CINIT(POST, LONG, 47), /* HTTP POST method */ 1040 | CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ 1041 | 1042 | CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ 1043 | 1044 | /* Specify whether to read the user+password from the .netrc or the URL. 1045 | * This must be one of the CURL_NETRC_* enums below. */ 1046 | CINIT(NETRC, LONG, 51), 1047 | 1048 | CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ 1049 | 1050 | CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ 1051 | CINIT(PUT, LONG, 54), /* HTTP PUT */ 1052 | 1053 | /* 55 = OBSOLETE */ 1054 | 1055 | /* DEPRECATED 1056 | * Function that will be called instead of the internal progress display 1057 | * function. This function should be defined as the curl_progress_callback 1058 | * prototype defines. */ 1059 | CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), 1060 | 1061 | /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION 1062 | callbacks */ 1063 | CINIT(PROGRESSDATA, OBJECTPOINT, 57), 1064 | #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA 1065 | 1066 | /* We want the referrer field set automatically when following locations */ 1067 | CINIT(AUTOREFERER, LONG, 58), 1068 | 1069 | /* Port of the proxy, can be set in the proxy string as well with: 1070 | "[host]:[port]" */ 1071 | CINIT(PROXYPORT, LONG, 59), 1072 | 1073 | /* size of the POST input data, if strlen() is not good to use */ 1074 | CINIT(POSTFIELDSIZE, LONG, 60), 1075 | 1076 | /* tunnel non-http operations through a HTTP proxy */ 1077 | CINIT(HTTPPROXYTUNNEL, LONG, 61), 1078 | 1079 | /* Set the interface string to use as outgoing network interface */ 1080 | CINIT(INTERFACE, STRINGPOINT, 62), 1081 | 1082 | /* Set the krb4/5 security level, this also enables krb4/5 awareness. This 1083 | * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string 1084 | * is set but doesn't match one of these, 'private' will be used. */ 1085 | CINIT(KRBLEVEL, STRINGPOINT, 63), 1086 | 1087 | /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ 1088 | CINIT(SSL_VERIFYPEER, LONG, 64), 1089 | 1090 | /* The CApath or CAfile used to validate the peer certificate 1091 | this option is used only if SSL_VERIFYPEER is true */ 1092 | CINIT(CAINFO, STRINGPOINT, 65), 1093 | 1094 | /* 66 = OBSOLETE */ 1095 | /* 67 = OBSOLETE */ 1096 | 1097 | /* Maximum number of http redirects to follow */ 1098 | CINIT(MAXREDIRS, LONG, 68), 1099 | 1100 | /* Pass a long set to 1 to get the date of the requested document (if 1101 | possible)! Pass a zero to shut it off. */ 1102 | CINIT(FILETIME, LONG, 69), 1103 | 1104 | /* This points to a linked list of telnet options */ 1105 | CINIT(TELNETOPTIONS, OBJECTPOINT, 70), 1106 | 1107 | /* Max amount of cached alive connections */ 1108 | CINIT(MAXCONNECTS, LONG, 71), 1109 | 1110 | CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */ 1111 | 1112 | /* 73 = OBSOLETE */ 1113 | 1114 | /* Set to explicitly use a new connection for the upcoming transfer. 1115 | Do not use this unless you're absolutely sure of this, as it makes the 1116 | operation slower and is less friendly for the network. */ 1117 | CINIT(FRESH_CONNECT, LONG, 74), 1118 | 1119 | /* Set to explicitly forbid the upcoming transfer's connection to be re-used 1120 | when done. Do not use this unless you're absolutely sure of this, as it 1121 | makes the operation slower and is less friendly for the network. */ 1122 | CINIT(FORBID_REUSE, LONG, 75), 1123 | 1124 | /* Set to a file name that contains random data for libcurl to use to 1125 | seed the random engine when doing SSL connects. */ 1126 | CINIT(RANDOM_FILE, STRINGPOINT, 76), 1127 | 1128 | /* Set to the Entropy Gathering Daemon socket pathname */ 1129 | CINIT(EGDSOCKET, STRINGPOINT, 77), 1130 | 1131 | /* Time-out connect operations after this amount of seconds, if connects are 1132 | OK within this time, then fine... This only aborts the connect phase. */ 1133 | CINIT(CONNECTTIMEOUT, LONG, 78), 1134 | 1135 | /* Function that will be called to store headers (instead of fwrite). The 1136 | * parameters will use fwrite() syntax, make sure to follow them. */ 1137 | CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), 1138 | 1139 | /* Set this to force the HTTP request to get back to GET. Only really usable 1140 | if POST, PUT or a custom request have been used first. 1141 | */ 1142 | CINIT(HTTPGET, LONG, 80), 1143 | 1144 | /* Set if we should verify the Common name from the peer certificate in ssl 1145 | * handshake, set 1 to check existence, 2 to ensure that it matches the 1146 | * provided hostname. */ 1147 | CINIT(SSL_VERIFYHOST, LONG, 81), 1148 | 1149 | /* Specify which file name to write all known cookies in after completed 1150 | operation. Set file name to "-" (dash) to make it go to stdout. */ 1151 | CINIT(COOKIEJAR, STRINGPOINT, 82), 1152 | 1153 | /* Specify which SSL ciphers to use */ 1154 | CINIT(SSL_CIPHER_LIST, STRINGPOINT, 83), 1155 | 1156 | /* Specify which HTTP version to use! This must be set to one of the 1157 | CURL_HTTP_VERSION* enums set below. */ 1158 | CINIT(HTTP_VERSION, LONG, 84), 1159 | 1160 | /* Specifically switch on or off the FTP engine's use of the EPSV command. By 1161 | default, that one will always be attempted before the more traditional 1162 | PASV command. */ 1163 | CINIT(FTP_USE_EPSV, LONG, 85), 1164 | 1165 | /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ 1166 | CINIT(SSLCERTTYPE, STRINGPOINT, 86), 1167 | 1168 | /* name of the file keeping your private SSL-key */ 1169 | CINIT(SSLKEY, STRINGPOINT, 87), 1170 | 1171 | /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ 1172 | CINIT(SSLKEYTYPE, STRINGPOINT, 88), 1173 | 1174 | /* crypto engine for the SSL-sub system */ 1175 | CINIT(SSLENGINE, STRINGPOINT, 89), 1176 | 1177 | /* set the crypto engine for the SSL-sub system as default 1178 | the param has no meaning... 1179 | */ 1180 | CINIT(SSLENGINE_DEFAULT, LONG, 90), 1181 | 1182 | /* Non-zero value means to use the global dns cache */ 1183 | CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ 1184 | 1185 | /* DNS cache timeout */ 1186 | CINIT(DNS_CACHE_TIMEOUT, LONG, 92), 1187 | 1188 | /* send linked-list of pre-transfer QUOTE commands */ 1189 | CINIT(PREQUOTE, OBJECTPOINT, 93), 1190 | 1191 | /* set the debug function */ 1192 | CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), 1193 | 1194 | /* set the data for the debug function */ 1195 | CINIT(DEBUGDATA, OBJECTPOINT, 95), 1196 | 1197 | /* mark this as start of a cookie session */ 1198 | CINIT(COOKIESESSION, LONG, 96), 1199 | 1200 | /* The CApath directory used to validate the peer certificate 1201 | this option is used only if SSL_VERIFYPEER is true */ 1202 | CINIT(CAPATH, STRINGPOINT, 97), 1203 | 1204 | /* Instruct libcurl to use a smaller receive buffer */ 1205 | CINIT(BUFFERSIZE, LONG, 98), 1206 | 1207 | /* Instruct libcurl to not use any signal/alarm handlers, even when using 1208 | timeouts. This option is useful for multi-threaded applications. 1209 | See libcurl-the-guide for more background information. */ 1210 | CINIT(NOSIGNAL, LONG, 99), 1211 | 1212 | /* Provide a CURLShare for mutexing non-ts data */ 1213 | CINIT(SHARE, OBJECTPOINT, 100), 1214 | 1215 | /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), 1216 | CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and 1217 | CURLPROXY_SOCKS5. */ 1218 | CINIT(PROXYTYPE, LONG, 101), 1219 | 1220 | /* Set the Accept-Encoding string. Use this to tell a server you would like 1221 | the response to be compressed. Before 7.21.6, this was known as 1222 | CURLOPT_ENCODING */ 1223 | CINIT(ACCEPT_ENCODING, STRINGPOINT, 102), 1224 | 1225 | /* Set pointer to private data */ 1226 | CINIT(PRIVATE, OBJECTPOINT, 103), 1227 | 1228 | /* Set aliases for HTTP 200 in the HTTP Response header */ 1229 | CINIT(HTTP200ALIASES, OBJECTPOINT, 104), 1230 | 1231 | /* Continue to send authentication (user+password) when following locations, 1232 | even when hostname changed. This can potentially send off the name 1233 | and password to whatever host the server decides. */ 1234 | CINIT(UNRESTRICTED_AUTH, LONG, 105), 1235 | 1236 | /* Specifically switch on or off the FTP engine's use of the EPRT command ( 1237 | it also disables the LPRT attempt). By default, those ones will always be 1238 | attempted before the good old traditional PORT command. */ 1239 | CINIT(FTP_USE_EPRT, LONG, 106), 1240 | 1241 | /* Set this to a bitmask value to enable the particular authentications 1242 | methods you like. Use this in combination with CURLOPT_USERPWD. 1243 | Note that setting multiple bits may cause extra network round-trips. */ 1244 | CINIT(HTTPAUTH, LONG, 107), 1245 | 1246 | /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx 1247 | in second argument. The function must be matching the 1248 | curl_ssl_ctx_callback proto. */ 1249 | CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), 1250 | 1251 | /* Set the userdata for the ssl context callback function's third 1252 | argument */ 1253 | CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), 1254 | 1255 | /* FTP Option that causes missing dirs to be created on the remote server. 1256 | In 7.19.4 we introduced the convenience enums for this option using the 1257 | CURLFTP_CREATE_DIR prefix. 1258 | */ 1259 | CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), 1260 | 1261 | /* Set this to a bitmask value to enable the particular authentications 1262 | methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. 1263 | Note that setting multiple bits may cause extra network round-trips. */ 1264 | CINIT(PROXYAUTH, LONG, 111), 1265 | 1266 | /* FTP option that changes the timeout, in seconds, associated with 1267 | getting a response. This is different from transfer timeout time and 1268 | essentially places a demand on the FTP server to acknowledge commands 1269 | in a timely manner. */ 1270 | CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), 1271 | #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT 1272 | 1273 | /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to 1274 | tell libcurl to resolve names to those IP versions only. This only has 1275 | affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ 1276 | CINIT(IPRESOLVE, LONG, 113), 1277 | 1278 | /* Set this option to limit the size of a file that will be downloaded from 1279 | an HTTP or FTP server. 1280 | 1281 | Note there is also _LARGE version which adds large file support for 1282 | platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ 1283 | CINIT(MAXFILESIZE, LONG, 114), 1284 | 1285 | /* See the comment for INFILESIZE above, but in short, specifies 1286 | * the size of the file being uploaded. -1 means unknown. 1287 | */ 1288 | CINIT(INFILESIZE_LARGE, OFF_T, 115), 1289 | 1290 | /* Sets the continuation offset. There is also a LONG version of this; 1291 | * look above for RESUME_FROM. 1292 | */ 1293 | CINIT(RESUME_FROM_LARGE, OFF_T, 116), 1294 | 1295 | /* Sets the maximum size of data that will be downloaded from 1296 | * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. 1297 | */ 1298 | CINIT(MAXFILESIZE_LARGE, OFF_T, 117), 1299 | 1300 | /* Set this option to the file name of your .netrc file you want libcurl 1301 | to parse (using the CURLOPT_NETRC option). If not set, libcurl will do 1302 | a poor attempt to find the user's home directory and check for a .netrc 1303 | file in there. */ 1304 | CINIT(NETRC_FILE, STRINGPOINT, 118), 1305 | 1306 | /* Enable SSL/TLS for FTP, pick one of: 1307 | CURLUSESSL_TRY - try using SSL, proceed anyway otherwise 1308 | CURLUSESSL_CONTROL - SSL for the control connection or fail 1309 | CURLUSESSL_ALL - SSL for all communication or fail 1310 | */ 1311 | CINIT(USE_SSL, LONG, 119), 1312 | 1313 | /* The _LARGE version of the standard POSTFIELDSIZE option */ 1314 | CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), 1315 | 1316 | /* Enable/disable the TCP Nagle algorithm */ 1317 | CINIT(TCP_NODELAY, LONG, 121), 1318 | 1319 | /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1320 | /* 123 OBSOLETE. Gone in 7.16.0 */ 1321 | /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1322 | /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1323 | /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1324 | /* 127 OBSOLETE. Gone in 7.16.0 */ 1325 | /* 128 OBSOLETE. Gone in 7.16.0 */ 1326 | 1327 | /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option 1328 | can be used to change libcurl's default action which is to first try 1329 | "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK 1330 | response has been received. 1331 | 1332 | Available parameters are: 1333 | CURLFTPAUTH_DEFAULT - let libcurl decide 1334 | CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS 1335 | CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL 1336 | */ 1337 | CINIT(FTPSSLAUTH, LONG, 129), 1338 | 1339 | CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), 1340 | CINIT(IOCTLDATA, OBJECTPOINT, 131), 1341 | 1342 | /* 132 OBSOLETE. Gone in 7.16.0 */ 1343 | /* 133 OBSOLETE. Gone in 7.16.0 */ 1344 | 1345 | /* zero terminated string for pass on to the FTP server when asked for 1346 | "account" info */ 1347 | CINIT(FTP_ACCOUNT, STRINGPOINT, 134), 1348 | 1349 | /* feed cookie into cookie engine */ 1350 | CINIT(COOKIELIST, STRINGPOINT, 135), 1351 | 1352 | /* ignore Content-Length */ 1353 | CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), 1354 | 1355 | /* Set to non-zero to skip the IP address received in a 227 PASV FTP server 1356 | response. Typically used for FTP-SSL purposes but is not restricted to 1357 | that. libcurl will then instead use the same IP address it used for the 1358 | control connection. */ 1359 | CINIT(FTP_SKIP_PASV_IP, LONG, 137), 1360 | 1361 | /* Select "file method" to use when doing FTP, see the curl_ftpmethod 1362 | above. */ 1363 | CINIT(FTP_FILEMETHOD, LONG, 138), 1364 | 1365 | /* Local port number to bind the socket to */ 1366 | CINIT(LOCALPORT, LONG, 139), 1367 | 1368 | /* Number of ports to try, including the first one set with LOCALPORT. 1369 | Thus, setting it to 1 will make no additional attempts but the first. 1370 | */ 1371 | CINIT(LOCALPORTRANGE, LONG, 140), 1372 | 1373 | /* no transfer, set up connection and let application use the socket by 1374 | extracting it with CURLINFO_LASTSOCKET */ 1375 | CINIT(CONNECT_ONLY, LONG, 141), 1376 | 1377 | /* Function that will be called to convert from the 1378 | network encoding (instead of using the iconv calls in libcurl) */ 1379 | CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), 1380 | 1381 | /* Function that will be called to convert to the 1382 | network encoding (instead of using the iconv calls in libcurl) */ 1383 | CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), 1384 | 1385 | /* Function that will be called to convert from UTF8 1386 | (instead of using the iconv calls in libcurl) 1387 | Note that this is used only for SSL certificate processing */ 1388 | CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), 1389 | 1390 | /* if the connection proceeds too quickly then need to slow it down */ 1391 | /* limit-rate: maximum number of bytes per second to send or receive */ 1392 | CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), 1393 | CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), 1394 | 1395 | /* Pointer to command string to send if USER/PASS fails. */ 1396 | CINIT(FTP_ALTERNATIVE_TO_USER, STRINGPOINT, 147), 1397 | 1398 | /* callback function for setting socket options */ 1399 | CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), 1400 | CINIT(SOCKOPTDATA, OBJECTPOINT, 149), 1401 | 1402 | /* set to 0 to disable session ID re-use for this transfer, default is 1403 | enabled (== 1) */ 1404 | CINIT(SSL_SESSIONID_CACHE, LONG, 150), 1405 | 1406 | /* allowed SSH authentication methods */ 1407 | CINIT(SSH_AUTH_TYPES, LONG, 151), 1408 | 1409 | /* Used by scp/sftp to do public/private key authentication */ 1410 | CINIT(SSH_PUBLIC_KEYFILE, STRINGPOINT, 152), 1411 | CINIT(SSH_PRIVATE_KEYFILE, STRINGPOINT, 153), 1412 | 1413 | /* Send CCC (Clear Command Channel) after authentication */ 1414 | CINIT(FTP_SSL_CCC, LONG, 154), 1415 | 1416 | /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ 1417 | CINIT(TIMEOUT_MS, LONG, 155), 1418 | CINIT(CONNECTTIMEOUT_MS, LONG, 156), 1419 | 1420 | /* set to zero to disable the libcurl's decoding and thus pass the raw body 1421 | data to the application even when it is encoded/compressed */ 1422 | CINIT(HTTP_TRANSFER_DECODING, LONG, 157), 1423 | CINIT(HTTP_CONTENT_DECODING, LONG, 158), 1424 | 1425 | /* Permission used when creating new files and directories on the remote 1426 | server for protocols that support it, SFTP/SCP/FILE */ 1427 | CINIT(NEW_FILE_PERMS, LONG, 159), 1428 | CINIT(NEW_DIRECTORY_PERMS, LONG, 160), 1429 | 1430 | /* Set the behaviour of POST when redirecting. Values must be set to one 1431 | of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ 1432 | CINIT(POSTREDIR, LONG, 161), 1433 | 1434 | /* used by scp/sftp to verify the host's public key */ 1435 | CINIT(SSH_HOST_PUBLIC_KEY_MD5, STRINGPOINT, 162), 1436 | 1437 | /* Callback function for opening socket (instead of socket(2)). Optionally, 1438 | callback is able change the address or refuse to connect returning 1439 | CURL_SOCKET_BAD. The callback should have type 1440 | curl_opensocket_callback */ 1441 | CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), 1442 | CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), 1443 | 1444 | /* POST volatile input fields. */ 1445 | CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), 1446 | 1447 | /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ 1448 | CINIT(PROXY_TRANSFER_MODE, LONG, 166), 1449 | 1450 | /* Callback function for seeking in the input stream */ 1451 | CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), 1452 | CINIT(SEEKDATA, OBJECTPOINT, 168), 1453 | 1454 | /* CRL file */ 1455 | CINIT(CRLFILE, STRINGPOINT, 169), 1456 | 1457 | /* Issuer certificate */ 1458 | CINIT(ISSUERCERT, STRINGPOINT, 170), 1459 | 1460 | /* (IPv6) Address scope */ 1461 | CINIT(ADDRESS_SCOPE, LONG, 171), 1462 | 1463 | /* Collect certificate chain info and allow it to get retrievable with 1464 | CURLINFO_CERTINFO after the transfer is complete. */ 1465 | CINIT(CERTINFO, LONG, 172), 1466 | 1467 | /* "name" and "pwd" to use when fetching. */ 1468 | CINIT(USERNAME, STRINGPOINT, 173), 1469 | CINIT(PASSWORD, STRINGPOINT, 174), 1470 | 1471 | /* "name" and "pwd" to use with Proxy when fetching. */ 1472 | CINIT(PROXYUSERNAME, STRINGPOINT, 175), 1473 | CINIT(PROXYPASSWORD, STRINGPOINT, 176), 1474 | 1475 | /* Comma separated list of hostnames defining no-proxy zones. These should 1476 | match both hostnames directly, and hostnames within a domain. For 1477 | example, local.com will match local.com and www.local.com, but NOT 1478 | notlocal.com or www.notlocal.com. For compatibility with other 1479 | implementations of this, .local.com will be considered to be the same as 1480 | local.com. A single * is the only valid wildcard, and effectively 1481 | disables the use of proxy. */ 1482 | CINIT(NOPROXY, STRINGPOINT, 177), 1483 | 1484 | /* block size for TFTP transfers */ 1485 | CINIT(TFTP_BLKSIZE, LONG, 178), 1486 | 1487 | /* Socks Service */ 1488 | CINIT(SOCKS5_GSSAPI_SERVICE, STRINGPOINT, 179), /* DEPRECATED, do not use! */ 1489 | 1490 | /* Socks Service */ 1491 | CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), 1492 | 1493 | /* set the bitmask for the protocols that are allowed to be used for the 1494 | transfer, which thus helps the app which takes URLs from users or other 1495 | external inputs and want to restrict what protocol(s) to deal 1496 | with. Defaults to CURLPROTO_ALL. */ 1497 | CINIT(PROTOCOLS, LONG, 181), 1498 | 1499 | /* set the bitmask for the protocols that libcurl is allowed to follow to, 1500 | as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs 1501 | to be set in both bitmasks to be allowed to get redirected to. Defaults 1502 | to all protocols except FILE and SCP. */ 1503 | CINIT(REDIR_PROTOCOLS, LONG, 182), 1504 | 1505 | /* set the SSH knownhost file name to use */ 1506 | CINIT(SSH_KNOWNHOSTS, STRINGPOINT, 183), 1507 | 1508 | /* set the SSH host key callback, must point to a curl_sshkeycallback 1509 | function */ 1510 | CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), 1511 | 1512 | /* set the SSH host key callback custom pointer */ 1513 | CINIT(SSH_KEYDATA, OBJECTPOINT, 185), 1514 | 1515 | /* set the SMTP mail originator */ 1516 | CINIT(MAIL_FROM, STRINGPOINT, 186), 1517 | 1518 | /* set the list of SMTP mail receiver(s) */ 1519 | CINIT(MAIL_RCPT, OBJECTPOINT, 187), 1520 | 1521 | /* FTP: send PRET before PASV */ 1522 | CINIT(FTP_USE_PRET, LONG, 188), 1523 | 1524 | /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ 1525 | CINIT(RTSP_REQUEST, LONG, 189), 1526 | 1527 | /* The RTSP session identifier */ 1528 | CINIT(RTSP_SESSION_ID, STRINGPOINT, 190), 1529 | 1530 | /* The RTSP stream URI */ 1531 | CINIT(RTSP_STREAM_URI, STRINGPOINT, 191), 1532 | 1533 | /* The Transport: header to use in RTSP requests */ 1534 | CINIT(RTSP_TRANSPORT, STRINGPOINT, 192), 1535 | 1536 | /* Manually initialize the client RTSP CSeq for this handle */ 1537 | CINIT(RTSP_CLIENT_CSEQ, LONG, 193), 1538 | 1539 | /* Manually initialize the server RTSP CSeq for this handle */ 1540 | CINIT(RTSP_SERVER_CSEQ, LONG, 194), 1541 | 1542 | /* The stream to pass to INTERLEAVEFUNCTION. */ 1543 | CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), 1544 | 1545 | /* Let the application define a custom write method for RTP data */ 1546 | CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), 1547 | 1548 | /* Turn on wildcard matching */ 1549 | CINIT(WILDCARDMATCH, LONG, 197), 1550 | 1551 | /* Directory matching callback called before downloading of an 1552 | individual file (chunk) started */ 1553 | CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), 1554 | 1555 | /* Directory matching callback called after the file (chunk) 1556 | was downloaded, or skipped */ 1557 | CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), 1558 | 1559 | /* Change match (fnmatch-like) callback for wildcard matching */ 1560 | CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), 1561 | 1562 | /* Let the application define custom chunk data pointer */ 1563 | CINIT(CHUNK_DATA, OBJECTPOINT, 201), 1564 | 1565 | /* FNMATCH_FUNCTION user pointer */ 1566 | CINIT(FNMATCH_DATA, OBJECTPOINT, 202), 1567 | 1568 | /* send linked-list of name:port:address sets */ 1569 | CINIT(RESOLVE, OBJECTPOINT, 203), 1570 | 1571 | /* Set a username for authenticated TLS */ 1572 | CINIT(TLSAUTH_USERNAME, STRINGPOINT, 204), 1573 | 1574 | /* Set a password for authenticated TLS */ 1575 | CINIT(TLSAUTH_PASSWORD, STRINGPOINT, 205), 1576 | 1577 | /* Set authentication type for authenticated TLS */ 1578 | CINIT(TLSAUTH_TYPE, STRINGPOINT, 206), 1579 | 1580 | /* Set to 1 to enable the "TE:" header in HTTP requests to ask for 1581 | compressed transfer-encoded responses. Set to 0 to disable the use of TE: 1582 | in outgoing requests. The current default is 0, but it might change in a 1583 | future libcurl release. 1584 | 1585 | libcurl will ask for the compressed methods it knows of, and if that 1586 | isn't any, it will not ask for transfer-encoding at all even if this 1587 | option is set to 1. 1588 | 1589 | */ 1590 | CINIT(TRANSFER_ENCODING, LONG, 207), 1591 | 1592 | /* Callback function for closing socket (instead of close(2)). The callback 1593 | should have type curl_closesocket_callback */ 1594 | CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), 1595 | CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), 1596 | 1597 | /* allow GSSAPI credential delegation */ 1598 | CINIT(GSSAPI_DELEGATION, LONG, 210), 1599 | 1600 | /* Set the name servers to use for DNS resolution */ 1601 | CINIT(DNS_SERVERS, STRINGPOINT, 211), 1602 | 1603 | /* Time-out accept operations (currently for FTP only) after this amount 1604 | of milliseconds. */ 1605 | CINIT(ACCEPTTIMEOUT_MS, LONG, 212), 1606 | 1607 | /* Set TCP keepalive */ 1608 | CINIT(TCP_KEEPALIVE, LONG, 213), 1609 | 1610 | /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ 1611 | CINIT(TCP_KEEPIDLE, LONG, 214), 1612 | CINIT(TCP_KEEPINTVL, LONG, 215), 1613 | 1614 | /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ 1615 | CINIT(SSL_OPTIONS, LONG, 216), 1616 | 1617 | /* Set the SMTP auth originator */ 1618 | CINIT(MAIL_AUTH, STRINGPOINT, 217), 1619 | 1620 | /* Enable/disable SASL initial response */ 1621 | CINIT(SASL_IR, LONG, 218), 1622 | 1623 | /* Function that will be called instead of the internal progress display 1624 | * function. This function should be defined as the curl_xferinfo_callback 1625 | * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */ 1626 | CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219), 1627 | 1628 | /* The XOAUTH2 bearer token */ 1629 | CINIT(XOAUTH2_BEARER, STRINGPOINT, 220), 1630 | 1631 | /* Set the interface string to use as outgoing network 1632 | * interface for DNS requests. 1633 | * Only supported by the c-ares DNS backend */ 1634 | CINIT(DNS_INTERFACE, STRINGPOINT, 221), 1635 | 1636 | /* Set the local IPv4 address to use for outgoing DNS requests. 1637 | * Only supported by the c-ares DNS backend */ 1638 | CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222), 1639 | 1640 | /* Set the local IPv4 address to use for outgoing DNS requests. 1641 | * Only supported by the c-ares DNS backend */ 1642 | CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223), 1643 | 1644 | /* Set authentication options directly */ 1645 | CINIT(LOGIN_OPTIONS, STRINGPOINT, 224), 1646 | 1647 | /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */ 1648 | CINIT(SSL_ENABLE_NPN, LONG, 225), 1649 | 1650 | /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */ 1651 | CINIT(SSL_ENABLE_ALPN, LONG, 226), 1652 | 1653 | /* Time to wait for a response to a HTTP request containing an 1654 | * Expect: 100-continue header before sending the data anyway. */ 1655 | CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227), 1656 | 1657 | /* This points to a linked list of headers used for proxy requests only, 1658 | struct curl_slist kind */ 1659 | CINIT(PROXYHEADER, OBJECTPOINT, 228), 1660 | 1661 | /* Pass in a bitmask of "header options" */ 1662 | CINIT(HEADEROPT, LONG, 229), 1663 | 1664 | /* The public key in DER form used to validate the peer public key 1665 | this option is used only if SSL_VERIFYPEER is true */ 1666 | CINIT(PINNEDPUBLICKEY, STRINGPOINT, 230), 1667 | 1668 | /* Path to Unix domain socket */ 1669 | CINIT(UNIX_SOCKET_PATH, STRINGPOINT, 231), 1670 | 1671 | /* Set if we should verify the certificate status. */ 1672 | CINIT(SSL_VERIFYSTATUS, LONG, 232), 1673 | 1674 | /* Set if we should enable TLS false start. */ 1675 | CINIT(SSL_FALSESTART, LONG, 233), 1676 | 1677 | /* Do not squash dot-dot sequences */ 1678 | CINIT(PATH_AS_IS, LONG, 234), 1679 | 1680 | /* Proxy Service Name */ 1681 | CINIT(PROXY_SERVICE_NAME, STRINGPOINT, 235), 1682 | 1683 | /* Service Name */ 1684 | CINIT(SERVICE_NAME, STRINGPOINT, 236), 1685 | 1686 | /* Wait/don't wait for pipe/mutex to clarify */ 1687 | CINIT(PIPEWAIT, LONG, 237), 1688 | 1689 | /* Set the protocol used when curl is given a URL without a protocol */ 1690 | CINIT(DEFAULT_PROTOCOL, STRINGPOINT, 238), 1691 | 1692 | /* Set stream weight, 1 - 256 (default is 16) */ 1693 | CINIT(STREAM_WEIGHT, LONG, 239), 1694 | 1695 | /* Set stream dependency on another CURL handle */ 1696 | CINIT(STREAM_DEPENDS, OBJECTPOINT, 240), 1697 | 1698 | /* Set E-xclusive stream dependency on another CURL handle */ 1699 | CINIT(STREAM_DEPENDS_E, OBJECTPOINT, 241), 1700 | 1701 | /* Do not send any tftp option requests to the server */ 1702 | CINIT(TFTP_NO_OPTIONS, LONG, 242), 1703 | 1704 | /* Linked-list of host:port:connect-to-host:connect-to-port, 1705 | overrides the URL's host:port (only for the network layer) */ 1706 | CINIT(CONNECT_TO, OBJECTPOINT, 243), 1707 | 1708 | /* Set TCP Fast Open */ 1709 | CINIT(TCP_FASTOPEN, LONG, 244), 1710 | 1711 | /* Continue to send data if the server responds early with an 1712 | * HTTP status code >= 300 */ 1713 | CINIT(KEEP_SENDING_ON_ERROR, LONG, 245), 1714 | 1715 | /* The CApath or CAfile used to validate the proxy certificate 1716 | this option is used only if PROXY_SSL_VERIFYPEER is true */ 1717 | CINIT(PROXY_CAINFO, STRINGPOINT, 246), 1718 | 1719 | /* The CApath directory used to validate the proxy certificate 1720 | this option is used only if PROXY_SSL_VERIFYPEER is true */ 1721 | CINIT(PROXY_CAPATH, STRINGPOINT, 247), 1722 | 1723 | /* Set if we should verify the proxy in ssl handshake, 1724 | set 1 to verify. */ 1725 | CINIT(PROXY_SSL_VERIFYPEER, LONG, 248), 1726 | 1727 | /* Set if we should verify the Common name from the proxy certificate in ssl 1728 | * handshake, set 1 to check existence, 2 to ensure that it matches 1729 | * the provided hostname. */ 1730 | CINIT(PROXY_SSL_VERIFYHOST, LONG, 249), 1731 | 1732 | /* What version to specifically try to use for proxy. 1733 | See CURL_SSLVERSION defines below. */ 1734 | CINIT(PROXY_SSLVERSION, LONG, 250), 1735 | 1736 | /* Set a username for authenticated TLS for proxy */ 1737 | CINIT(PROXY_TLSAUTH_USERNAME, STRINGPOINT, 251), 1738 | 1739 | /* Set a password for authenticated TLS for proxy */ 1740 | CINIT(PROXY_TLSAUTH_PASSWORD, STRINGPOINT, 252), 1741 | 1742 | /* Set authentication type for authenticated TLS for proxy */ 1743 | CINIT(PROXY_TLSAUTH_TYPE, STRINGPOINT, 253), 1744 | 1745 | /* name of the file keeping your private SSL-certificate for proxy */ 1746 | CINIT(PROXY_SSLCERT, STRINGPOINT, 254), 1747 | 1748 | /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for 1749 | proxy */ 1750 | CINIT(PROXY_SSLCERTTYPE, STRINGPOINT, 255), 1751 | 1752 | /* name of the file keeping your private SSL-key for proxy */ 1753 | CINIT(PROXY_SSLKEY, STRINGPOINT, 256), 1754 | 1755 | /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for 1756 | proxy */ 1757 | CINIT(PROXY_SSLKEYTYPE, STRINGPOINT, 257), 1758 | 1759 | /* password for the SSL private key for proxy */ 1760 | CINIT(PROXY_KEYPASSWD, STRINGPOINT, 258), 1761 | 1762 | /* Specify which SSL ciphers to use for proxy */ 1763 | CINIT(PROXY_SSL_CIPHER_LIST, STRINGPOINT, 259), 1764 | 1765 | /* CRL file for proxy */ 1766 | CINIT(PROXY_CRLFILE, STRINGPOINT, 260), 1767 | 1768 | /* Enable/disable specific SSL features with a bitmask for proxy, see 1769 | CURLSSLOPT_* */ 1770 | CINIT(PROXY_SSL_OPTIONS, LONG, 261), 1771 | 1772 | /* Name of pre proxy to use. */ 1773 | CINIT(PRE_PROXY, STRINGPOINT, 262), 1774 | 1775 | /* The public key in DER form used to validate the proxy public key 1776 | this option is used only if PROXY_SSL_VERIFYPEER is true */ 1777 | CINIT(PROXY_PINNEDPUBLICKEY, STRINGPOINT, 263), 1778 | 1779 | /* Path to an abstract Unix domain socket */ 1780 | CINIT(ABSTRACT_UNIX_SOCKET, STRINGPOINT, 264), 1781 | 1782 | /* Suppress proxy CONNECT response headers from user callbacks */ 1783 | CINIT(SUPPRESS_CONNECT_HEADERS, LONG, 265), 1784 | 1785 | /* The request target, instead of extracted from the URL */ 1786 | CINIT(REQUEST_TARGET, STRINGPOINT, 266), 1787 | 1788 | /* bitmask of allowed auth methods for connections to SOCKS5 proxies */ 1789 | CINIT(SOCKS5_AUTH, LONG, 267), 1790 | 1791 | CURLOPT_LASTENTRY /* the last unused */ 1792 | } CURLoption; 1793 | 1794 | #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all 1795 | the obsolete stuff removed! */ 1796 | 1797 | /* Backwards compatibility with older names */ 1798 | /* These are scheduled to disappear by 2011 */ 1799 | 1800 | /* This was added in version 7.19.1 */ 1801 | #define CURLOPT_POST301 CURLOPT_POSTREDIR 1802 | 1803 | /* These are scheduled to disappear by 2009 */ 1804 | 1805 | /* The following were added in 7.17.0 */ 1806 | #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD 1807 | #define CURLOPT_FTPAPPEND CURLOPT_APPEND 1808 | #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY 1809 | #define CURLOPT_FTP_SSL CURLOPT_USE_SSL 1810 | 1811 | /* The following were added earlier */ 1812 | 1813 | #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD 1814 | #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL 1815 | 1816 | #else 1817 | /* This is set if CURL_NO_OLDIES is defined at compile-time */ 1818 | #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ 1819 | #endif 1820 | 1821 | 1822 | /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host 1823 | name resolves addresses using more than one IP protocol version, this 1824 | option might be handy to force libcurl to use a specific IP version. */ 1825 | #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP 1826 | versions that your system allows */ 1827 | #define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */ 1828 | #define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */ 1829 | 1830 | /* three convenient "aliases" that follow the name scheme better */ 1831 | #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER 1832 | 1833 | /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ 1834 | enum { 1835 | CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd 1836 | like the library to choose the best possible 1837 | for us! */ 1838 | CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ 1839 | CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ 1840 | CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */ 1841 | CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */ 1842 | CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* please use HTTP 2 without HTTP/1.1 1843 | Upgrade */ 1844 | 1845 | CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ 1846 | }; 1847 | 1848 | /* Convenience definition simple because the name of the version is HTTP/2 and 1849 | not 2.0. The 2_0 version of the enum name was set while the version was 1850 | still planned to be 2.0 and we stick to it for compatibility. */ 1851 | #define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0 1852 | 1853 | /* 1854 | * Public API enums for RTSP requests 1855 | */ 1856 | enum { 1857 | CURL_RTSPREQ_NONE, /* first in list */ 1858 | CURL_RTSPREQ_OPTIONS, 1859 | CURL_RTSPREQ_DESCRIBE, 1860 | CURL_RTSPREQ_ANNOUNCE, 1861 | CURL_RTSPREQ_SETUP, 1862 | CURL_RTSPREQ_PLAY, 1863 | CURL_RTSPREQ_PAUSE, 1864 | CURL_RTSPREQ_TEARDOWN, 1865 | CURL_RTSPREQ_GET_PARAMETER, 1866 | CURL_RTSPREQ_SET_PARAMETER, 1867 | CURL_RTSPREQ_RECORD, 1868 | CURL_RTSPREQ_RECEIVE, 1869 | CURL_RTSPREQ_LAST /* last in list */ 1870 | }; 1871 | 1872 | /* These enums are for use with the CURLOPT_NETRC option. */ 1873 | enum CURL_NETRC_OPTION { 1874 | CURL_NETRC_IGNORED, /* The .netrc will never be read. 1875 | * This is the default. */ 1876 | CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred 1877 | * to one in the .netrc. */ 1878 | CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. 1879 | * Unless one is set programmatically, the .netrc 1880 | * will be queried. */ 1881 | CURL_NETRC_LAST 1882 | }; 1883 | 1884 | enum { 1885 | CURL_SSLVERSION_DEFAULT, 1886 | CURL_SSLVERSION_TLSv1, /* TLS 1.x */ 1887 | CURL_SSLVERSION_SSLv2, 1888 | CURL_SSLVERSION_SSLv3, 1889 | CURL_SSLVERSION_TLSv1_0, 1890 | CURL_SSLVERSION_TLSv1_1, 1891 | CURL_SSLVERSION_TLSv1_2, 1892 | CURL_SSLVERSION_TLSv1_3, 1893 | 1894 | CURL_SSLVERSION_LAST /* never use, keep last */ 1895 | }; 1896 | 1897 | enum { 1898 | CURL_SSLVERSION_MAX_NONE = 0, 1899 | CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16), 1900 | CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16), 1901 | CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16), 1902 | CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16), 1903 | CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16), 1904 | 1905 | /* never use, keep last */ 1906 | CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16) 1907 | }; 1908 | 1909 | enum CURL_TLSAUTH { 1910 | CURL_TLSAUTH_NONE, 1911 | CURL_TLSAUTH_SRP, 1912 | CURL_TLSAUTH_LAST /* never use, keep last */ 1913 | }; 1914 | 1915 | /* symbols to use with CURLOPT_POSTREDIR. 1916 | CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 1917 | can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 1918 | | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ 1919 | 1920 | #define CURL_REDIR_GET_ALL 0 1921 | #define CURL_REDIR_POST_301 1 1922 | #define CURL_REDIR_POST_302 2 1923 | #define CURL_REDIR_POST_303 4 1924 | #define CURL_REDIR_POST_ALL \ 1925 | (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) 1926 | 1927 | typedef enum { 1928 | CURL_TIMECOND_NONE, 1929 | 1930 | CURL_TIMECOND_IFMODSINCE, 1931 | CURL_TIMECOND_IFUNMODSINCE, 1932 | CURL_TIMECOND_LASTMOD, 1933 | 1934 | CURL_TIMECOND_LAST 1935 | } curl_TimeCond; 1936 | 1937 | 1938 | /* curl_strequal() and curl_strnequal() are subject for removal in a future 1939 | libcurl, see lib/README.curlx for details 1940 | 1941 | !checksrc! disable SPACEBEFOREPAREN 2 1942 | */ 1943 | CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); 1944 | CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); 1945 | 1946 | /* name is uppercase CURLFORM_ */ 1947 | #ifdef CFINIT 1948 | #undef CFINIT 1949 | #endif 1950 | 1951 | #ifdef CURL_ISOCPP 1952 | #define CFINIT(name) CURLFORM_ ## name 1953 | #else 1954 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 1955 | #define CFINIT(name) CURLFORM_/**/name 1956 | #endif 1957 | 1958 | typedef enum { 1959 | CFINIT(NOTHING), /********* the first one is unused ************/ 1960 | 1961 | /* */ 1962 | CFINIT(COPYNAME), 1963 | CFINIT(PTRNAME), 1964 | CFINIT(NAMELENGTH), 1965 | CFINIT(COPYCONTENTS), 1966 | CFINIT(PTRCONTENTS), 1967 | CFINIT(CONTENTSLENGTH), 1968 | CFINIT(FILECONTENT), 1969 | CFINIT(ARRAY), 1970 | CFINIT(OBSOLETE), 1971 | CFINIT(FILE), 1972 | 1973 | CFINIT(BUFFER), 1974 | CFINIT(BUFFERPTR), 1975 | CFINIT(BUFFERLENGTH), 1976 | 1977 | CFINIT(CONTENTTYPE), 1978 | CFINIT(CONTENTHEADER), 1979 | CFINIT(FILENAME), 1980 | CFINIT(END), 1981 | CFINIT(OBSOLETE2), 1982 | 1983 | CFINIT(STREAM), 1984 | CFINIT(CONTENTLEN), /* added in 7.46.0, provide a curl_off_t length */ 1985 | 1986 | CURLFORM_LASTENTRY /* the last unused */ 1987 | } CURLformoption; 1988 | 1989 | #undef CFINIT /* done */ 1990 | 1991 | /* structure to be used as parameter for CURLFORM_ARRAY */ 1992 | struct curl_forms { 1993 | CURLformoption option; 1994 | const char *value; 1995 | }; 1996 | 1997 | /* use this for multipart formpost building */ 1998 | /* Returns code for curl_formadd() 1999 | * 2000 | * Returns: 2001 | * CURL_FORMADD_OK on success 2002 | * CURL_FORMADD_MEMORY if the FormInfo allocation fails 2003 | * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form 2004 | * CURL_FORMADD_NULL if a null pointer was given for a char 2005 | * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed 2006 | * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used 2007 | * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) 2008 | * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated 2009 | * CURL_FORMADD_MEMORY if some allocation for string copying failed. 2010 | * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array 2011 | * 2012 | ***************************************************************************/ 2013 | typedef enum { 2014 | CURL_FORMADD_OK, /* first, no error */ 2015 | 2016 | CURL_FORMADD_MEMORY, 2017 | CURL_FORMADD_OPTION_TWICE, 2018 | CURL_FORMADD_NULL, 2019 | CURL_FORMADD_UNKNOWN_OPTION, 2020 | CURL_FORMADD_INCOMPLETE, 2021 | CURL_FORMADD_ILLEGAL_ARRAY, 2022 | CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ 2023 | 2024 | CURL_FORMADD_LAST /* last */ 2025 | } CURLFORMcode; 2026 | 2027 | /* 2028 | * NAME curl_formadd() 2029 | * 2030 | * DESCRIPTION 2031 | * 2032 | * Pretty advanced function for building multi-part formposts. Each invoke 2033 | * adds one part that together construct a full post. Then use 2034 | * CURLOPT_HTTPPOST to send it off to libcurl. 2035 | */ 2036 | CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, 2037 | struct curl_httppost **last_post, 2038 | ...); 2039 | 2040 | /* 2041 | * callback function for curl_formget() 2042 | * The void *arg pointer will be the one passed as second argument to 2043 | * curl_formget(). 2044 | * The character buffer passed to it must not be freed. 2045 | * Should return the buffer length passed to it as the argument "len" on 2046 | * success. 2047 | */ 2048 | typedef size_t (*curl_formget_callback)(void *arg, const char *buf, 2049 | size_t len); 2050 | 2051 | /* 2052 | * NAME curl_formget() 2053 | * 2054 | * DESCRIPTION 2055 | * 2056 | * Serialize a curl_httppost struct built with curl_formadd(). 2057 | * Accepts a void pointer as second argument which will be passed to 2058 | * the curl_formget_callback function. 2059 | * Returns 0 on success. 2060 | */ 2061 | CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, 2062 | curl_formget_callback append); 2063 | /* 2064 | * NAME curl_formfree() 2065 | * 2066 | * DESCRIPTION 2067 | * 2068 | * Free a multipart formpost previously built with curl_formadd(). 2069 | */ 2070 | CURL_EXTERN void curl_formfree(struct curl_httppost *form); 2071 | 2072 | /* 2073 | * NAME curl_getenv() 2074 | * 2075 | * DESCRIPTION 2076 | * 2077 | * Returns a malloc()'ed string that MUST be curl_free()ed after usage is 2078 | * complete. DEPRECATED - see lib/README.curlx 2079 | */ 2080 | CURL_EXTERN char *curl_getenv(const char *variable); 2081 | 2082 | /* 2083 | * NAME curl_version() 2084 | * 2085 | * DESCRIPTION 2086 | * 2087 | * Returns a static ascii string of the libcurl version. 2088 | */ 2089 | CURL_EXTERN char *curl_version(void); 2090 | 2091 | /* 2092 | * NAME curl_easy_escape() 2093 | * 2094 | * DESCRIPTION 2095 | * 2096 | * Escapes URL strings (converts all letters consider illegal in URLs to their 2097 | * %XX versions). This function returns a new allocated string or NULL if an 2098 | * error occurred. 2099 | */ 2100 | CURL_EXTERN char *curl_easy_escape(CURL *handle, 2101 | const char *string, 2102 | int length); 2103 | 2104 | /* the previous version: */ 2105 | CURL_EXTERN char *curl_escape(const char *string, 2106 | int length); 2107 | 2108 | 2109 | /* 2110 | * NAME curl_easy_unescape() 2111 | * 2112 | * DESCRIPTION 2113 | * 2114 | * Unescapes URL encoding in strings (converts all %XX codes to their 8bit 2115 | * versions). This function returns a new allocated string or NULL if an error 2116 | * occurred. 2117 | * Conversion Note: On non-ASCII platforms the ASCII %XX codes are 2118 | * converted into the host encoding. 2119 | */ 2120 | CURL_EXTERN char *curl_easy_unescape(CURL *handle, 2121 | const char *string, 2122 | int length, 2123 | int *outlength); 2124 | 2125 | /* the previous version */ 2126 | CURL_EXTERN char *curl_unescape(const char *string, 2127 | int length); 2128 | 2129 | /* 2130 | * NAME curl_free() 2131 | * 2132 | * DESCRIPTION 2133 | * 2134 | * Provided for de-allocation in the same translation unit that did the 2135 | * allocation. Added in libcurl 7.10 2136 | */ 2137 | CURL_EXTERN void curl_free(void *p); 2138 | 2139 | /* 2140 | * NAME curl_global_init() 2141 | * 2142 | * DESCRIPTION 2143 | * 2144 | * curl_global_init() should be invoked exactly once for each application that 2145 | * uses libcurl and before any call of other libcurl functions. 2146 | * 2147 | * This function is not thread-safe! 2148 | */ 2149 | CURL_EXTERN CURLcode curl_global_init(long flags); 2150 | 2151 | /* 2152 | * NAME curl_global_init_mem() 2153 | * 2154 | * DESCRIPTION 2155 | * 2156 | * curl_global_init() or curl_global_init_mem() should be invoked exactly once 2157 | * for each application that uses libcurl. This function can be used to 2158 | * initialize libcurl and set user defined memory management callback 2159 | * functions. Users can implement memory management routines to check for 2160 | * memory leaks, check for mis-use of the curl library etc. User registered 2161 | * callback routines with be invoked by this library instead of the system 2162 | * memory management routines like malloc, free etc. 2163 | */ 2164 | CURL_EXTERN CURLcode curl_global_init_mem(long flags, 2165 | curl_malloc_callback m, 2166 | curl_free_callback f, 2167 | curl_realloc_callback r, 2168 | curl_strdup_callback s, 2169 | curl_calloc_callback c); 2170 | 2171 | /* 2172 | * NAME curl_global_cleanup() 2173 | * 2174 | * DESCRIPTION 2175 | * 2176 | * curl_global_cleanup() should be invoked exactly once for each application 2177 | * that uses libcurl 2178 | */ 2179 | CURL_EXTERN void curl_global_cleanup(void); 2180 | 2181 | /* linked-list structure for the CURLOPT_QUOTE option (and other) */ 2182 | struct curl_slist { 2183 | char *data; 2184 | struct curl_slist *next; 2185 | }; 2186 | 2187 | /* 2188 | * NAME curl_slist_append() 2189 | * 2190 | * DESCRIPTION 2191 | * 2192 | * Appends a string to a linked list. If no list exists, it will be created 2193 | * first. Returns the new list, after appending. 2194 | */ 2195 | CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, 2196 | const char *); 2197 | 2198 | /* 2199 | * NAME curl_slist_free_all() 2200 | * 2201 | * DESCRIPTION 2202 | * 2203 | * free a previously built curl_slist. 2204 | */ 2205 | CURL_EXTERN void curl_slist_free_all(struct curl_slist *); 2206 | 2207 | /* 2208 | * NAME curl_getdate() 2209 | * 2210 | * DESCRIPTION 2211 | * 2212 | * Returns the time, in seconds since 1 Jan 1970 of the time string given in 2213 | * the first argument. The time argument in the second parameter is unused 2214 | * and should be set to NULL. 2215 | */ 2216 | CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); 2217 | 2218 | /* info about the certificate chain, only for OpenSSL builds. Asked 2219 | for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ 2220 | struct curl_certinfo { 2221 | int num_of_certs; /* number of certificates with information */ 2222 | struct curl_slist **certinfo; /* for each index in this array, there's a 2223 | linked list with textual information in the 2224 | format "name: value" */ 2225 | }; 2226 | 2227 | /* enum for the different supported SSL backends */ 2228 | typedef enum { 2229 | CURLSSLBACKEND_NONE = 0, 2230 | CURLSSLBACKEND_OPENSSL = 1, 2231 | CURLSSLBACKEND_GNUTLS = 2, 2232 | CURLSSLBACKEND_NSS = 3, 2233 | CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */ 2234 | CURLSSLBACKEND_GSKIT = 5, 2235 | CURLSSLBACKEND_POLARSSL = 6, 2236 | CURLSSLBACKEND_CYASSL = 7, 2237 | CURLSSLBACKEND_SCHANNEL = 8, 2238 | CURLSSLBACKEND_DARWINSSL = 9, 2239 | CURLSSLBACKEND_AXTLS = 10, 2240 | CURLSSLBACKEND_MBEDTLS = 11 2241 | } curl_sslbackend; 2242 | 2243 | /* aliases for library clones and renames */ 2244 | #define CURLSSLBACKEND_LIBRESSL 1 2245 | #define CURLSSLBACKEND_BORINGSSL 1 2246 | #define CURLSSLBACKEND_WOLFSSL 6 2247 | 2248 | /* Information about the SSL library used and the respective internal SSL 2249 | handle, which can be used to obtain further information regarding the 2250 | connection. Asked for with CURLINFO_TLS_SSL_PTR or CURLINFO_TLS_SESSION. */ 2251 | struct curl_tlssessioninfo { 2252 | curl_sslbackend backend; 2253 | void *internals; 2254 | }; 2255 | 2256 | #define CURLINFO_STRING 0x100000 2257 | #define CURLINFO_LONG 0x200000 2258 | #define CURLINFO_DOUBLE 0x300000 2259 | #define CURLINFO_SLIST 0x400000 2260 | #define CURLINFO_PTR 0x400000 /* same as SLIST */ 2261 | #define CURLINFO_SOCKET 0x500000 2262 | #define CURLINFO_OFF_T 0x600000 2263 | #define CURLINFO_MASK 0x0fffff 2264 | #define CURLINFO_TYPEMASK 0xf00000 2265 | 2266 | typedef enum { 2267 | CURLINFO_NONE, /* first, never use this */ 2268 | CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, 2269 | CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, 2270 | CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, 2271 | CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, 2272 | CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, 2273 | CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, 2274 | CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, 2275 | CURLINFO_SIZE_UPLOAD_T = CURLINFO_OFF_T + 7, 2276 | CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, 2277 | CURLINFO_SIZE_DOWNLOAD_T = CURLINFO_OFF_T + 8, 2278 | CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, 2279 | CURLINFO_SPEED_DOWNLOAD_T = CURLINFO_OFF_T + 9, 2280 | CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, 2281 | CURLINFO_SPEED_UPLOAD_T = CURLINFO_OFF_T + 10, 2282 | CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, 2283 | CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, 2284 | CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, 2285 | CURLINFO_FILETIME = CURLINFO_LONG + 14, 2286 | CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, 2287 | CURLINFO_CONTENT_LENGTH_DOWNLOAD_T = CURLINFO_OFF_T + 15, 2288 | CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, 2289 | CURLINFO_CONTENT_LENGTH_UPLOAD_T = CURLINFO_OFF_T + 16, 2290 | CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, 2291 | CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, 2292 | CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, 2293 | CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, 2294 | CURLINFO_PRIVATE = CURLINFO_STRING + 21, 2295 | CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, 2296 | CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, 2297 | CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, 2298 | CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, 2299 | CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, 2300 | CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, 2301 | CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, 2302 | CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, 2303 | CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, 2304 | CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, 2305 | CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, 2306 | CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, 2307 | CURLINFO_CERTINFO = CURLINFO_PTR + 34, 2308 | CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, 2309 | CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, 2310 | CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, 2311 | CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, 2312 | CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, 2313 | CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, 2314 | CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, 2315 | CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, 2316 | CURLINFO_TLS_SESSION = CURLINFO_PTR + 43, 2317 | CURLINFO_ACTIVESOCKET = CURLINFO_SOCKET + 44, 2318 | CURLINFO_TLS_SSL_PTR = CURLINFO_PTR + 45, 2319 | CURLINFO_HTTP_VERSION = CURLINFO_LONG + 46, 2320 | CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47, 2321 | CURLINFO_PROTOCOL = CURLINFO_LONG + 48, 2322 | CURLINFO_SCHEME = CURLINFO_STRING + 49, 2323 | /* Fill in new entries below here! */ 2324 | 2325 | CURLINFO_LASTONE = 49 2326 | } CURLINFO; 2327 | 2328 | /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as 2329 | CURLINFO_HTTP_CODE */ 2330 | #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE 2331 | 2332 | typedef enum { 2333 | CURLCLOSEPOLICY_NONE, /* first, never use this */ 2334 | 2335 | CURLCLOSEPOLICY_OLDEST, 2336 | CURLCLOSEPOLICY_LEAST_RECENTLY_USED, 2337 | CURLCLOSEPOLICY_LEAST_TRAFFIC, 2338 | CURLCLOSEPOLICY_SLOWEST, 2339 | CURLCLOSEPOLICY_CALLBACK, 2340 | 2341 | CURLCLOSEPOLICY_LAST /* last, never use this */ 2342 | } curl_closepolicy; 2343 | 2344 | #define CURL_GLOBAL_SSL (1<<0) 2345 | #define CURL_GLOBAL_WIN32 (1<<1) 2346 | #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) 2347 | #define CURL_GLOBAL_NOTHING 0 2348 | #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL 2349 | #define CURL_GLOBAL_ACK_EINTR (1<<2) 2350 | 2351 | 2352 | /***************************************************************************** 2353 | * Setup defines, protos etc for the sharing stuff. 2354 | */ 2355 | 2356 | /* Different data locks for a single share */ 2357 | typedef enum { 2358 | CURL_LOCK_DATA_NONE = 0, 2359 | /* CURL_LOCK_DATA_SHARE is used internally to say that 2360 | * the locking is just made to change the internal state of the share 2361 | * itself. 2362 | */ 2363 | CURL_LOCK_DATA_SHARE, 2364 | CURL_LOCK_DATA_COOKIE, 2365 | CURL_LOCK_DATA_DNS, 2366 | CURL_LOCK_DATA_SSL_SESSION, 2367 | CURL_LOCK_DATA_CONNECT, 2368 | CURL_LOCK_DATA_LAST 2369 | } curl_lock_data; 2370 | 2371 | /* Different lock access types */ 2372 | typedef enum { 2373 | CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ 2374 | CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ 2375 | CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ 2376 | CURL_LOCK_ACCESS_LAST /* never use */ 2377 | } curl_lock_access; 2378 | 2379 | typedef void (*curl_lock_function)(CURL *handle, 2380 | curl_lock_data data, 2381 | curl_lock_access locktype, 2382 | void *userptr); 2383 | typedef void (*curl_unlock_function)(CURL *handle, 2384 | curl_lock_data data, 2385 | void *userptr); 2386 | 2387 | 2388 | typedef enum { 2389 | CURLSHE_OK, /* all is fine */ 2390 | CURLSHE_BAD_OPTION, /* 1 */ 2391 | CURLSHE_IN_USE, /* 2 */ 2392 | CURLSHE_INVALID, /* 3 */ 2393 | CURLSHE_NOMEM, /* 4 out of memory */ 2394 | CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ 2395 | CURLSHE_LAST /* never use */ 2396 | } CURLSHcode; 2397 | 2398 | typedef enum { 2399 | CURLSHOPT_NONE, /* don't use */ 2400 | CURLSHOPT_SHARE, /* specify a data type to share */ 2401 | CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ 2402 | CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ 2403 | CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ 2404 | CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock 2405 | callback functions */ 2406 | CURLSHOPT_LAST /* never use */ 2407 | } CURLSHoption; 2408 | 2409 | CURL_EXTERN CURLSH *curl_share_init(void); 2410 | CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); 2411 | CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); 2412 | 2413 | /**************************************************************************** 2414 | * Structures for querying information about the curl library at runtime. 2415 | */ 2416 | 2417 | typedef enum { 2418 | CURLVERSION_FIRST, 2419 | CURLVERSION_SECOND, 2420 | CURLVERSION_THIRD, 2421 | CURLVERSION_FOURTH, 2422 | CURLVERSION_LAST /* never actually use this */ 2423 | } CURLversion; 2424 | 2425 | /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by 2426 | basically all programs ever that want to get version information. It is 2427 | meant to be a built-in version number for what kind of struct the caller 2428 | expects. If the struct ever changes, we redefine the NOW to another enum 2429 | from above. */ 2430 | #define CURLVERSION_NOW CURLVERSION_FOURTH 2431 | 2432 | typedef struct { 2433 | CURLversion age; /* age of the returned struct */ 2434 | const char *version; /* LIBCURL_VERSION */ 2435 | unsigned int version_num; /* LIBCURL_VERSION_NUM */ 2436 | const char *host; /* OS/host/cpu/machine when configured */ 2437 | int features; /* bitmask, see defines below */ 2438 | const char *ssl_version; /* human readable string */ 2439 | long ssl_version_num; /* not used anymore, always 0 */ 2440 | const char *libz_version; /* human readable string */ 2441 | /* protocols is terminated by an entry with a NULL protoname */ 2442 | const char * const *protocols; 2443 | 2444 | /* The fields below this were added in CURLVERSION_SECOND */ 2445 | const char *ares; 2446 | int ares_num; 2447 | 2448 | /* This field was added in CURLVERSION_THIRD */ 2449 | const char *libidn; 2450 | 2451 | /* These field were added in CURLVERSION_FOURTH */ 2452 | 2453 | /* Same as '_libiconv_version' if built with HAVE_ICONV */ 2454 | int iconv_ver_num; 2455 | 2456 | const char *libssh_version; /* human readable string */ 2457 | 2458 | } curl_version_info_data; 2459 | 2460 | #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ 2461 | #define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported 2462 | (deprecated) */ 2463 | #define CURL_VERSION_SSL (1<<2) /* SSL options are present */ 2464 | #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ 2465 | #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ 2466 | #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported 2467 | (deprecated) */ 2468 | #define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */ 2469 | #define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */ 2470 | #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */ 2471 | #define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */ 2472 | #define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are 2473 | supported */ 2474 | #define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */ 2475 | #define CURL_VERSION_CONV (1<<12) /* Character conversions supported */ 2476 | #define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */ 2477 | #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ 2478 | #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper 2479 | is supported */ 2480 | #define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */ 2481 | #define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */ 2482 | #define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */ 2483 | #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */ 2484 | #define CURL_VERSION_PSL (1<<20) /* Mozilla's Public Suffix List, used 2485 | for cookie domain verification */ 2486 | #define CURL_VERSION_HTTPS_PROXY (1<<21) /* HTTPS-proxy support built-in */ 2487 | 2488 | /* 2489 | * NAME curl_version_info() 2490 | * 2491 | * DESCRIPTION 2492 | * 2493 | * This function returns a pointer to a static copy of the version info 2494 | * struct. See above. 2495 | */ 2496 | CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); 2497 | 2498 | /* 2499 | * NAME curl_easy_strerror() 2500 | * 2501 | * DESCRIPTION 2502 | * 2503 | * The curl_easy_strerror function may be used to turn a CURLcode value 2504 | * into the equivalent human readable error string. This is useful 2505 | * for printing meaningful error messages. 2506 | */ 2507 | CURL_EXTERN const char *curl_easy_strerror(CURLcode); 2508 | 2509 | /* 2510 | * NAME curl_share_strerror() 2511 | * 2512 | * DESCRIPTION 2513 | * 2514 | * The curl_share_strerror function may be used to turn a CURLSHcode value 2515 | * into the equivalent human readable error string. This is useful 2516 | * for printing meaningful error messages. 2517 | */ 2518 | CURL_EXTERN const char *curl_share_strerror(CURLSHcode); 2519 | 2520 | /* 2521 | * NAME curl_easy_pause() 2522 | * 2523 | * DESCRIPTION 2524 | * 2525 | * The curl_easy_pause function pauses or unpauses transfers. Select the new 2526 | * state by setting the bitmask, use the convenience defines below. 2527 | * 2528 | */ 2529 | CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); 2530 | 2531 | #define CURLPAUSE_RECV (1<<0) 2532 | #define CURLPAUSE_RECV_CONT (0) 2533 | 2534 | #define CURLPAUSE_SEND (1<<2) 2535 | #define CURLPAUSE_SEND_CONT (0) 2536 | 2537 | #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) 2538 | #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) 2539 | 2540 | #ifdef __cplusplus 2541 | } 2542 | #endif 2543 | 2544 | /* unfortunately, the easy.h and multi.h include files need options and info 2545 | stuff before they can be included! */ 2546 | //#include "easy.h" /* nothing in curl is fun without the easy stuff */ 2547 | //#include "multi.h" 2548 | 2549 | /* the typechecker doesn't work in C++ (yet) */ 2550 | #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ 2551 | ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ 2552 | !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) 2553 | #include "typecheck-gcc.h" 2554 | #else 2555 | #if defined(__STDC__) && (__STDC__ >= 1) 2556 | /* This preprocessor magic that replaces a call with the exact same call is 2557 | only done to make sure application authors pass exactly three arguments 2558 | to these functions. */ 2559 | #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) 2560 | #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) 2561 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 2562 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 2563 | #endif /* __STDC__ >= 1 */ 2564 | #endif /* gcc >= 4.3 && !__cplusplus */ 2565 | 2566 | #endif /* __CURL_CURL_H */ 2567 | -------------------------------------------------------------------------------- /curlhooks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "curl.h" 3 | #include "url.h" 4 | 5 | // Pick your poison 6 | //#define URL_HOST "v3.fortnite.dev" 7 | //#define URL_HOST "aurorafn.dev" 8 | 9 | #define LOG_URLS 10 | 11 | CURLcode(*curl_setopt)(struct Curl_easy*, CURLoption, va_list) = nullptr; 12 | CURLcode(*curl_easy_setopt)(struct Curl_easy*, CURLoption, ...) = nullptr; 13 | 14 | CURLcode curl_setopt_(struct Curl_easy* data, CURLoption option, ...) { 15 | va_list arg; 16 | va_start(arg, option); 17 | 18 | CURLcode result = curl_setopt(data, option, arg); 19 | 20 | va_end(arg); 21 | return result; 22 | } 23 | 24 | CURLcode curl_easy_setopt_detour(struct Curl_easy* data, CURLoption tag, ...) { 25 | va_list arg; 26 | va_start(arg, tag); 27 | 28 | CURLcode result; 29 | 30 | if (!data) 31 | return CURLE_BAD_FUNCTION_ARGUMENT; 32 | 33 | if (tag == CURLOPT_SSL_VERIFYPEER) { 34 | result = curl_setopt_(data, tag, 0); 35 | } 36 | else if (tag == CURLOPT_URL) { 37 | char* url = va_arg(arg, char*); 38 | if (!memcmp(url, "https", 5)) { 39 | url[1] = 'h'; 40 | url[2] = 't'; 41 | url[3] = 't'; 42 | url[4] = 'p'; 43 | url++; 44 | } 45 | printf("URL: %s\n", url); 46 | result = curl_setopt_(data, CURLOPT_SSL_VERIFYPEER, 0); 47 | result = curl_setopt_(data, tag, url); 48 | } 49 | #ifdef URL_HOST 50 | else if (tag == CURLOPT_URL) { 51 | std::string url = va_arg(arg, char*); 52 | size_t length = url.length(); 53 | 54 | Uri uri = Uri::Parse(url); 55 | if (uri.Host.ends_with(".ol.epicgames.com")) { 56 | url = Uri::CreateUri(uri.Protocol, URL_HOST, uri.Port, uri.Path, uri.QueryString); 57 | } 58 | if (url.length() < length) { 59 | url.append(length - url.length(), ' '); // buffer size checking can occur 60 | } 61 | 62 | #ifdef LOG_URLS 63 | printf("Url logged: %s\n", tag, url.c_str()); 64 | #endif 65 | 66 | result = curl_setopt_(data, tag, url.c_str()); 67 | } 68 | #endif 69 | else { 70 | result = curl_setopt(data, tag, arg); 71 | } 72 | 73 | va_end(arg); 74 | return result; 75 | } -------------------------------------------------------------------------------- /curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLVER_H 2 | #define __CURL_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2017, 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 https://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 - 2017 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.55.1" 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 55 39 | #define LIBCURL_VERSION_PATCH 1 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 0x073701 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 follows this template: 68 | * 69 | * "2007-11-23" 70 | */ 71 | #define LIBCURL_TIMESTAMP "2017-08-14" 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 | -------------------------------------------------------------------------------- /detver.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Common version parameters. 4 | // 5 | // Microsoft Research Detours Package, Version 3.0 Build_316. 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | 10 | #ifndef DETOURS_STRINGIFY 11 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x) 12 | #define DETOURS_STRINGIFY_(x) #x 13 | #endif 14 | 15 | #define VER_FILEFLAGSMASK 0x3fL 16 | #define VER_FILEFLAGS 0x0L 17 | #define VER_FILEOS 0x00040004L 18 | #define VER_FILETYPE 0x00000002L 19 | #define VER_FILESUBTYPE 0x00000000L 20 | 21 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS) 22 | -------------------------------------------------------------------------------- /dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "curlhooks.h" 3 | 4 | #include 5 | 6 | #define USE_CONSOLE 7 | 8 | void* FindPattern(const char* pattern, size_t patternSize) 9 | { 10 | MODULEINFO modInfo; 11 | GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &modInfo, sizeof(modInfo)); 12 | 13 | auto base = (size_t)modInfo.lpBaseOfDll; 14 | 15 | for (size_t i = 0; i < modInfo.SizeOfImage - patternSize; i++) 16 | { 17 | bool found = true; 18 | for (size_t j = 0; j < patternSize && found; j++) 19 | { 20 | found = pattern[j] == *(char*)(base + i + j); 21 | } 22 | if (found) 23 | { 24 | return (void*)(base + i); 25 | } 26 | } 27 | return NULL; 28 | } 29 | 30 | LPCVOID redir_func_ptr; 31 | LPCVOID orig_func_ptr; 32 | 33 | LONG ExcHandler(EXCEPTION_POINTERS* ExceptionInfo) { 34 | if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_GUARD_PAGE) { 35 | if (ExceptionInfo->ContextRecord->Rip == (DWORD64)orig_func_ptr) { 36 | ExceptionInfo->ContextRecord->Rip = (DWORD64)redir_func_ptr; 37 | } 38 | ExceptionInfo->ContextRecord->EFlags |= 0x100; // http://www.c-jump.com/CIS77/ASM/Instructions/I77_0070_eflags_bits.htm (bit 8) 39 | return EXCEPTION_CONTINUE_EXECUTION; 40 | } 41 | else if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP) { 42 | DWORD oldFlags; 43 | VirtualProtect((LPVOID)orig_func_ptr, 1, PAGE_GUARD | PAGE_EXECUTE_READ, &oldFlags); 44 | return EXCEPTION_CONTINUE_EXECUTION; 45 | } 46 | return EXCEPTION_CONTINUE_SEARCH; 47 | } 48 | 49 | void EnableHook(const void* origFuncPtr, const void* redirFuncPtr) { 50 | MEMORY_BASIC_INFORMATION redirMemInfo; 51 | MEMORY_BASIC_INFORMATION origMemInfo; 52 | 53 | redir_func_ptr = redirFuncPtr; 54 | orig_func_ptr = origFuncPtr; 55 | if (VirtualQuery(orig_func_ptr, &origMemInfo, sizeof(origMemInfo)) && VirtualQuery(redir_func_ptr, &redirMemInfo, sizeof(redirMemInfo))) { 56 | if (origMemInfo.BaseAddress != redirMemInfo.BaseAddress) { 57 | if (AddVectoredExceptionHandler(1, ExcHandler)) { 58 | DWORD oldFlags; 59 | VirtualProtect((LPVOID)orig_func_ptr, 1, PAGE_GUARD | PAGE_EXECUTE_READ, &oldFlags); 60 | } 61 | } 62 | } 63 | } 64 | 65 | constexpr const char* CurlEasySetOptPattern = "\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x48\x83\xEC\x28\x48\x85\xC9\x75\x08\x8D\x41\x2B\x48\x83\xC4\x28\xC3\x4C"; 66 | constexpr const char* CurlSetOptPattern = "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x30\x33\xED\x49\x8B\xF0\x48\x8B\xD9"; 67 | 68 | void Main() { 69 | #ifdef USE_CONSOLE 70 | AllocConsole(); 71 | FILE* pFile; 72 | freopen_s(&pFile, "CONOUT$", "w", stdout); 73 | #endif 74 | 75 | auto easy_find = FindPattern(CurlEasySetOptPattern, 0x20); 76 | auto set_find = FindPattern(CurlSetOptPattern, 0x1c); 77 | 78 | curl_easy_setopt = (decltype(curl_easy_setopt))easy_find; 79 | curl_setopt = (decltype(curl_setopt))set_find; 80 | 81 | EnableHook(curl_easy_setopt, curl_easy_setopt_detour); 82 | } 83 | 84 | BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) 85 | { 86 | switch (dwReason) 87 | { 88 | case DLL_PROCESS_ATTACH: 89 | Main(); 90 | break; 91 | case DLL_PROCESS_DETACH: 92 | case DLL_THREAD_ATTACH: 93 | case DLL_THREAD_DETACH: 94 | default: 95 | break; 96 | } 97 | return TRUE; 98 | } -------------------------------------------------------------------------------- /framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include 5 | #include -------------------------------------------------------------------------------- /manifest.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | 7 | VS_VERSION_INFO VERSIONINFO 8 | FILEVERSION 1, 0, 0, 0 9 | PRODUCTVERSION 1, 0, 0, 0 10 | { 11 | BLOCK "StringFileInfo" 12 | { 13 | BLOCK "040904b0" 14 | { 15 | VALUE "Comments", "Platanium" 16 | VALUE "CompanyName", "WorkingRobot" 17 | 18 | VALUE "FileDescription", "Platanium" 19 | VALUE "FileVersion", "1.0.0.0" 20 | VALUE "InternalName", "platanium" 21 | VALUE "LegalCopyright", "Platanium (c) by Aleks Margarian (WorkingRobot)" 22 | 23 | VALUE "OriginalFilename", "Platanium.dll" 24 | VALUE "ProductName", "Platanium" 25 | VALUE "ProductVersion", "1.0.0.0" 26 | } 27 | } 28 | BLOCK "VarFileInfo" 29 | { 30 | VALUE "Translation", 0x409, 1200 31 | } 32 | } -------------------------------------------------------------------------------- /pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /pch.h: -------------------------------------------------------------------------------- 1 | #ifndef PCH_H 2 | #define PCH_H 3 | 4 | #include "framework.h" 5 | 6 | #endif // PCH_H 7 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Resource.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | //{{NO_DEPENDENCIES}} 16 | // Microsoft Visual C++ generated include file. 17 | // Used by Resource.rc 18 | 19 | // Next default values for new objects 20 | // 21 | #ifdef APSTUDIO_INVOKED 22 | #ifndef APSTUDIO_READONLY_SYMBOLS 23 | #define _APS_NEXT_RESOURCE_VALUE 101 24 | #define _APS_NEXT_COMMAND_VALUE 40001 25 | #define _APS_NEXT_CONTROL_VALUE 1001 26 | #define _APS_NEXT_SYMED_VALUE 101 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /system.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_SYSTEM_H 2 | #define __CURL_SYSTEM_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2017, 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 https://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 | * Try to keep one section per platform, compiler and architecture, otherwise, 27 | * if an existing section is reused for a different one and later on the 28 | * original is adjusted, probably the piggybacking one can be adversely 29 | * changed. 30 | * 31 | * In order to differentiate between platforms/compilers/architectures use 32 | * only compiler built in predefined preprocessor symbols. 33 | * 34 | * curl_off_t 35 | * ---------- 36 | * 37 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit 38 | * wide signed integral data type. The width of this data type must remain 39 | * constant and independent of any possible large file support settings. 40 | * 41 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit 42 | * wide signed integral data type if there is no 64-bit type. 43 | * 44 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall 45 | * only be violated if off_t is the only 64-bit data type available and the 46 | * size of off_t is independent of large file support settings. Keep your 47 | * build on the safe side avoiding an off_t gating. If you have a 64-bit 48 | * off_t then take for sure that another 64-bit data type exists, dig deeper 49 | * and you will find it. 50 | * 51 | */ 52 | 53 | #if defined(__DJGPP__) || defined(__GO32__) 54 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 55 | # define CURL_SIZEOF_LONG 4 56 | # define CURL_TYPEOF_CURL_OFF_T long long 57 | # define CURL_FORMAT_CURL_OFF_T "lld" 58 | # define CURL_FORMAT_CURL_OFF_TU "llu" 59 | # define CURL_SIZEOF_CURL_OFF_T 8 60 | # define CURL_SUFFIX_CURL_OFF_T LL 61 | # define CURL_SUFFIX_CURL_OFF_TU ULL 62 | # else 63 | # define CURL_SIZEOF_LONG 4 64 | # define CURL_TYPEOF_CURL_OFF_T long 65 | # define CURL_FORMAT_CURL_OFF_T "ld" 66 | # define CURL_FORMAT_CURL_OFF_TU "lu" 67 | # define CURL_SIZEOF_CURL_OFF_T 4 68 | # define CURL_SUFFIX_CURL_OFF_T L 69 | # define CURL_SUFFIX_CURL_OFF_TU UL 70 | # endif 71 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 72 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 73 | 74 | #elif defined(__SALFORDC__) 75 | # define CURL_SIZEOF_LONG 4 76 | # define CURL_TYPEOF_CURL_OFF_T long 77 | # define CURL_FORMAT_CURL_OFF_T "ld" 78 | # define CURL_FORMAT_CURL_OFF_TU "lu" 79 | # define CURL_SIZEOF_CURL_OFF_T 4 80 | # define CURL_SUFFIX_CURL_OFF_T L 81 | # define CURL_SUFFIX_CURL_OFF_TU UL 82 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 83 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 84 | 85 | #elif defined(__BORLANDC__) 86 | # if (__BORLANDC__ < 0x520) 87 | # define CURL_SIZEOF_LONG 4 88 | # define CURL_TYPEOF_CURL_OFF_T long 89 | # define CURL_FORMAT_CURL_OFF_T "ld" 90 | # define CURL_FORMAT_CURL_OFF_TU "lu" 91 | # define CURL_SIZEOF_CURL_OFF_T 4 92 | # define CURL_SUFFIX_CURL_OFF_T L 93 | # define CURL_SUFFIX_CURL_OFF_TU UL 94 | # else 95 | # define CURL_SIZEOF_LONG 4 96 | # define CURL_TYPEOF_CURL_OFF_T __int64 97 | # define CURL_FORMAT_CURL_OFF_T "I64d" 98 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 99 | # define CURL_SIZEOF_CURL_OFF_T 8 100 | # define CURL_SUFFIX_CURL_OFF_T i64 101 | # define CURL_SUFFIX_CURL_OFF_TU ui64 102 | # endif 103 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 104 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 105 | 106 | #elif defined(__TURBOC__) 107 | # define CURL_SIZEOF_LONG 4 108 | # define CURL_TYPEOF_CURL_OFF_T long 109 | # define CURL_FORMAT_CURL_OFF_T "ld" 110 | # define CURL_FORMAT_CURL_OFF_TU "lu" 111 | # define CURL_SIZEOF_CURL_OFF_T 4 112 | # define CURL_SUFFIX_CURL_OFF_T L 113 | # define CURL_SUFFIX_CURL_OFF_TU UL 114 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 115 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 116 | 117 | #elif defined(__WATCOMC__) 118 | # if defined(__386__) 119 | # define CURL_SIZEOF_LONG 4 120 | # define CURL_TYPEOF_CURL_OFF_T __int64 121 | # define CURL_FORMAT_CURL_OFF_T "I64d" 122 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 123 | # define CURL_SIZEOF_CURL_OFF_T 8 124 | # define CURL_SUFFIX_CURL_OFF_T i64 125 | # define CURL_SUFFIX_CURL_OFF_TU ui64 126 | # else 127 | # define CURL_SIZEOF_LONG 4 128 | # define CURL_TYPEOF_CURL_OFF_T long 129 | # define CURL_FORMAT_CURL_OFF_T "ld" 130 | # define CURL_FORMAT_CURL_OFF_TU "lu" 131 | # define CURL_SIZEOF_CURL_OFF_T 4 132 | # define CURL_SUFFIX_CURL_OFF_T L 133 | # define CURL_SUFFIX_CURL_OFF_TU UL 134 | # endif 135 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 136 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 137 | 138 | #elif defined(__POCC__) 139 | # if (__POCC__ < 280) 140 | # define CURL_SIZEOF_LONG 4 141 | # define CURL_TYPEOF_CURL_OFF_T long 142 | # define CURL_FORMAT_CURL_OFF_T "ld" 143 | # define CURL_FORMAT_CURL_OFF_TU "lu" 144 | # define CURL_SIZEOF_CURL_OFF_T 4 145 | # define CURL_SUFFIX_CURL_OFF_T L 146 | # define CURL_SUFFIX_CURL_OFF_TU UL 147 | # elif defined(_MSC_VER) 148 | # define CURL_SIZEOF_LONG 4 149 | # define CURL_TYPEOF_CURL_OFF_T __int64 150 | # define CURL_FORMAT_CURL_OFF_T "I64d" 151 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 152 | # define CURL_SIZEOF_CURL_OFF_T 8 153 | # define CURL_SUFFIX_CURL_OFF_T i64 154 | # define CURL_SUFFIX_CURL_OFF_TU ui64 155 | # else 156 | # define CURL_SIZEOF_LONG 4 157 | # define CURL_TYPEOF_CURL_OFF_T long long 158 | # define CURL_FORMAT_CURL_OFF_T "lld" 159 | # define CURL_FORMAT_CURL_OFF_TU "llu" 160 | # define CURL_SIZEOF_CURL_OFF_T 8 161 | # define CURL_SUFFIX_CURL_OFF_T LL 162 | # define CURL_SUFFIX_CURL_OFF_TU ULL 163 | # endif 164 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 165 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 166 | 167 | #elif defined(__LCC__) 168 | # define CURL_SIZEOF_LONG 4 169 | # define CURL_TYPEOF_CURL_OFF_T long 170 | # define CURL_FORMAT_CURL_OFF_T "ld" 171 | # define CURL_FORMAT_CURL_OFF_TU "lu" 172 | # define CURL_SIZEOF_CURL_OFF_T 4 173 | # define CURL_SUFFIX_CURL_OFF_T L 174 | # define CURL_SUFFIX_CURL_OFF_TU UL 175 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 176 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 177 | 178 | #elif defined(__SYMBIAN32__) 179 | # if defined(__EABI__) /* Treat all ARM compilers equally */ 180 | # define CURL_SIZEOF_LONG 4 181 | # define CURL_TYPEOF_CURL_OFF_T long long 182 | # define CURL_FORMAT_CURL_OFF_T "lld" 183 | # define CURL_FORMAT_CURL_OFF_TU "llu" 184 | # define CURL_SIZEOF_CURL_OFF_T 8 185 | # define CURL_SUFFIX_CURL_OFF_T LL 186 | # define CURL_SUFFIX_CURL_OFF_TU ULL 187 | # elif defined(__CW32__) 188 | # pragma longlong on 189 | # define CURL_SIZEOF_LONG 4 190 | # define CURL_TYPEOF_CURL_OFF_T long long 191 | # define CURL_FORMAT_CURL_OFF_T "lld" 192 | # define CURL_FORMAT_CURL_OFF_TU "llu" 193 | # define CURL_SIZEOF_CURL_OFF_T 8 194 | # define CURL_SUFFIX_CURL_OFF_T LL 195 | # define CURL_SUFFIX_CURL_OFF_TU ULL 196 | # elif defined(__VC32__) 197 | # define CURL_SIZEOF_LONG 4 198 | # define CURL_TYPEOF_CURL_OFF_T __int64 199 | # define CURL_FORMAT_CURL_OFF_T "lld" 200 | # define CURL_FORMAT_CURL_OFF_TU "llu" 201 | # define CURL_SIZEOF_CURL_OFF_T 8 202 | # define CURL_SUFFIX_CURL_OFF_T LL 203 | # define CURL_SUFFIX_CURL_OFF_TU ULL 204 | # endif 205 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 206 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 207 | 208 | #elif defined(__MWERKS__) 209 | # define CURL_SIZEOF_LONG 4 210 | # define CURL_TYPEOF_CURL_OFF_T long long 211 | # define CURL_FORMAT_CURL_OFF_T "lld" 212 | # define CURL_FORMAT_CURL_OFF_TU "llu" 213 | # define CURL_SIZEOF_CURL_OFF_T 8 214 | # define CURL_SUFFIX_CURL_OFF_T LL 215 | # define CURL_SUFFIX_CURL_OFF_TU ULL 216 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 217 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 218 | 219 | #elif defined(_WIN32_WCE) 220 | # define CURL_SIZEOF_LONG 4 221 | # define CURL_TYPEOF_CURL_OFF_T __int64 222 | # define CURL_FORMAT_CURL_OFF_T "I64d" 223 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 224 | # define CURL_SIZEOF_CURL_OFF_T 8 225 | # define CURL_SUFFIX_CURL_OFF_T i64 226 | # define CURL_SUFFIX_CURL_OFF_TU ui64 227 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 228 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 229 | 230 | #elif defined(__MINGW32__) 231 | # define CURL_SIZEOF_LONG 4 232 | # define CURL_TYPEOF_CURL_OFF_T long long 233 | # define CURL_FORMAT_CURL_OFF_T "I64d" 234 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 235 | # define CURL_SIZEOF_CURL_OFF_T 8 236 | # define CURL_SUFFIX_CURL_OFF_T LL 237 | # define CURL_SUFFIX_CURL_OFF_TU ULL 238 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 239 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 240 | # define CURL_PULL_SYS_TYPES_H 1 241 | # define CURL_PULL_WS2TCPIP_H 1 242 | 243 | #elif defined(__VMS) 244 | # if defined(__VAX) 245 | # define CURL_SIZEOF_LONG 4 246 | # define CURL_TYPEOF_CURL_OFF_T long 247 | # define CURL_FORMAT_CURL_OFF_T "ld" 248 | # define CURL_FORMAT_CURL_OFF_TU "lu" 249 | # define CURL_SIZEOF_CURL_OFF_T 4 250 | # define CURL_SUFFIX_CURL_OFF_T L 251 | # define CURL_SUFFIX_CURL_OFF_TU UL 252 | # else 253 | # define CURL_SIZEOF_LONG 4 254 | # define CURL_TYPEOF_CURL_OFF_T long long 255 | # define CURL_FORMAT_CURL_OFF_T "lld" 256 | # define CURL_FORMAT_CURL_OFF_TU "llu" 257 | # define CURL_SIZEOF_CURL_OFF_T 8 258 | # define CURL_SUFFIX_CURL_OFF_T LL 259 | # define CURL_SUFFIX_CURL_OFF_TU ULL 260 | # endif 261 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 262 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 263 | 264 | #elif defined(__OS400__) 265 | # if defined(__ILEC400__) 266 | # define CURL_SIZEOF_LONG 4 267 | # define CURL_TYPEOF_CURL_OFF_T long long 268 | # define CURL_FORMAT_CURL_OFF_T "lld" 269 | # define CURL_FORMAT_CURL_OFF_TU "llu" 270 | # define CURL_SIZEOF_CURL_OFF_T 8 271 | # define CURL_SUFFIX_CURL_OFF_T LL 272 | # define CURL_SUFFIX_CURL_OFF_TU ULL 273 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 274 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 275 | # define CURL_PULL_SYS_TYPES_H 1 276 | # define CURL_PULL_SYS_SOCKET_H 1 277 | # endif 278 | 279 | #elif defined(__MVS__) 280 | # if defined(__IBMC__) || defined(__IBMCPP__) 281 | # if defined(_ILP32) 282 | # define CURL_SIZEOF_LONG 4 283 | # elif defined(_LP64) 284 | # define CURL_SIZEOF_LONG 8 285 | # endif 286 | # if defined(_LONG_LONG) 287 | # define CURL_TYPEOF_CURL_OFF_T long long 288 | # define CURL_FORMAT_CURL_OFF_T "lld" 289 | # define CURL_FORMAT_CURL_OFF_TU "llu" 290 | # define CURL_SIZEOF_CURL_OFF_T 8 291 | # define CURL_SUFFIX_CURL_OFF_T LL 292 | # define CURL_SUFFIX_CURL_OFF_TU ULL 293 | # elif defined(_LP64) 294 | # define CURL_TYPEOF_CURL_OFF_T long 295 | # define CURL_FORMAT_CURL_OFF_T "ld" 296 | # define CURL_FORMAT_CURL_OFF_TU "lu" 297 | # define CURL_SIZEOF_CURL_OFF_T 8 298 | # define CURL_SUFFIX_CURL_OFF_T L 299 | # define CURL_SUFFIX_CURL_OFF_TU UL 300 | # else 301 | # define CURL_TYPEOF_CURL_OFF_T long 302 | # define CURL_FORMAT_CURL_OFF_T "ld" 303 | # define CURL_FORMAT_CURL_OFF_TU "lu" 304 | # define CURL_SIZEOF_CURL_OFF_T 4 305 | # define CURL_SUFFIX_CURL_OFF_T L 306 | # define CURL_SUFFIX_CURL_OFF_TU UL 307 | # endif 308 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 309 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 310 | # define CURL_PULL_SYS_TYPES_H 1 311 | # define CURL_PULL_SYS_SOCKET_H 1 312 | # endif 313 | 314 | #elif defined(__370__) 315 | # if defined(__IBMC__) || defined(__IBMCPP__) 316 | # if defined(_ILP32) 317 | # define CURL_SIZEOF_LONG 4 318 | # elif defined(_LP64) 319 | # define CURL_SIZEOF_LONG 8 320 | # endif 321 | # if defined(_LONG_LONG) 322 | # define CURL_TYPEOF_CURL_OFF_T long long 323 | # define CURL_FORMAT_CURL_OFF_T "lld" 324 | # define CURL_FORMAT_CURL_OFF_TU "llu" 325 | # define CURL_SIZEOF_CURL_OFF_T 8 326 | # define CURL_SUFFIX_CURL_OFF_T LL 327 | # define CURL_SUFFIX_CURL_OFF_TU ULL 328 | # elif defined(_LP64) 329 | # define CURL_TYPEOF_CURL_OFF_T long 330 | # define CURL_FORMAT_CURL_OFF_T "ld" 331 | # define CURL_FORMAT_CURL_OFF_TU "lu" 332 | # define CURL_SIZEOF_CURL_OFF_T 8 333 | # define CURL_SUFFIX_CURL_OFF_T L 334 | # define CURL_SUFFIX_CURL_OFF_TU UL 335 | # else 336 | # define CURL_TYPEOF_CURL_OFF_T long 337 | # define CURL_FORMAT_CURL_OFF_T "ld" 338 | # define CURL_FORMAT_CURL_OFF_TU "lu" 339 | # define CURL_SIZEOF_CURL_OFF_T 4 340 | # define CURL_SUFFIX_CURL_OFF_T L 341 | # define CURL_SUFFIX_CURL_OFF_TU UL 342 | # endif 343 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 344 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 345 | # define CURL_PULL_SYS_TYPES_H 1 346 | # define CURL_PULL_SYS_SOCKET_H 1 347 | # endif 348 | 349 | #elif defined(TPF) 350 | # define CURL_SIZEOF_LONG 8 351 | # define CURL_TYPEOF_CURL_OFF_T long 352 | # define CURL_FORMAT_CURL_OFF_T "ld" 353 | # define CURL_FORMAT_CURL_OFF_TU "lu" 354 | # define CURL_SIZEOF_CURL_OFF_T 8 355 | # define CURL_SUFFIX_CURL_OFF_T L 356 | # define CURL_SUFFIX_CURL_OFF_TU UL 357 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 358 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 359 | 360 | #elif defined(__TINYC__) /* also known as tcc */ 361 | 362 | # define CURL_SIZEOF_LONG 4 363 | # define CURL_TYPEOF_CURL_OFF_T long long 364 | # define CURL_FORMAT_CURL_OFF_T "lld" 365 | # define CURL_FORMAT_CURL_OFF_TU "llu" 366 | # define CURL_SIZEOF_CURL_OFF_T 8 367 | # define CURL_SUFFIX_CURL_OFF_T LL 368 | # define CURL_SUFFIX_CURL_OFF_TU ULL 369 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 370 | # define CURL_PULL_SYS_TYPES_H 1 371 | # define CURL_PULL_SYS_SOCKET_H 1 372 | 373 | #elif defined(__SUNPRO_C) /* Oracle Solaris Studio */ 374 | # if !defined(__LP64) && (defined(__ILP32) || \ 375 | defined(__i386) || defined(__sparcv8)) 376 | # define CURL_SIZEOF_LONG 4 377 | # define CURL_TYPEOF_CURL_OFF_T long long 378 | # define CURL_FORMAT_CURL_OFF_T "lld" 379 | # define CURL_FORMAT_CURL_OFF_TU "llu" 380 | # define CURL_SIZEOF_CURL_OFF_T 8 381 | # define CURL_SUFFIX_CURL_OFF_T LL 382 | # define CURL_SUFFIX_CURL_OFF_TU ULL 383 | # elif defined(__LP64) || \ 384 | defined(__amd64) || defined(__sparcv9) 385 | # define CURL_SIZEOF_LONG 8 386 | # define CURL_TYPEOF_CURL_OFF_T long 387 | # define CURL_FORMAT_CURL_OFF_T "ld" 388 | # define CURL_FORMAT_CURL_OFF_TU "lu" 389 | # define CURL_SIZEOF_CURL_OFF_T 8 390 | # define CURL_SUFFIX_CURL_OFF_T L 391 | # define CURL_SUFFIX_CURL_OFF_TU UL 392 | # endif 393 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 394 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 395 | # define CURL_PULL_SYS_TYPES_H 1 396 | # define CURL_PULL_SYS_SOCKET_H 1 397 | 398 | /* ===================================== */ 399 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 400 | /* ===================================== */ 401 | 402 | #elif defined(_MSC_VER) 403 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 404 | # define CURL_SIZEOF_LONG 4 405 | # define CURL_TYPEOF_CURL_OFF_T __int64 406 | # define CURL_FORMAT_CURL_OFF_T "I64d" 407 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 408 | # define CURL_SIZEOF_CURL_OFF_T 8 409 | # define CURL_SUFFIX_CURL_OFF_T i64 410 | # define CURL_SUFFIX_CURL_OFF_TU ui64 411 | # else 412 | # define CURL_SIZEOF_LONG 4 413 | # define CURL_TYPEOF_CURL_OFF_T long 414 | # define CURL_FORMAT_CURL_OFF_T "ld" 415 | # define CURL_FORMAT_CURL_OFF_TU "lu" 416 | # define CURL_SIZEOF_CURL_OFF_T 4 417 | # define CURL_SUFFIX_CURL_OFF_T L 418 | # define CURL_SUFFIX_CURL_OFF_TU UL 419 | # endif 420 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 421 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 422 | 423 | /* ===================================== */ 424 | /* KEEP GENERIC GCC THE LAST ENTRY */ 425 | /* ===================================== */ 426 | 427 | #elif defined(__GNUC__) 428 | # if !defined(__LP64__) && (defined(__ILP32__) || \ 429 | defined(__i386__) || defined(__powerpc__) || defined(__arm__) || \ 430 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ 431 | defined(__XTENSA__) || (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4)) 432 | # define CURL_SIZEOF_LONG 4 433 | # define CURL_TYPEOF_CURL_OFF_T long long 434 | # define CURL_FORMAT_CURL_OFF_T "lld" 435 | # define CURL_FORMAT_CURL_OFF_TU "llu" 436 | # define CURL_SIZEOF_CURL_OFF_T 8 437 | # define CURL_SUFFIX_CURL_OFF_T LL 438 | # define CURL_SUFFIX_CURL_OFF_TU ULL 439 | # elif defined(__LP64__) || \ 440 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ 441 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) 442 | # define CURL_SIZEOF_LONG 8 443 | # define CURL_TYPEOF_CURL_OFF_T long 444 | # define CURL_FORMAT_CURL_OFF_T "ld" 445 | # define CURL_FORMAT_CURL_OFF_TU "lu" 446 | # define CURL_SIZEOF_CURL_OFF_T 8 447 | # define CURL_SUFFIX_CURL_OFF_T L 448 | # define CURL_SUFFIX_CURL_OFF_TU UL 449 | # endif 450 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 451 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 452 | # define CURL_PULL_SYS_TYPES_H 1 453 | # define CURL_PULL_SYS_SOCKET_H 1 454 | 455 | #else 456 | /* generic "safe guess" on old 32 bit style */ 457 | # define CURL_SIZEOF_LONG 4 458 | # define CURL_SIZEOF_CURL_SOCKLEN_T 4 459 | # define CURL_SIZEOF_CURL_OFF_T 4 460 | # define CURL_TYPEOF_CURL_OFF_T long 461 | # define CURL_FORMAT_CURL_OFF_T "ld" 462 | # define CURL_FORMAT_CURL_OFF_TU "lu" 463 | # define CURL_SUFFIX_CURL_OFF_T L 464 | # define CURL_SUFFIX_CURL_OFF_TU UL 465 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 466 | #endif 467 | 468 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ 469 | /* ws2tcpip.h is required here to properly make type definitions below. */ 470 | #ifdef CURL_PULL_WS2TCPIP_H 471 | # include 472 | # include 473 | # include 474 | #endif 475 | 476 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 477 | /* sys/types.h is required here to properly make type definitions below. */ 478 | #ifdef CURL_PULL_SYS_TYPES_H 479 | # include 480 | #endif 481 | 482 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 483 | /* sys/socket.h is required here to properly make type definitions below. */ 484 | #ifdef CURL_PULL_SYS_SOCKET_H 485 | # include 486 | #endif 487 | 488 | /* Data type definition of curl_socklen_t. */ 489 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 490 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 491 | #endif 492 | 493 | /* Data type definition of curl_off_t. */ 494 | 495 | #ifdef CURL_TYPEOF_CURL_OFF_T 496 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 497 | #endif 498 | 499 | /* 500 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 501 | * these to be visible and exported by the external libcurl interface API, 502 | * while also making them visible to the library internals, simply including 503 | * curl_setup.h, without actually needing to include curl.h internally. 504 | * If some day this section would grow big enough, all this should be moved 505 | * to its own header file. 506 | */ 507 | 508 | /* 509 | * Figure out if we can use the ## preprocessor operator, which is supported 510 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 511 | * or __cplusplus so we need to carefully check for them too. 512 | */ 513 | 514 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 515 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 516 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 517 | defined(__ILEC400__) 518 | /* This compiler is believed to have an ISO compatible preprocessor */ 519 | #define CURL_ISOCPP 520 | #else 521 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 522 | #undef CURL_ISOCPP 523 | #endif 524 | 525 | /* 526 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 527 | */ 528 | 529 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 530 | # define __CURL_OFF_T_C_HLPR2(x) x 531 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) 532 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 533 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 534 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 535 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 536 | #else 537 | # ifdef CURL_ISOCPP 538 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 539 | # else 540 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 541 | # endif 542 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) 543 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 544 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 545 | #endif 546 | 547 | #endif /* __CURL_SYSTEM_H */ 548 | -------------------------------------------------------------------------------- /url.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | // Somewhat taken from https://stackoverflow.com/a/11044337 8 | 9 | struct Uri 10 | { 11 | private: 12 | typedef std::string_view::const_iterator iterator_t; 13 | 14 | public: 15 | std::string_view Protocol, Host, Port, Path, QueryString; 16 | 17 | static Uri Parse(const std::string_view& uri) 18 | { 19 | Uri result; 20 | 21 | if (uri.length() == 0) 22 | return result; 23 | 24 | iterator_t uriEnd = uri.end(); 25 | 26 | iterator_t queryStart = std::find(uri.begin(), uriEnd, '?'); 27 | 28 | iterator_t protocolStart = uri.begin(); 29 | iterator_t protocolEnd = std::find(protocolStart, uriEnd, ':'); 30 | 31 | if (protocolEnd != uriEnd) 32 | { 33 | std::string_view prot = &*(protocolEnd); 34 | if ((prot.length() > 3) && (prot.substr(0, 3) == "://")) 35 | { 36 | result.Protocol = make_string_view(uri, protocolStart, protocolEnd); 37 | protocolEnd += 3; 38 | } 39 | else 40 | protocolEnd = uri.begin(); 41 | } 42 | else 43 | protocolEnd = uri.begin(); 44 | 45 | iterator_t hostStart = protocolEnd; 46 | iterator_t pathStart = std::find(hostStart, uriEnd, '/'); 47 | 48 | iterator_t hostEnd = std::find(protocolEnd, (pathStart != uriEnd) ? pathStart : queryStart, ':'); 49 | 50 | result.Host = make_string_view(uri, hostStart, hostEnd); 51 | 52 | if ((hostEnd != uriEnd) && ((&*(hostEnd))[0] == ':')) 53 | { 54 | hostEnd++; 55 | iterator_t portEnd = (pathStart != uriEnd) ? pathStart : queryStart; 56 | result.Port = make_string_view(uri, hostEnd, portEnd); 57 | } 58 | 59 | if (pathStart != uriEnd) 60 | result.Path = make_string_view(uri, pathStart, queryStart); 61 | 62 | if (queryStart != uriEnd) 63 | result.QueryString = make_string_view(uri, queryStart, uri.end()); 64 | 65 | return result; 66 | } 67 | 68 | static std::string CreateUri(std::string_view Protocol, std::string_view Host, std::string_view Port, std::string_view Path, std::string_view QueryString) { 69 | std::ostringstream str; 70 | if (!Protocol.empty()) { 71 | str.write(Protocol.data(), Protocol.size()); 72 | str.write("://", 3); 73 | } 74 | str.write(Host.data(), Host.size()); 75 | if (!Port.empty()) { 76 | str.write(":", 1); 77 | str.write(Port.data(), Port.size()); 78 | } 79 | if (!Path.empty()) { 80 | str.write(Path.data(), Path.size()); 81 | } 82 | if (!QueryString.empty()) { 83 | str.write(QueryString.data(), QueryString.size()); 84 | } 85 | return str.str(); 86 | } 87 | 88 | private: 89 | static constexpr std::string_view make_string_view(const std::string_view& base, iterator_t first, iterator_t last) { 90 | return base.substr(std::distance(base.begin(), first), std::distance(first, last)); 91 | } 92 | }; --------------------------------------------------------------------------------