変愚蛮怒のメインリポジトリです
Revision | 7cf58d6f4a36106a77ea22e27822bcb6dd1298c1 (tree) |
---|---|
Time | 2021-02-05 21:51:16 |
Author | deskull <deskull@user...> |
Commiter | deskull |
Merge remote-tracking branch 'remotes/origin/feature/report-score-libcurl' into develop
@@ -1,4 +1,4 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | |
1 | +<?xml version="1.0" encoding="utf-8"?> | |
2 | 2 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | 3 | <Import Project="..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" /> |
4 | 4 | <Import Project="..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props" Condition="Exists('..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props')" /> |
@@ -50,8 +50,8 @@ | ||
50 | 50 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
51 | 51 | <ConfigurationType>Application</ConfigurationType> |
52 | 52 | <CharacterSet>MultiByte</CharacterSet> |
53 | - <WholeProgramOptimization>true</WholeProgramOptimization> | |
54 | 53 | <PlatformToolset>v142</PlatformToolset> |
54 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
55 | 55 | </PropertyGroup> |
56 | 56 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Release|Win32'" Label="Configuration"> |
57 | 57 | <ConfigurationType>Application</ConfigurationType> |
@@ -62,15 +62,13 @@ | ||
62 | 62 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
63 | 63 | <ConfigurationType>Application</ConfigurationType> |
64 | 64 | <CharacterSet>MultiByte</CharacterSet> |
65 | - <UseOfMfc>false</UseOfMfc> | |
66 | 65 | <PlatformToolset>v142</PlatformToolset> |
67 | - <SpectreMitigation>false</SpectreMitigation> | |
68 | 66 | </PropertyGroup> |
69 | 67 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Debug|Win32'" Label="Configuration"> |
70 | 68 | <ConfigurationType>Application</ConfigurationType> |
71 | 69 | <CharacterSet>MultiByte</CharacterSet> |
72 | - <UseOfMfc>false</UseOfMfc> | |
73 | 70 | <PlatformToolset>v142</PlatformToolset> |
71 | + <UseDebugLibraries>true</UseDebugLibraries> | |
74 | 72 | </PropertyGroup> |
75 | 73 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
76 | 74 | <ImportGroup Label="ExtensionSettings"> |
@@ -99,36 +97,27 @@ | ||
99 | 97 | <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> |
100 | 98 | <IntDir Condition="'$(Configuration)|$(Platform)'=='English-Release|Win32'">$(Configuration)\</IntDir> |
101 | 99 | </PropertyGroup> |
102 | - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
103 | - <IncludePath>..\..\src;$(IncludePath)</IncludePath> | |
104 | - </PropertyGroup> | |
105 | - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Debug|Win32'"> | |
106 | - <IncludePath>..\..\src\cmd;..\..\src\combat;..\..\src;$(IncludePath)</IncludePath> | |
107 | - </PropertyGroup> | |
108 | - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
109 | - <IncludePath>..\..\src\cmd;..\..\src\combat;..\..\src;$(IncludePath)</IncludePath> | |
110 | - </PropertyGroup> | |
111 | - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Release|Win32'"> | |
112 | - <IncludePath>..\..\src\cmd;..\..\src\combat;..\..\src;$(IncludePath)</IncludePath> | |
113 | - </PropertyGroup> | |
100 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | |
101 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Debug|Win32'" /> | |
102 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | |
103 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='English-Release|Win32'" /> | |
114 | 104 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
115 | 105 | <ClCompile> |
116 | - <Optimization>Disabled</Optimization> | |
117 | - <PreprocessorDefinitions>WINDOWS;JP;SJIS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions);HAVE_STDINT_H;</PreprocessorDefinitions> | |
118 | - <MinimalRebuild>false</MinimalRebuild> | |
106 | + <PreprocessorDefinitions>WINDOWS;_CRT_SECURE_NO_WARNINGS;WIN32;HAVE_STDINT_H;JP;SJIS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
119 | 107 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
120 | - <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | |
108 | + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | |
121 | 109 | <WarningLevel>EnableAllWarnings</WarningLevel> |
122 | 110 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
123 | 111 | <CompileAs>CompileAsC</CompileAs> |
124 | 112 | <DisableSpecificWarnings>4061;4062;4127;4244;4255;4668;4710;4820;4996;4774;5045;%(DisableSpecificWarnings)</DisableSpecificWarnings> |
125 | 113 | <ConformanceMode>true</ConformanceMode> |
126 | 114 | <MultiProcessorCompilation>true</MultiProcessorCompilation> |
115 | + <AdditionalIncludeDirectories>..\..\src;curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
127 | 116 | </ClCompile> |
128 | 117 | <Link> |
129 | - <AdditionalDependencies>winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
130 | 118 | <GenerateDebugInformation>true</GenerateDebugInformation> |
131 | 119 | <TargetMachine>MachineX86</TargetMachine> |
120 | + <AdditionalDependencies>winmm.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;Normaliz.lib;curl\x86 Debug\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
132 | 121 | <ShowProgress>LinkVerbose</ShowProgress> |
133 | 122 | <SubSystem>Windows</SubSystem> |
134 | 123 | </Link> |
@@ -139,9 +128,7 @@ | ||
139 | 128 | </ItemDefinitionGroup> |
140 | 129 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='English-Debug|Win32'"> |
141 | 130 | <ClCompile> |
142 | - <Optimization>Disabled</Optimization> | |
143 | - <PreprocessorDefinitions>WINDOWS;SJIS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
144 | - <MinimalRebuild>false</MinimalRebuild> | |
131 | + <PreprocessorDefinitions>WINDOWS;_CRT_SECURE_NO_WARNINGS;WIN32;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
145 | 132 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
146 | 133 | <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> |
147 | 134 | <WarningLevel>Level4</WarningLevel> |
@@ -149,49 +136,54 @@ | ||
149 | 136 | <CompileAs>CompileAsC</CompileAs> |
150 | 137 | <DisableSpecificWarnings>4127;4996;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings> |
151 | 138 | <MultiProcessorCompilation>true</MultiProcessorCompilation> |
139 | + <AdditionalIncludeDirectories>..\..\src;curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
152 | 140 | </ClCompile> |
153 | 141 | <Link> |
154 | - <AdditionalDependencies>winmm.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
155 | 142 | <GenerateDebugInformation>true</GenerateDebugInformation> |
156 | 143 | <TargetMachine>MachineX86</TargetMachine> |
157 | 144 | <ShowProgress>LinkVerbose</ShowProgress> |
145 | + <AdditionalDependencies>winmm.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;Normaliz.lib;curl\x86 Debug\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
158 | 146 | <SubSystem>Windows</SubSystem> |
159 | 147 | </Link> |
160 | 148 | </ItemDefinitionGroup> |
161 | 149 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
162 | 150 | <ClCompile> |
163 | - <Optimization>MaxSpeed</Optimization> | |
164 | - <IntrinsicFunctions>true</IntrinsicFunctions> | |
165 | - <PreprocessorDefinitions>WINDOWS;JP;SJIS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions);HAVE_STDINT_H;</PreprocessorDefinitions> | |
151 | + <PreprocessorDefinitions>WINDOWS;_CRT_SECURE_NO_WARNINGS;WIN32;HAVE_STDINT_H;JP;SJIS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
166 | 152 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
167 | - <FunctionLevelLinking>true</FunctionLevelLinking> | |
168 | 153 | <WarningLevel>Level3</WarningLevel> |
169 | - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | |
170 | 154 | <DisableSpecificWarnings>4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> |
171 | 155 | <MultiProcessorCompilation>true</MultiProcessorCompilation> |
156 | + <AdditionalIncludeDirectories>..\..\src;curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
157 | + <DebugInformationFormat>None</DebugInformationFormat> | |
158 | + <IntrinsicFunctions>true</IntrinsicFunctions> | |
159 | + <FunctionLevelLinking>true</FunctionLevelLinking> | |
160 | + <CompileAs>CompileAsC</CompileAs> | |
172 | 161 | </ClCompile> |
173 | 162 | <Link> |
174 | - <AdditionalDependencies>winmm.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
175 | - <GenerateDebugInformation>true</GenerateDebugInformation> | |
163 | + <TargetMachine>MachineX86</TargetMachine> | |
164 | + <AdditionalDependencies>winmm.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;Normaliz.lib;curl\x86 Release\libcurl_a.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
165 | + <LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration> | |
166 | + <GenerateDebugInformation>false</GenerateDebugInformation> | |
176 | 167 | <OptimizeReferences>true</OptimizeReferences> |
177 | 168 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
178 | - <TargetMachine>MachineX86</TargetMachine> | |
169 | + <SubSystem>Windows</SubSystem> | |
179 | 170 | </Link> |
180 | 171 | </ItemDefinitionGroup> |
181 | 172 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='English-Release|Win32'"> |
182 | 173 | <ClCompile> |
183 | 174 | <Optimization>MaxSpeed</Optimization> |
184 | 175 | <IntrinsicFunctions>true</IntrinsicFunctions> |
185 | - <PreprocessorDefinitions>WINDOWS;SJIS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions);HAVE_STDINT_H;</PreprocessorDefinitions> | |
176 | + <PreprocessorDefinitions>WINDOWS;_CRT_SECURE_NO_WARNINGS;WIN32;HAVE_STDINT_H;%(PreprocessorDefinitions);</PreprocessorDefinitions> | |
186 | 177 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
187 | 178 | <FunctionLevelLinking>true</FunctionLevelLinking> |
188 | 179 | <WarningLevel>Level3</WarningLevel> |
189 | 180 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
190 | 181 | <DisableSpecificWarnings>4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> |
191 | 182 | <MultiProcessorCompilation>true</MultiProcessorCompilation> |
183 | + <AdditionalIncludeDirectories>..\..\src;curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
192 | 184 | </ClCompile> |
193 | 185 | <Link> |
194 | - <AdditionalDependencies>winmm.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
186 | + <AdditionalDependencies>winmm.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;Normaliz.lib;curl\x86 Release\libcurl_a.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
195 | 187 | <GenerateDebugInformation>true</GenerateDebugInformation> |
196 | 188 | <OptimizeReferences>true</OptimizeReferences> |
197 | 189 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
@@ -1790,4 +1782,4 @@ | ||
1790 | 1782 | <Error Condition="!Exists('..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetFramework.Analyzers.3.0.0\build\Microsoft.NetFramework.Analyzers.props'))" /> |
1791 | 1783 | <Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.3.0.0\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props'))" /> |
1792 | 1784 | </Target> |
1793 | -</Project> | |
\ No newline at end of file | ||
1785 | +</Project> |
@@ -0,0 +1,3029 @@ | ||
1 | +#ifndef CURLINC_CURL_H | |
2 | +#define CURLINC_CURL_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.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 CURL_WIN32 when build target is Win32 API | |
42 | + */ | |
43 | + | |
44 | +#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && \ | |
45 | + !defined(__SYMBIAN32__) | |
46 | +#define CURL_WIN32 | |
47 | +#endif | |
48 | + | |
49 | +#include <stdio.h> | |
50 | +#include <limits.h> | |
51 | + | |
52 | +#if defined(__FreeBSD__) && (__FreeBSD__ >= 2) | |
53 | +/* Needed for __FreeBSD_version symbol definition */ | |
54 | +#include <osreldate.h> | |
55 | +#endif | |
56 | + | |
57 | +/* The include stuff here below is mainly for time_t! */ | |
58 | +#include <sys/types.h> | |
59 | +#include <time.h> | |
60 | + | |
61 | +#if defined(CURL_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 <winsock2.h> | |
67 | +#include <ws2tcpip.h> | |
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(__CYGWIN__) || defined(AMIGA) || \ | |
78 | + (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) | |
79 | +#include <sys/select.h> | |
80 | +#endif | |
81 | + | |
82 | +#if !defined(CURL_WIN32) && !defined(_WIN32_WCE) | |
83 | +#include <sys/socket.h> | |
84 | +#endif | |
85 | + | |
86 | +#if !defined(CURL_WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) | |
87 | +#include <sys/time.h> | |
88 | +#endif | |
89 | + | |
90 | +#ifdef __BEOS__ | |
91 | +#include <support/SupportDefs.h> | |
92 | +#endif | |
93 | + | |
94 | +/* Compatibility for non-Clang compilers */ | |
95 | +#ifndef __has_declspec_attribute | |
96 | +# define __has_declspec_attribute(x) 0 | |
97 | +#endif | |
98 | + | |
99 | +#ifdef __cplusplus | |
100 | +extern "C" { | |
101 | +#endif | |
102 | + | |
103 | +#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) | |
104 | +typedef struct Curl_easy CURL; | |
105 | +typedef struct Curl_share CURLSH; | |
106 | +#else | |
107 | +typedef void CURL; | |
108 | +typedef void CURLSH; | |
109 | +#endif | |
110 | + | |
111 | +/* | |
112 | + * libcurl external API function linkage decorations. | |
113 | + */ | |
114 | + | |
115 | +#ifdef CURL_STATICLIB | |
116 | +# define CURL_EXTERN | |
117 | +#elif defined(CURL_WIN32) || defined(__SYMBIAN32__) || \ | |
118 | + (__has_declspec_attribute(dllexport) && \ | |
119 | + __has_declspec_attribute(dllimport)) | |
120 | +# if defined(BUILDING_LIBCURL) | |
121 | +# define CURL_EXTERN __declspec(dllexport) | |
122 | +# else | |
123 | +# define CURL_EXTERN __declspec(dllimport) | |
124 | +# endif | |
125 | +#elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS) | |
126 | +# define CURL_EXTERN CURL_EXTERN_SYMBOL | |
127 | +#else | |
128 | +# define CURL_EXTERN | |
129 | +#endif | |
130 | + | |
131 | +#ifndef curl_socket_typedef | |
132 | +/* socket typedef */ | |
133 | +#if defined(CURL_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H) | |
134 | +typedef SOCKET curl_socket_t; | |
135 | +#define CURL_SOCKET_BAD INVALID_SOCKET | |
136 | +#else | |
137 | +typedef int curl_socket_t; | |
138 | +#define CURL_SOCKET_BAD -1 | |
139 | +#endif | |
140 | +#define curl_socket_typedef | |
141 | +#endif /* curl_socket_typedef */ | |
142 | + | |
143 | +/* enum for the different supported SSL backends */ | |
144 | +typedef enum { | |
145 | + CURLSSLBACKEND_NONE = 0, | |
146 | + CURLSSLBACKEND_OPENSSL = 1, | |
147 | + CURLSSLBACKEND_GNUTLS = 2, | |
148 | + CURLSSLBACKEND_NSS = 3, | |
149 | + CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */ | |
150 | + CURLSSLBACKEND_GSKIT = 5, | |
151 | + CURLSSLBACKEND_POLARSSL = 6, | |
152 | + CURLSSLBACKEND_WOLFSSL = 7, | |
153 | + CURLSSLBACKEND_SCHANNEL = 8, | |
154 | + CURLSSLBACKEND_SECURETRANSPORT = 9, | |
155 | + CURLSSLBACKEND_AXTLS = 10, /* never used since 7.63.0 */ | |
156 | + CURLSSLBACKEND_MBEDTLS = 11, | |
157 | + CURLSSLBACKEND_MESALINK = 12, | |
158 | + CURLSSLBACKEND_BEARSSL = 13 | |
159 | +} curl_sslbackend; | |
160 | + | |
161 | +/* aliases for library clones and renames */ | |
162 | +#define CURLSSLBACKEND_LIBRESSL CURLSSLBACKEND_OPENSSL | |
163 | +#define CURLSSLBACKEND_BORINGSSL CURLSSLBACKEND_OPENSSL | |
164 | + | |
165 | +/* deprecated names: */ | |
166 | +#define CURLSSLBACKEND_CYASSL CURLSSLBACKEND_WOLFSSL | |
167 | +#define CURLSSLBACKEND_DARWINSSL CURLSSLBACKEND_SECURETRANSPORT | |
168 | + | |
169 | +struct curl_httppost { | |
170 | + struct curl_httppost *next; /* next entry in the list */ | |
171 | + char *name; /* pointer to allocated name */ | |
172 | + long namelength; /* length of name length */ | |
173 | + char *contents; /* pointer to allocated data contents */ | |
174 | + long contentslength; /* length of contents field, see also | |
175 | + CURL_HTTPPOST_LARGE */ | |
176 | + char *buffer; /* pointer to allocated buffer contents */ | |
177 | + long bufferlength; /* length of buffer field */ | |
178 | + char *contenttype; /* Content-Type */ | |
179 | + struct curl_slist *contentheader; /* list of extra headers for this form */ | |
180 | + struct curl_httppost *more; /* if one field name has more than one | |
181 | + file, this link should link to following | |
182 | + files */ | |
183 | + long flags; /* as defined below */ | |
184 | + | |
185 | +/* specified content is a file name */ | |
186 | +#define CURL_HTTPPOST_FILENAME (1<<0) | |
187 | +/* specified content is a file name */ | |
188 | +#define CURL_HTTPPOST_READFILE (1<<1) | |
189 | +/* name is only stored pointer do not free in formfree */ | |
190 | +#define CURL_HTTPPOST_PTRNAME (1<<2) | |
191 | +/* contents is only stored pointer do not free in formfree */ | |
192 | +#define CURL_HTTPPOST_PTRCONTENTS (1<<3) | |
193 | +/* upload file from buffer */ | |
194 | +#define CURL_HTTPPOST_BUFFER (1<<4) | |
195 | +/* upload file from pointer contents */ | |
196 | +#define CURL_HTTPPOST_PTRBUFFER (1<<5) | |
197 | +/* upload file contents by using the regular read callback to get the data and | |
198 | + pass the given pointer as custom pointer */ | |
199 | +#define CURL_HTTPPOST_CALLBACK (1<<6) | |
200 | +/* use size in 'contentlen', added in 7.46.0 */ | |
201 | +#define CURL_HTTPPOST_LARGE (1<<7) | |
202 | + | |
203 | + char *showfilename; /* The file name to show. If not set, the | |
204 | + actual file name will be used (if this | |
205 | + is a file part) */ | |
206 | + void *userp; /* custom pointer used for | |
207 | + HTTPPOST_CALLBACK posts */ | |
208 | + curl_off_t contentlen; /* alternative length of contents | |
209 | + field. Used if CURL_HTTPPOST_LARGE is | |
210 | + set. Added in 7.46.0 */ | |
211 | +}; | |
212 | + | |
213 | + | |
214 | +/* This is a return code for the progress callback that, when returned, will | |
215 | + signal libcurl to continue executing the default progress function */ | |
216 | +#define CURL_PROGRESSFUNC_CONTINUE 0x10000001 | |
217 | + | |
218 | +/* This is the CURLOPT_PROGRESSFUNCTION callback prototype. It is now | |
219 | + considered deprecated but was the only choice up until 7.31.0 */ | |
220 | +typedef int (*curl_progress_callback)(void *clientp, | |
221 | + double dltotal, | |
222 | + double dlnow, | |
223 | + double ultotal, | |
224 | + double ulnow); | |
225 | + | |
226 | +/* This is the CURLOPT_XFERINFOFUNCTION callback prototype. It was introduced | |
227 | + in 7.32.0, avoids the use of floating point numbers and provides more | |
228 | + detailed information. */ | |
229 | +typedef int (*curl_xferinfo_callback)(void *clientp, | |
230 | + curl_off_t dltotal, | |
231 | + curl_off_t dlnow, | |
232 | + curl_off_t ultotal, | |
233 | + curl_off_t ulnow); | |
234 | + | |
235 | +#ifndef CURL_MAX_READ_SIZE | |
236 | + /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */ | |
237 | +#define CURL_MAX_READ_SIZE 524288 | |
238 | +#endif | |
239 | + | |
240 | +#ifndef CURL_MAX_WRITE_SIZE | |
241 | + /* Tests have proven that 20K is a very bad buffer size for uploads on | |
242 | + Windows, while 16K for some odd reason performed a lot better. | |
243 | + We do the ifndef check to allow this value to easier be changed at build | |
244 | + time for those who feel adventurous. The practical minimum is about | |
245 | + 400 bytes since libcurl uses a buffer of this size as a scratch area | |
246 | + (unrelated to network send operations). */ | |
247 | +#define CURL_MAX_WRITE_SIZE 16384 | |
248 | +#endif | |
249 | + | |
250 | +#ifndef CURL_MAX_HTTP_HEADER | |
251 | +/* The only reason to have a max limit for this is to avoid the risk of a bad | |
252 | + server feeding libcurl with a never-ending header that will cause reallocs | |
253 | + infinitely */ | |
254 | +#define CURL_MAX_HTTP_HEADER (100*1024) | |
255 | +#endif | |
256 | + | |
257 | +/* This is a magic return code for the write callback that, when returned, | |
258 | + will signal libcurl to pause receiving on the current transfer. */ | |
259 | +#define CURL_WRITEFUNC_PAUSE 0x10000001 | |
260 | + | |
261 | +typedef size_t (*curl_write_callback)(char *buffer, | |
262 | + size_t size, | |
263 | + size_t nitems, | |
264 | + void *outstream); | |
265 | + | |
266 | +/* This callback will be called when a new resolver request is made */ | |
267 | +typedef int (*curl_resolver_start_callback)(void *resolver_state, | |
268 | + void *reserved, void *userdata); | |
269 | + | |
270 | +/* enumeration of file types */ | |
271 | +typedef enum { | |
272 | + CURLFILETYPE_FILE = 0, | |
273 | + CURLFILETYPE_DIRECTORY, | |
274 | + CURLFILETYPE_SYMLINK, | |
275 | + CURLFILETYPE_DEVICE_BLOCK, | |
276 | + CURLFILETYPE_DEVICE_CHAR, | |
277 | + CURLFILETYPE_NAMEDPIPE, | |
278 | + CURLFILETYPE_SOCKET, | |
279 | + CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ | |
280 | + | |
281 | + CURLFILETYPE_UNKNOWN /* should never occur */ | |
282 | +} curlfiletype; | |
283 | + | |
284 | +#define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) | |
285 | +#define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) | |
286 | +#define CURLFINFOFLAG_KNOWN_TIME (1<<2) | |
287 | +#define CURLFINFOFLAG_KNOWN_PERM (1<<3) | |
288 | +#define CURLFINFOFLAG_KNOWN_UID (1<<4) | |
289 | +#define CURLFINFOFLAG_KNOWN_GID (1<<5) | |
290 | +#define CURLFINFOFLAG_KNOWN_SIZE (1<<6) | |
291 | +#define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) | |
292 | + | |
293 | +/* Information about a single file, used when doing FTP wildcard matching */ | |
294 | +struct curl_fileinfo { | |
295 | + char *filename; | |
296 | + curlfiletype filetype; | |
297 | + time_t time; /* always zero! */ | |
298 | + unsigned int perm; | |
299 | + int uid; | |
300 | + int gid; | |
301 | + curl_off_t size; | |
302 | + long int hardlinks; | |
303 | + | |
304 | + struct { | |
305 | + /* If some of these fields is not NULL, it is a pointer to b_data. */ | |
306 | + char *time; | |
307 | + char *perm; | |
308 | + char *user; | |
309 | + char *group; | |
310 | + char *target; /* pointer to the target filename of a symlink */ | |
311 | + } strings; | |
312 | + | |
313 | + unsigned int flags; | |
314 | + | |
315 | + /* used internally */ | |
316 | + char *b_data; | |
317 | + size_t b_size; | |
318 | + size_t b_used; | |
319 | +}; | |
320 | + | |
321 | +/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ | |
322 | +#define CURL_CHUNK_BGN_FUNC_OK 0 | |
323 | +#define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ | |
324 | +#define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ | |
325 | + | |
326 | +/* if splitting of data transfer is enabled, this callback is called before | |
327 | + download of an individual chunk started. Note that parameter "remains" works | |
328 | + only for FTP wildcard downloading (for now), otherwise is not used */ | |
329 | +typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, | |
330 | + void *ptr, | |
331 | + int remains); | |
332 | + | |
333 | +/* return codes for CURLOPT_CHUNK_END_FUNCTION */ | |
334 | +#define CURL_CHUNK_END_FUNC_OK 0 | |
335 | +#define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ | |
336 | + | |
337 | +/* If splitting of data transfer is enabled this callback is called after | |
338 | + download of an individual chunk finished. | |
339 | + Note! After this callback was set then it have to be called FOR ALL chunks. | |
340 | + Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. | |
341 | + This is the reason why we don't need "transfer_info" parameter in this | |
342 | + callback and we are not interested in "remains" parameter too. */ | |
343 | +typedef long (*curl_chunk_end_callback)(void *ptr); | |
344 | + | |
345 | +/* return codes for FNMATCHFUNCTION */ | |
346 | +#define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ | |
347 | +#define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ | |
348 | +#define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ | |
349 | + | |
350 | +/* callback type for wildcard downloading pattern matching. If the | |
351 | + string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ | |
352 | +typedef int (*curl_fnmatch_callback)(void *ptr, | |
353 | + const char *pattern, | |
354 | + const char *string); | |
355 | + | |
356 | +/* These are the return codes for the seek callbacks */ | |
357 | +#define CURL_SEEKFUNC_OK 0 | |
358 | +#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ | |
359 | +#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so | |
360 | + libcurl might try other means instead */ | |
361 | +typedef int (*curl_seek_callback)(void *instream, | |
362 | + curl_off_t offset, | |
363 | + int origin); /* 'whence' */ | |
364 | + | |
365 | +/* This is a return code for the read callback that, when returned, will | |
366 | + signal libcurl to immediately abort the current transfer. */ | |
367 | +#define CURL_READFUNC_ABORT 0x10000000 | |
368 | +/* This is a return code for the read callback that, when returned, will | |
369 | + signal libcurl to pause sending data on the current transfer. */ | |
370 | +#define CURL_READFUNC_PAUSE 0x10000001 | |
371 | + | |
372 | +/* Return code for when the trailing headers' callback has terminated | |
373 | + without any errors*/ | |
374 | +#define CURL_TRAILERFUNC_OK 0 | |
375 | +/* Return code for when was an error in the trailing header's list and we | |
376 | + want to abort the request */ | |
377 | +#define CURL_TRAILERFUNC_ABORT 1 | |
378 | + | |
379 | +typedef size_t (*curl_read_callback)(char *buffer, | |
380 | + size_t size, | |
381 | + size_t nitems, | |
382 | + void *instream); | |
383 | + | |
384 | +typedef int (*curl_trailer_callback)(struct curl_slist **list, | |
385 | + void *userdata); | |
386 | + | |
387 | +typedef enum { | |
388 | + CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ | |
389 | + CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */ | |
390 | + CURLSOCKTYPE_LAST /* never use */ | |
391 | +} curlsocktype; | |
392 | + | |
393 | +/* The return code from the sockopt_callback can signal information back | |
394 | + to libcurl: */ | |
395 | +#define CURL_SOCKOPT_OK 0 | |
396 | +#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return | |
397 | + CURLE_ABORTED_BY_CALLBACK */ | |
398 | +#define CURL_SOCKOPT_ALREADY_CONNECTED 2 | |
399 | + | |
400 | +typedef int (*curl_sockopt_callback)(void *clientp, | |
401 | + curl_socket_t curlfd, | |
402 | + curlsocktype purpose); | |
403 | + | |
404 | +struct curl_sockaddr { | |
405 | + int family; | |
406 | + int socktype; | |
407 | + int protocol; | |
408 | + unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it | |
409 | + turned really ugly and painful on the systems that | |
410 | + lack this type */ | |
411 | + struct sockaddr addr; | |
412 | +}; | |
413 | + | |
414 | +typedef curl_socket_t | |
415 | +(*curl_opensocket_callback)(void *clientp, | |
416 | + curlsocktype purpose, | |
417 | + struct curl_sockaddr *address); | |
418 | + | |
419 | +typedef int | |
420 | +(*curl_closesocket_callback)(void *clientp, curl_socket_t item); | |
421 | + | |
422 | +typedef enum { | |
423 | + CURLIOE_OK, /* I/O operation successful */ | |
424 | + CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ | |
425 | + CURLIOE_FAILRESTART, /* failed to restart the read */ | |
426 | + CURLIOE_LAST /* never use */ | |
427 | +} curlioerr; | |
428 | + | |
429 | +typedef enum { | |
430 | + CURLIOCMD_NOP, /* no operation */ | |
431 | + CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ | |
432 | + CURLIOCMD_LAST /* never use */ | |
433 | +} curliocmd; | |
434 | + | |
435 | +typedef curlioerr (*curl_ioctl_callback)(CURL *handle, | |
436 | + int cmd, | |
437 | + void *clientp); | |
438 | + | |
439 | +#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS | |
440 | +/* | |
441 | + * The following typedef's are signatures of malloc, free, realloc, strdup and | |
442 | + * calloc respectively. Function pointers of these types can be passed to the | |
443 | + * curl_global_init_mem() function to set user defined memory management | |
444 | + * callback routines. | |
445 | + */ | |
446 | +typedef void *(*curl_malloc_callback)(size_t size); | |
447 | +typedef void (*curl_free_callback)(void *ptr); | |
448 | +typedef void *(*curl_realloc_callback)(void *ptr, size_t size); | |
449 | +typedef char *(*curl_strdup_callback)(const char *str); | |
450 | +typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); | |
451 | + | |
452 | +#define CURL_DID_MEMORY_FUNC_TYPEDEFS | |
453 | +#endif | |
454 | + | |
455 | +/* the kind of data that is passed to information_callback*/ | |
456 | +typedef enum { | |
457 | + CURLINFO_TEXT = 0, | |
458 | + CURLINFO_HEADER_IN, /* 1 */ | |
459 | + CURLINFO_HEADER_OUT, /* 2 */ | |
460 | + CURLINFO_DATA_IN, /* 3 */ | |
461 | + CURLINFO_DATA_OUT, /* 4 */ | |
462 | + CURLINFO_SSL_DATA_IN, /* 5 */ | |
463 | + CURLINFO_SSL_DATA_OUT, /* 6 */ | |
464 | + CURLINFO_END | |
465 | +} curl_infotype; | |
466 | + | |
467 | +typedef int (*curl_debug_callback) | |
468 | + (CURL *handle, /* the handle/transfer this concerns */ | |
469 | + curl_infotype type, /* what kind of data */ | |
470 | + char *data, /* points to the data */ | |
471 | + size_t size, /* size of the data pointed to */ | |
472 | + void *userptr); /* whatever the user please */ | |
473 | + | |
474 | +/* All possible error codes from all sorts of curl functions. Future versions | |
475 | + may return other values, stay prepared. | |
476 | + | |
477 | + Always add new return codes last. Never *EVER* remove any. The return | |
478 | + codes must remain the same! | |
479 | + */ | |
480 | + | |
481 | +typedef enum { | |
482 | + CURLE_OK = 0, | |
483 | + CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ | |
484 | + CURLE_FAILED_INIT, /* 2 */ | |
485 | + CURLE_URL_MALFORMAT, /* 3 */ | |
486 | + CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for | |
487 | + 7.17.0, reused in April 2011 for 7.21.5] */ | |
488 | + CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ | |
489 | + CURLE_COULDNT_RESOLVE_HOST, /* 6 */ | |
490 | + CURLE_COULDNT_CONNECT, /* 7 */ | |
491 | + CURLE_WEIRD_SERVER_REPLY, /* 8 */ | |
492 | + CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server | |
493 | + due to lack of access - when login fails | |
494 | + this is not returned. */ | |
495 | + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for | |
496 | + 7.15.4, reused in Dec 2011 for 7.24.0]*/ | |
497 | + CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ | |
498 | + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server | |
499 | + [was obsoleted in August 2007 for 7.17.0, | |
500 | + reused in Dec 2011 for 7.24.0]*/ | |
501 | + CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ | |
502 | + CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ | |
503 | + CURLE_FTP_CANT_GET_HOST, /* 15 */ | |
504 | + CURLE_HTTP2, /* 16 - A problem in the http2 framing layer. | |
505 | + [was obsoleted in August 2007 for 7.17.0, | |
506 | + reused in July 2014 for 7.38.0] */ | |
507 | + CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ | |
508 | + CURLE_PARTIAL_FILE, /* 18 */ | |
509 | + CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ | |
510 | + CURLE_OBSOLETE20, /* 20 - NOT USED */ | |
511 | + CURLE_QUOTE_ERROR, /* 21 - quote command failure */ | |
512 | + CURLE_HTTP_RETURNED_ERROR, /* 22 */ | |
513 | + CURLE_WRITE_ERROR, /* 23 */ | |
514 | + CURLE_OBSOLETE24, /* 24 - NOT USED */ | |
515 | + CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ | |
516 | + CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ | |
517 | + CURLE_OUT_OF_MEMORY, /* 27 */ | |
518 | + /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error | |
519 | + instead of a memory allocation error if CURL_DOES_CONVERSIONS | |
520 | + is defined | |
521 | + */ | |
522 | + CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ | |
523 | + CURLE_OBSOLETE29, /* 29 - NOT USED */ | |
524 | + CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ | |
525 | + CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ | |
526 | + CURLE_OBSOLETE32, /* 32 - NOT USED */ | |
527 | + CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ | |
528 | + CURLE_HTTP_POST_ERROR, /* 34 */ | |
529 | + CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ | |
530 | + CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ | |
531 | + CURLE_FILE_COULDNT_READ_FILE, /* 37 */ | |
532 | + CURLE_LDAP_CANNOT_BIND, /* 38 */ | |
533 | + CURLE_LDAP_SEARCH_FAILED, /* 39 */ | |
534 | + CURLE_OBSOLETE40, /* 40 - NOT USED */ | |
535 | + CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */ | |
536 | + CURLE_ABORTED_BY_CALLBACK, /* 42 */ | |
537 | + CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ | |
538 | + CURLE_OBSOLETE44, /* 44 - NOT USED */ | |
539 | + CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ | |
540 | + CURLE_OBSOLETE46, /* 46 - NOT USED */ | |
541 | + CURLE_TOO_MANY_REDIRECTS, /* 47 - catch endless re-direct loops */ | |
542 | + CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ | |
543 | + CURLE_TELNET_OPTION_SYNTAX, /* 49 - Malformed telnet option */ | |
544 | + CURLE_OBSOLETE50, /* 50 - NOT USED */ | |
545 | + CURLE_OBSOLETE51, /* 51 - NOT USED */ | |
546 | + CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ | |
547 | + CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ | |
548 | + CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as | |
549 | + default */ | |
550 | + CURLE_SEND_ERROR, /* 55 - failed sending network data */ | |
551 | + CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ | |
552 | + CURLE_OBSOLETE57, /* 57 - NOT IN USE */ | |
553 | + CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ | |
554 | + CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ | |
555 | + CURLE_PEER_FAILED_VERIFICATION, /* 60 - peer's certificate or fingerprint | |
556 | + wasn't verified fine */ | |
557 | + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ | |
558 | + CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ | |
559 | + CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ | |
560 | + CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ | |
561 | + CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind | |
562 | + that failed */ | |
563 | + CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ | |
564 | + CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not | |
565 | + accepted and we failed to login */ | |
566 | + CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ | |
567 | + CURLE_TFTP_PERM, /* 69 - permission problem on server */ | |
568 | + CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ | |
569 | + CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ | |
570 | + CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ | |
571 | + CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ | |
572 | + CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ | |
573 | + CURLE_CONV_FAILED, /* 75 - conversion failed */ | |
574 | + CURLE_CONV_REQD, /* 76 - caller must register conversion | |
575 | + callbacks using curl_easy_setopt options | |
576 | + CURLOPT_CONV_FROM_NETWORK_FUNCTION, | |
577 | + CURLOPT_CONV_TO_NETWORK_FUNCTION, and | |
578 | + CURLOPT_CONV_FROM_UTF8_FUNCTION */ | |
579 | + CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing | |
580 | + or wrong format */ | |
581 | + CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ | |
582 | + CURLE_SSH, /* 79 - error from the SSH layer, somewhat | |
583 | + generic so the error message will be of | |
584 | + interest when this has happened */ | |
585 | + | |
586 | + CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL | |
587 | + connection */ | |
588 | + CURLE_AGAIN, /* 81 - socket is not ready for send/recv, | |
589 | + wait till it's ready and try again (Added | |
590 | + in 7.18.2) */ | |
591 | + CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or | |
592 | + wrong format (Added in 7.19.0) */ | |
593 | + CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in | |
594 | + 7.19.0) */ | |
595 | + CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ | |
596 | + CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ | |
597 | + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ | |
598 | + CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ | |
599 | + CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ | |
600 | + CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the | |
601 | + session will be queued */ | |
602 | + CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not | |
603 | + match */ | |
604 | + CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */ | |
605 | + CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer | |
606 | + */ | |
607 | + CURLE_RECURSIVE_API_CALL, /* 93 - an api function was called from | |
608 | + inside a callback */ | |
609 | + CURLE_AUTH_ERROR, /* 94 - an authentication function returned an | |
610 | + error */ | |
611 | + CURLE_HTTP3, /* 95 - An HTTP/3 layer problem */ | |
612 | + CURLE_QUIC_CONNECT_ERROR, /* 96 - QUIC connection error */ | |
613 | + CURLE_PROXY, /* 97 - proxy handshake error */ | |
614 | + CURL_LAST /* never use! */ | |
615 | +} CURLcode; | |
616 | + | |
617 | +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all | |
618 | + the obsolete stuff removed! */ | |
619 | + | |
620 | +/* Previously obsolete error code re-used in 7.38.0 */ | |
621 | +#define CURLE_OBSOLETE16 CURLE_HTTP2 | |
622 | + | |
623 | +/* Previously obsolete error codes re-used in 7.24.0 */ | |
624 | +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED | |
625 | +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT | |
626 | + | |
627 | +/* compatibility with older names */ | |
628 | +#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING | |
629 | +#define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY | |
630 | + | |
631 | +/* The following were added in 7.62.0 */ | |
632 | +#define CURLE_SSL_CACERT CURLE_PEER_FAILED_VERIFICATION | |
633 | + | |
634 | +/* The following were added in 7.21.5, April 2011 */ | |
635 | +#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION | |
636 | + | |
637 | +/* The following were added in 7.17.1 */ | |
638 | +/* These are scheduled to disappear by 2009 */ | |
639 | +#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION | |
640 | + | |
641 | +/* The following were added in 7.17.0 */ | |
642 | +/* These are scheduled to disappear by 2009 */ | |
643 | +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ | |
644 | +#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 | |
645 | +#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 | |
646 | +#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 | |
647 | +#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 | |
648 | +#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 | |
649 | +#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 | |
650 | +#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 | |
651 | +#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 | |
652 | +#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 | |
653 | +#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 | |
654 | +#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 | |
655 | +#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN | |
656 | + | |
657 | +#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED | |
658 | +#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE | |
659 | +#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR | |
660 | +#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL | |
661 | +#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS | |
662 | +#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR | |
663 | +#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED | |
664 | + | |
665 | +/* The following were added earlier */ | |
666 | + | |
667 | +#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT | |
668 | + | |
669 | +#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR | |
670 | +#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED | |
671 | +#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED | |
672 | + | |
673 | +#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE | |
674 | +#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME | |
675 | + | |
676 | +/* This was the error code 50 in 7.7.3 and a few earlier versions, this | |
677 | + is no longer used by libcurl but is instead #defined here only to not | |
678 | + make programs break */ | |
679 | +#define CURLE_ALREADY_COMPLETE 99999 | |
680 | + | |
681 | +/* Provide defines for really old option names */ | |
682 | +#define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */ | |
683 | +#define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */ | |
684 | +#define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA | |
685 | + | |
686 | +/* Since long deprecated options with no code in the lib that does anything | |
687 | + with them. */ | |
688 | +#define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40 | |
689 | +#define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72 | |
690 | + | |
691 | +#endif /*!CURL_NO_OLDIES*/ | |
692 | + | |
693 | +/* | |
694 | + * Proxy error codes. Returned in CURLINFO_PROXY_ERROR if CURLE_PROXY was | |
695 | + * return for the transfers. | |
696 | + */ | |
697 | +typedef enum { | |
698 | + CURLPX_OK, | |
699 | + CURLPX_BAD_ADDRESS_TYPE, | |
700 | + CURLPX_BAD_VERSION, | |
701 | + CURLPX_CLOSED, | |
702 | + CURLPX_GSSAPI, | |
703 | + CURLPX_GSSAPI_PERMSG, | |
704 | + CURLPX_GSSAPI_PROTECTION, | |
705 | + CURLPX_IDENTD, | |
706 | + CURLPX_IDENTD_DIFFER, | |
707 | + CURLPX_LONG_HOSTNAME, | |
708 | + CURLPX_LONG_PASSWD, | |
709 | + CURLPX_LONG_USER, | |
710 | + CURLPX_NO_AUTH, | |
711 | + CURLPX_RECV_ADDRESS, | |
712 | + CURLPX_RECV_AUTH, | |
713 | + CURLPX_RECV_CONNECT, | |
714 | + CURLPX_RECV_REQACK, | |
715 | + CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED, | |
716 | + CURLPX_REPLY_COMMAND_NOT_SUPPORTED, | |
717 | + CURLPX_REPLY_CONNECTION_REFUSED, | |
718 | + CURLPX_REPLY_GENERAL_SERVER_FAILURE, | |
719 | + CURLPX_REPLY_HOST_UNREACHABLE, | |
720 | + CURLPX_REPLY_NETWORK_UNREACHABLE, | |
721 | + CURLPX_REPLY_NOT_ALLOWED, | |
722 | + CURLPX_REPLY_TTL_EXPIRED, | |
723 | + CURLPX_REPLY_UNASSIGNED, | |
724 | + CURLPX_REQUEST_FAILED, | |
725 | + CURLPX_RESOLVE_HOST, | |
726 | + CURLPX_SEND_AUTH, | |
727 | + CURLPX_SEND_CONNECT, | |
728 | + CURLPX_SEND_REQUEST, | |
729 | + CURLPX_UNKNOWN_FAIL, | |
730 | + CURLPX_UNKNOWN_MODE, | |
731 | + CURLPX_USER_REJECTED, | |
732 | + CURLPX_LAST /* never use */ | |
733 | +} CURLproxycode; | |
734 | + | |
735 | +/* This prototype applies to all conversion callbacks */ | |
736 | +typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); | |
737 | + | |
738 | +typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ | |
739 | + void *ssl_ctx, /* actually an OpenSSL | |
740 | + or WolfSSL SSL_CTX, | |
741 | + or an mbedTLS | |
742 | + mbedtls_ssl_config */ | |
743 | + void *userptr); | |
744 | + | |
745 | +typedef enum { | |
746 | + CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use | |
747 | + CONNECT HTTP/1.1 */ | |
748 | + CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT | |
749 | + HTTP/1.0 */ | |
750 | + CURLPROXY_HTTPS = 2, /* added in 7.52.0 */ | |
751 | + CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already | |
752 | + in 7.10 */ | |
753 | + CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ | |
754 | + CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ | |
755 | + CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the | |
756 | + host name rather than the IP address. added | |
757 | + in 7.18.0 */ | |
758 | +} curl_proxytype; /* this enum was added in 7.10 */ | |
759 | + | |
760 | +/* | |
761 | + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: | |
762 | + * | |
763 | + * CURLAUTH_NONE - No HTTP authentication | |
764 | + * CURLAUTH_BASIC - HTTP Basic authentication (default) | |
765 | + * CURLAUTH_DIGEST - HTTP Digest authentication | |
766 | + * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication | |
767 | + * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated) | |
768 | + * CURLAUTH_NTLM - HTTP NTLM authentication | |
769 | + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour | |
770 | + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper | |
771 | + * CURLAUTH_BEARER - HTTP Bearer token authentication | |
772 | + * CURLAUTH_ONLY - Use together with a single other type to force no | |
773 | + * authentication or just that single type | |
774 | + * CURLAUTH_ANY - All fine types set | |
775 | + * CURLAUTH_ANYSAFE - All fine types except Basic | |
776 | + */ | |
777 | + | |
778 | +#define CURLAUTH_NONE ((unsigned long)0) | |
779 | +#define CURLAUTH_BASIC (((unsigned long)1)<<0) | |
780 | +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) | |
781 | +#define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2) | |
782 | +/* Deprecated since the advent of CURLAUTH_NEGOTIATE */ | |
783 | +#define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE | |
784 | +/* Used for CURLOPT_SOCKS5_AUTH to stay terminologically correct */ | |
785 | +#define CURLAUTH_GSSAPI CURLAUTH_NEGOTIATE | |
786 | +#define CURLAUTH_NTLM (((unsigned long)1)<<3) | |
787 | +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) | |
788 | +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) | |
789 | +#define CURLAUTH_BEARER (((unsigned long)1)<<6) | |
790 | +#define CURLAUTH_ONLY (((unsigned long)1)<<31) | |
791 | +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) | |
792 | +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) | |
793 | + | |
794 | +#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ | |
795 | +#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ | |
796 | +#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ | |
797 | +#define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ | |
798 | +#define CURLSSH_AUTH_HOST (1<<2) /* host key files */ | |
799 | +#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ | |
800 | +#define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */ | |
801 | +#define CURLSSH_AUTH_GSSAPI (1<<5) /* gssapi (kerberos, ...) */ | |
802 | +#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY | |
803 | + | |
804 | +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ | |
805 | +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ | |
806 | +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ | |
807 | + | |
808 | +#define CURL_ERROR_SIZE 256 | |
809 | + | |
810 | +enum curl_khtype { | |
811 | + CURLKHTYPE_UNKNOWN, | |
812 | + CURLKHTYPE_RSA1, | |
813 | + CURLKHTYPE_RSA, | |
814 | + CURLKHTYPE_DSS, | |
815 | + CURLKHTYPE_ECDSA, | |
816 | + CURLKHTYPE_ED25519 | |
817 | +}; | |
818 | + | |
819 | +struct curl_khkey { | |
820 | + const char *key; /* points to a null-terminated string encoded with base64 | |
821 | + if len is zero, otherwise to the "raw" data */ | |
822 | + size_t len; | |
823 | + enum curl_khtype keytype; | |
824 | +}; | |
825 | + | |
826 | +/* this is the set of return values expected from the curl_sshkeycallback | |
827 | + callback */ | |
828 | +enum curl_khstat { | |
829 | + CURLKHSTAT_FINE_ADD_TO_FILE, | |
830 | + CURLKHSTAT_FINE, | |
831 | + CURLKHSTAT_REJECT, /* reject the connection, return an error */ | |
832 | + CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so | |
833 | + this causes a CURLE_DEFER error but otherwise the | |
834 | + connection will be left intact etc */ | |
835 | + CURLKHSTAT_FINE_REPLACE, /* accept and replace the wrong key*/ | |
836 | + CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ | |
837 | +}; | |
838 | + | |
839 | +/* this is the set of status codes pass in to the callback */ | |
840 | +enum curl_khmatch { | |
841 | + CURLKHMATCH_OK, /* match */ | |
842 | + CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ | |
843 | + CURLKHMATCH_MISSING, /* no matching host/key found */ | |
844 | + CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ | |
845 | +}; | |
846 | + | |
847 | +typedef int | |
848 | + (*curl_sshkeycallback) (CURL *easy, /* easy handle */ | |
849 | + const struct curl_khkey *knownkey, /* known */ | |
850 | + const struct curl_khkey *foundkey, /* found */ | |
851 | + enum curl_khmatch, /* libcurl's view on the keys */ | |
852 | + void *clientp); /* custom pointer passed from app */ | |
853 | + | |
854 | +/* parameter for the CURLOPT_USE_SSL option */ | |
855 | +typedef enum { | |
856 | + CURLUSESSL_NONE, /* do not attempt to use SSL */ | |
857 | + CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ | |
858 | + CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ | |
859 | + CURLUSESSL_ALL, /* SSL for all communication or fail */ | |
860 | + CURLUSESSL_LAST /* not an option, never use */ | |
861 | +} curl_usessl; | |
862 | + | |
863 | +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ | |
864 | + | |
865 | +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the | |
866 | + name of improving interoperability with older servers. Some SSL libraries | |
867 | + have introduced work-arounds for this flaw but those work-arounds sometimes | |
868 | + make the SSL communication fail. To regain functionality with those broken | |
869 | + servers, a user can this way allow the vulnerability back. */ | |
870 | +#define CURLSSLOPT_ALLOW_BEAST (1<<0) | |
871 | + | |
872 | +/* - NO_REVOKE tells libcurl to disable certificate revocation checks for those | |
873 | + SSL backends where such behavior is present. */ | |
874 | +#define CURLSSLOPT_NO_REVOKE (1<<1) | |
875 | + | |
876 | +/* - NO_PARTIALCHAIN tells libcurl to *NOT* accept a partial certificate chain | |
877 | + if possible. The OpenSSL backend has this ability. */ | |
878 | +#define CURLSSLOPT_NO_PARTIALCHAIN (1<<2) | |
879 | + | |
880 | +/* - REVOKE_BEST_EFFORT tells libcurl to ignore certificate revocation offline | |
881 | + checks and ignore missing revocation list for those SSL backends where such | |
882 | + behavior is present. */ | |
883 | +#define CURLSSLOPT_REVOKE_BEST_EFFORT (1<<3) | |
884 | + | |
885 | +/* - CURLSSLOPT_NATIVE_CA tells libcurl to use standard certificate store of | |
886 | + operating system. Currently implemented under MS-Windows. */ | |
887 | +#define CURLSSLOPT_NATIVE_CA (1<<4) | |
888 | + | |
889 | +/* The default connection attempt delay in milliseconds for happy eyeballs. | |
890 | + CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 and happy-eyeballs-timeout-ms.d document | |
891 | + this value, keep them in sync. */ | |
892 | +#define CURL_HET_DEFAULT 200L | |
893 | + | |
894 | +/* The default connection upkeep interval in milliseconds. */ | |
895 | +#define CURL_UPKEEP_INTERVAL_DEFAULT 60000L | |
896 | + | |
897 | +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all | |
898 | + the obsolete stuff removed! */ | |
899 | + | |
900 | +/* Backwards compatibility with older names */ | |
901 | +/* These are scheduled to disappear by 2009 */ | |
902 | + | |
903 | +#define CURLFTPSSL_NONE CURLUSESSL_NONE | |
904 | +#define CURLFTPSSL_TRY CURLUSESSL_TRY | |
905 | +#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL | |
906 | +#define CURLFTPSSL_ALL CURLUSESSL_ALL | |
907 | +#define CURLFTPSSL_LAST CURLUSESSL_LAST | |
908 | +#define curl_ftpssl curl_usessl | |
909 | +#endif /*!CURL_NO_OLDIES*/ | |
910 | + | |
911 | +/* parameter for the CURLOPT_FTP_SSL_CCC option */ | |
912 | +typedef enum { | |
913 | + CURLFTPSSL_CCC_NONE, /* do not send CCC */ | |
914 | + CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ | |
915 | + CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ | |
916 | + CURLFTPSSL_CCC_LAST /* not an option, never use */ | |
917 | +} curl_ftpccc; | |
918 | + | |
919 | +/* parameter for the CURLOPT_FTPSSLAUTH option */ | |
920 | +typedef enum { | |
921 | + CURLFTPAUTH_DEFAULT, /* let libcurl decide */ | |
922 | + CURLFTPAUTH_SSL, /* use "AUTH SSL" */ | |
923 | + CURLFTPAUTH_TLS, /* use "AUTH TLS" */ | |
924 | + CURLFTPAUTH_LAST /* not an option, never use */ | |
925 | +} curl_ftpauth; | |
926 | + | |
927 | +/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ | |
928 | +typedef enum { | |
929 | + CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ | |
930 | + CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD | |
931 | + again if MKD succeeded, for SFTP this does | |
932 | + similar magic */ | |
933 | + CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD | |
934 | + again even if MKD failed! */ | |
935 | + CURLFTP_CREATE_DIR_LAST /* not an option, never use */ | |
936 | +} curl_ftpcreatedir; | |
937 | + | |
938 | +/* parameter for the CURLOPT_FTP_FILEMETHOD option */ | |
939 | +typedef enum { | |
940 | + CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ | |
941 | + CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ | |
942 | + CURLFTPMETHOD_NOCWD, /* no CWD at all */ | |
943 | + CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ | |
944 | + CURLFTPMETHOD_LAST /* not an option, never use */ | |
945 | +} curl_ftpmethod; | |
946 | + | |
947 | +/* bitmask defines for CURLOPT_HEADEROPT */ | |
948 | +#define CURLHEADER_UNIFIED 0 | |
949 | +#define CURLHEADER_SEPARATE (1<<0) | |
950 | + | |
951 | +/* CURLALTSVC_* are bits for the CURLOPT_ALTSVC_CTRL option */ | |
952 | +#define CURLALTSVC_READONLYFILE (1<<2) | |
953 | +#define CURLALTSVC_H1 (1<<3) | |
954 | +#define CURLALTSVC_H2 (1<<4) | |
955 | +#define CURLALTSVC_H3 (1<<5) | |
956 | + | |
957 | + | |
958 | +struct curl_hstsentry { | |
959 | + char *name; | |
960 | + size_t namelen; | |
961 | + unsigned int includeSubDomains:1; | |
962 | + char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */ | |
963 | +}; | |
964 | + | |
965 | +struct curl_index { | |
966 | + size_t index; /* the provided entry's "index" or count */ | |
967 | + size_t total; /* total number of entries to save */ | |
968 | +}; | |
969 | + | |
970 | +typedef enum { | |
971 | + CURLSTS_OK, | |
972 | + CURLSTS_DONE, | |
973 | + CURLSTS_FAIL | |
974 | +} CURLSTScode; | |
975 | + | |
976 | +typedef CURLSTScode (*curl_hstsread_callback)(CURL *easy, | |
977 | + struct curl_hstsentry *e, | |
978 | + void *userp); | |
979 | +typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy, | |
980 | + struct curl_hstsentry *e, | |
981 | + struct curl_index *i, | |
982 | + void *userp); | |
983 | + | |
984 | +/* CURLHSTS_* are bits for the CURLOPT_HSTS option */ | |
985 | +#define CURLHSTS_ENABLE (long)(1<<0) | |
986 | +#define CURLHSTS_READONLYFILE (long)(1<<1) | |
987 | + | |
988 | +/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ | |
989 | +#define CURLPROTO_HTTP (1<<0) | |
990 | +#define CURLPROTO_HTTPS (1<<1) | |
991 | +#define CURLPROTO_FTP (1<<2) | |
992 | +#define CURLPROTO_FTPS (1<<3) | |
993 | +#define CURLPROTO_SCP (1<<4) | |
994 | +#define CURLPROTO_SFTP (1<<5) | |
995 | +#define CURLPROTO_TELNET (1<<6) | |
996 | +#define CURLPROTO_LDAP (1<<7) | |
997 | +#define CURLPROTO_LDAPS (1<<8) | |
998 | +#define CURLPROTO_DICT (1<<9) | |
999 | +#define CURLPROTO_FILE (1<<10) | |
1000 | +#define CURLPROTO_TFTP (1<<11) | |
1001 | +#define CURLPROTO_IMAP (1<<12) | |
1002 | +#define CURLPROTO_IMAPS (1<<13) | |
1003 | +#define CURLPROTO_POP3 (1<<14) | |
1004 | +#define CURLPROTO_POP3S (1<<15) | |
1005 | +#define CURLPROTO_SMTP (1<<16) | |
1006 | +#define CURLPROTO_SMTPS (1<<17) | |
1007 | +#define CURLPROTO_RTSP (1<<18) | |
1008 | +#define CURLPROTO_RTMP (1<<19) | |
1009 | +#define CURLPROTO_RTMPT (1<<20) | |
1010 | +#define CURLPROTO_RTMPE (1<<21) | |
1011 | +#define CURLPROTO_RTMPTE (1<<22) | |
1012 | +#define CURLPROTO_RTMPS (1<<23) | |
1013 | +#define CURLPROTO_RTMPTS (1<<24) | |
1014 | +#define CURLPROTO_GOPHER (1<<25) | |
1015 | +#define CURLPROTO_SMB (1<<26) | |
1016 | +#define CURLPROTO_SMBS (1<<27) | |
1017 | +#define CURLPROTO_MQTT (1<<28) | |
1018 | +#define CURLPROTO_ALL (~0) /* enable everything */ | |
1019 | + | |
1020 | +/* long may be 32 or 64 bits, but we should never depend on anything else | |
1021 | + but 32 */ | |
1022 | +#define CURLOPTTYPE_LONG 0 | |
1023 | +#define CURLOPTTYPE_OBJECTPOINT 10000 | |
1024 | +#define CURLOPTTYPE_FUNCTIONPOINT 20000 | |
1025 | +#define CURLOPTTYPE_OFF_T 30000 | |
1026 | +#define CURLOPTTYPE_BLOB 40000 | |
1027 | + | |
1028 | +/* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the | |
1029 | + string options from the header file */ | |
1030 | + | |
1031 | + | |
1032 | +#define CURLOPT(na,t,nu) na = t + nu | |
1033 | + | |
1034 | +/* CURLOPT aliases that make no run-time difference */ | |
1035 | + | |
1036 | +/* 'char *' argument to a string with a trailing zero */ | |
1037 | +#define CURLOPTTYPE_STRINGPOINT CURLOPTTYPE_OBJECTPOINT | |
1038 | + | |
1039 | +/* 'struct curl_slist *' argument */ | |
1040 | +#define CURLOPTTYPE_SLISTPOINT CURLOPTTYPE_OBJECTPOINT | |
1041 | + | |
1042 | +/* 'void *' argument passed untouched to callback */ | |
1043 | +#define CURLOPTTYPE_CBPOINT CURLOPTTYPE_OBJECTPOINT | |
1044 | + | |
1045 | +/* 'long' argument with a set of values/bitmask */ | |
1046 | +#define CURLOPTTYPE_VALUES CURLOPTTYPE_LONG | |
1047 | + | |
1048 | +/* | |
1049 | + * All CURLOPT_* values. | |
1050 | + */ | |
1051 | + | |
1052 | +typedef enum { | |
1053 | + /* This is the FILE * or void * the regular output should be written to. */ | |
1054 | + CURLOPT(CURLOPT_WRITEDATA, CURLOPTTYPE_CBPOINT, 1), | |
1055 | + | |
1056 | + /* The full URL to get/put */ | |
1057 | + CURLOPT(CURLOPT_URL, CURLOPTTYPE_STRINGPOINT, 2), | |
1058 | + | |
1059 | + /* Port number to connect to, if other than default. */ | |
1060 | + CURLOPT(CURLOPT_PORT, CURLOPTTYPE_LONG, 3), | |
1061 | + | |
1062 | + /* Name of proxy to use. */ | |
1063 | + CURLOPT(CURLOPT_PROXY, CURLOPTTYPE_STRINGPOINT, 4), | |
1064 | + | |
1065 | + /* "user:password;options" to use when fetching. */ | |
1066 | + CURLOPT(CURLOPT_USERPWD, CURLOPTTYPE_STRINGPOINT, 5), | |
1067 | + | |
1068 | + /* "user:password" to use with proxy. */ | |
1069 | + CURLOPT(CURLOPT_PROXYUSERPWD, CURLOPTTYPE_STRINGPOINT, 6), | |
1070 | + | |
1071 | + /* Range to get, specified as an ASCII string. */ | |
1072 | + CURLOPT(CURLOPT_RANGE, CURLOPTTYPE_STRINGPOINT, 7), | |
1073 | + | |
1074 | + /* not used */ | |
1075 | + | |
1076 | + /* Specified file stream to upload from (use as input): */ | |
1077 | + CURLOPT(CURLOPT_READDATA, CURLOPTTYPE_CBPOINT, 9), | |
1078 | + | |
1079 | + /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE | |
1080 | + * bytes big. */ | |
1081 | + CURLOPT(CURLOPT_ERRORBUFFER, CURLOPTTYPE_OBJECTPOINT, 10), | |
1082 | + | |
1083 | + /* Function that will be called to store the output (instead of fwrite). The | |
1084 | + * parameters will use fwrite() syntax, make sure to follow them. */ | |
1085 | + CURLOPT(CURLOPT_WRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 11), | |
1086 | + | |
1087 | + /* Function that will be called to read the input (instead of fread). The | |
1088 | + * parameters will use fread() syntax, make sure to follow them. */ | |
1089 | + CURLOPT(CURLOPT_READFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 12), | |
1090 | + | |
1091 | + /* Time-out the read operation after this amount of seconds */ | |
1092 | + CURLOPT(CURLOPT_TIMEOUT, CURLOPTTYPE_LONG, 13), | |
1093 | + | |
1094 | + /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about | |
1095 | + * how large the file being sent really is. That allows better error | |
1096 | + * checking and better verifies that the upload was successful. -1 means | |
1097 | + * unknown size. | |
1098 | + * | |
1099 | + * For large file support, there is also a _LARGE version of the key | |
1100 | + * which takes an off_t type, allowing platforms with larger off_t | |
1101 | + * sizes to handle larger files. See below for INFILESIZE_LARGE. | |
1102 | + */ | |
1103 | + CURLOPT(CURLOPT_INFILESIZE, CURLOPTTYPE_LONG, 14), | |
1104 | + | |
1105 | + /* POST static input fields. */ | |
1106 | + CURLOPT(CURLOPT_POSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 15), | |
1107 | + | |
1108 | + /* Set the referrer page (needed by some CGIs) */ | |
1109 | + CURLOPT(CURLOPT_REFERER, CURLOPTTYPE_STRINGPOINT, 16), | |
1110 | + | |
1111 | + /* Set the FTP PORT string (interface name, named or numerical IP address) | |
1112 | + Use i.e '-' to use default address. */ | |
1113 | + CURLOPT(CURLOPT_FTPPORT, CURLOPTTYPE_STRINGPOINT, 17), | |
1114 | + | |
1115 | + /* Set the User-Agent string (examined by some CGIs) */ | |
1116 | + CURLOPT(CURLOPT_USERAGENT, CURLOPTTYPE_STRINGPOINT, 18), | |
1117 | + | |
1118 | + /* If the download receives less than "low speed limit" bytes/second | |
1119 | + * during "low speed time" seconds, the operations is aborted. | |
1120 | + * You could i.e if you have a pretty high speed connection, abort if | |
1121 | + * it is less than 2000 bytes/sec during 20 seconds. | |
1122 | + */ | |
1123 | + | |
1124 | + /* Set the "low speed limit" */ | |
1125 | + CURLOPT(CURLOPT_LOW_SPEED_LIMIT, CURLOPTTYPE_LONG, 19), | |
1126 | + | |
1127 | + /* Set the "low speed time" */ | |
1128 | + CURLOPT(CURLOPT_LOW_SPEED_TIME, CURLOPTTYPE_LONG, 20), | |
1129 | + | |
1130 | + /* Set the continuation offset. | |
1131 | + * | |
1132 | + * Note there is also a _LARGE version of this key which uses | |
1133 | + * off_t types, allowing for large file offsets on platforms which | |
1134 | + * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. | |
1135 | + */ | |
1136 | + CURLOPT(CURLOPT_RESUME_FROM, CURLOPTTYPE_LONG, 21), | |
1137 | + | |
1138 | + /* Set cookie in request: */ | |
1139 | + CURLOPT(CURLOPT_COOKIE, CURLOPTTYPE_STRINGPOINT, 22), | |
1140 | + | |
1141 | + /* This points to a linked list of headers, struct curl_slist kind. This | |
1142 | + list is also used for RTSP (in spite of its name) */ | |
1143 | + CURLOPT(CURLOPT_HTTPHEADER, CURLOPTTYPE_SLISTPOINT, 23), | |
1144 | + | |
1145 | + /* This points to a linked list of post entries, struct curl_httppost */ | |
1146 | + CURLOPT(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24), | |
1147 | + | |
1148 | + /* name of the file keeping your private SSL-certificate */ | |
1149 | + CURLOPT(CURLOPT_SSLCERT, CURLOPTTYPE_STRINGPOINT, 25), | |
1150 | + | |
1151 | + /* password for the SSL or SSH private key */ | |
1152 | + CURLOPT(CURLOPT_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 26), | |
1153 | + | |
1154 | + /* send TYPE parameter? */ | |
1155 | + CURLOPT(CURLOPT_CRLF, CURLOPTTYPE_LONG, 27), | |
1156 | + | |
1157 | + /* send linked-list of QUOTE commands */ | |
1158 | + CURLOPT(CURLOPT_QUOTE, CURLOPTTYPE_SLISTPOINT, 28), | |
1159 | + | |
1160 | + /* send FILE * or void * to store headers to, if you use a callback it | |
1161 | + is simply passed to the callback unmodified */ | |
1162 | + CURLOPT(CURLOPT_HEADERDATA, CURLOPTTYPE_CBPOINT, 29), | |
1163 | + | |
1164 | + /* point to a file to read the initial cookies from, also enables | |
1165 | + "cookie awareness" */ | |
1166 | + CURLOPT(CURLOPT_COOKIEFILE, CURLOPTTYPE_STRINGPOINT, 31), | |
1167 | + | |
1168 | + /* What version to specifically try to use. | |
1169 | + See CURL_SSLVERSION defines below. */ | |
1170 | + CURLOPT(CURLOPT_SSLVERSION, CURLOPTTYPE_VALUES, 32), | |
1171 | + | |
1172 | + /* What kind of HTTP time condition to use, see defines */ | |
1173 | + CURLOPT(CURLOPT_TIMECONDITION, CURLOPTTYPE_VALUES, 33), | |
1174 | + | |
1175 | + /* Time to use with the above condition. Specified in number of seconds | |
1176 | + since 1 Jan 1970 */ | |
1177 | + CURLOPT(CURLOPT_TIMEVALUE, CURLOPTTYPE_LONG, 34), | |
1178 | + | |
1179 | + /* 35 = OBSOLETE */ | |
1180 | + | |
1181 | + /* Custom request, for customizing the get command like | |
1182 | + HTTP: DELETE, TRACE and others | |
1183 | + FTP: to use a different list command | |
1184 | + */ | |
1185 | + CURLOPT(CURLOPT_CUSTOMREQUEST, CURLOPTTYPE_STRINGPOINT, 36), | |
1186 | + | |
1187 | + /* FILE handle to use instead of stderr */ | |
1188 | + CURLOPT(CURLOPT_STDERR, CURLOPTTYPE_OBJECTPOINT, 37), | |
1189 | + | |
1190 | + /* 38 is not used */ | |
1191 | + | |
1192 | + /* send linked-list of post-transfer QUOTE commands */ | |
1193 | + CURLOPT(CURLOPT_POSTQUOTE, CURLOPTTYPE_SLISTPOINT, 39), | |
1194 | + | |
1195 | + /* OBSOLETE, do not use! */ | |
1196 | + CURLOPT(CURLOPT_OBSOLETE40, CURLOPTTYPE_OBJECTPOINT, 40), | |
1197 | + | |
1198 | + /* talk a lot */ | |
1199 | + CURLOPT(CURLOPT_VERBOSE, CURLOPTTYPE_LONG, 41), | |
1200 | + | |
1201 | + /* throw the header out too */ | |
1202 | + CURLOPT(CURLOPT_HEADER, CURLOPTTYPE_LONG, 42), | |
1203 | + | |
1204 | + /* shut off the progress meter */ | |
1205 | + CURLOPT(CURLOPT_NOPROGRESS, CURLOPTTYPE_LONG, 43), | |
1206 | + | |
1207 | + /* use HEAD to get http document */ | |
1208 | + CURLOPT(CURLOPT_NOBODY, CURLOPTTYPE_LONG, 44), | |
1209 | + | |
1210 | + /* no output on http error codes >= 400 */ | |
1211 | + CURLOPT(CURLOPT_FAILONERROR, CURLOPTTYPE_LONG, 45), | |
1212 | + | |
1213 | + /* this is an upload */ | |
1214 | + CURLOPT(CURLOPT_UPLOAD, CURLOPTTYPE_LONG, 46), | |
1215 | + | |
1216 | + /* HTTP POST method */ | |
1217 | + CURLOPT(CURLOPT_POST, CURLOPTTYPE_LONG, 47), | |
1218 | + | |
1219 | + /* bare names when listing directories */ | |
1220 | + CURLOPT(CURLOPT_DIRLISTONLY, CURLOPTTYPE_LONG, 48), | |
1221 | + | |
1222 | + /* Append instead of overwrite on upload! */ | |
1223 | + CURLOPT(CURLOPT_APPEND, CURLOPTTYPE_LONG, 50), | |
1224 | + | |
1225 | + /* Specify whether to read the user+password from the .netrc or the URL. | |
1226 | + * This must be one of the CURL_NETRC_* enums below. */ | |
1227 | + CURLOPT(CURLOPT_NETRC, CURLOPTTYPE_VALUES, 51), | |
1228 | + | |
1229 | + /* use Location: Luke! */ | |
1230 | + CURLOPT(CURLOPT_FOLLOWLOCATION, CURLOPTTYPE_LONG, 52), | |
1231 | + | |
1232 | + /* transfer data in text/ASCII format */ | |
1233 | + CURLOPT(CURLOPT_TRANSFERTEXT, CURLOPTTYPE_LONG, 53), | |
1234 | + | |
1235 | + /* HTTP PUT */ | |
1236 | + CURLOPT(CURLOPT_PUT, CURLOPTTYPE_LONG, 54), | |
1237 | + | |
1238 | + /* 55 = OBSOLETE */ | |
1239 | + | |
1240 | + /* DEPRECATED | |
1241 | + * Function that will be called instead of the internal progress display | |
1242 | + * function. This function should be defined as the curl_progress_callback | |
1243 | + * prototype defines. */ | |
1244 | + CURLOPT(CURLOPT_PROGRESSFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 56), | |
1245 | + | |
1246 | + /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION | |
1247 | + callbacks */ | |
1248 | + CURLOPT(CURLOPT_XFERINFODATA, CURLOPTTYPE_CBPOINT, 57), | |
1249 | +#define CURLOPT_PROGRESSDATA CURLOPT_XFERINFODATA | |
1250 | + | |
1251 | + /* We want the referrer field set automatically when following locations */ | |
1252 | + CURLOPT(CURLOPT_AUTOREFERER, CURLOPTTYPE_LONG, 58), | |
1253 | + | |
1254 | + /* Port of the proxy, can be set in the proxy string as well with: | |
1255 | + "[host]:[port]" */ | |
1256 | + CURLOPT(CURLOPT_PROXYPORT, CURLOPTTYPE_LONG, 59), | |
1257 | + | |
1258 | + /* size of the POST input data, if strlen() is not good to use */ | |
1259 | + CURLOPT(CURLOPT_POSTFIELDSIZE, CURLOPTTYPE_LONG, 60), | |
1260 | + | |
1261 | + /* tunnel non-http operations through a HTTP proxy */ | |
1262 | + CURLOPT(CURLOPT_HTTPPROXYTUNNEL, CURLOPTTYPE_LONG, 61), | |
1263 | + | |
1264 | + /* Set the interface string to use as outgoing network interface */ | |
1265 | + CURLOPT(CURLOPT_INTERFACE, CURLOPTTYPE_STRINGPOINT, 62), | |
1266 | + | |
1267 | + /* Set the krb4/5 security level, this also enables krb4/5 awareness. This | |
1268 | + * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string | |
1269 | + * is set but doesn't match one of these, 'private' will be used. */ | |
1270 | + CURLOPT(CURLOPT_KRBLEVEL, CURLOPTTYPE_STRINGPOINT, 63), | |
1271 | + | |
1272 | + /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ | |
1273 | + CURLOPT(CURLOPT_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 64), | |
1274 | + | |
1275 | + /* The CApath or CAfile used to validate the peer certificate | |
1276 | + this option is used only if SSL_VERIFYPEER is true */ | |
1277 | + CURLOPT(CURLOPT_CAINFO, CURLOPTTYPE_STRINGPOINT, 65), | |
1278 | + | |
1279 | + /* 66 = OBSOLETE */ | |
1280 | + /* 67 = OBSOLETE */ | |
1281 | + | |
1282 | + /* Maximum number of http redirects to follow */ | |
1283 | + CURLOPT(CURLOPT_MAXREDIRS, CURLOPTTYPE_LONG, 68), | |
1284 | + | |
1285 | + /* Pass a long set to 1 to get the date of the requested document (if | |
1286 | + possible)! Pass a zero to shut it off. */ | |
1287 | + CURLOPT(CURLOPT_FILETIME, CURLOPTTYPE_LONG, 69), | |
1288 | + | |
1289 | + /* This points to a linked list of telnet options */ | |
1290 | + CURLOPT(CURLOPT_TELNETOPTIONS, CURLOPTTYPE_SLISTPOINT, 70), | |
1291 | + | |
1292 | + /* Max amount of cached alive connections */ | |
1293 | + CURLOPT(CURLOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 71), | |
1294 | + | |
1295 | + /* OBSOLETE, do not use! */ | |
1296 | + CURLOPT(CURLOPT_OBSOLETE72, CURLOPTTYPE_LONG, 72), | |
1297 | + | |
1298 | + /* 73 = OBSOLETE */ | |
1299 | + | |
1300 | + /* Set to explicitly use a new connection for the upcoming transfer. | |
1301 | + Do not use this unless you're absolutely sure of this, as it makes the | |
1302 | + operation slower and is less friendly for the network. */ | |
1303 | + CURLOPT(CURLOPT_FRESH_CONNECT, CURLOPTTYPE_LONG, 74), | |
1304 | + | |
1305 | + /* Set to explicitly forbid the upcoming transfer's connection to be re-used | |
1306 | + when done. Do not use this unless you're absolutely sure of this, as it | |
1307 | + makes the operation slower and is less friendly for the network. */ | |
1308 | + CURLOPT(CURLOPT_FORBID_REUSE, CURLOPTTYPE_LONG, 75), | |
1309 | + | |
1310 | + /* Set to a file name that contains random data for libcurl to use to | |
1311 | + seed the random engine when doing SSL connects. */ | |
1312 | + CURLOPT(CURLOPT_RANDOM_FILE, CURLOPTTYPE_STRINGPOINT, 76), | |
1313 | + | |
1314 | + /* Set to the Entropy Gathering Daemon socket pathname */ | |
1315 | + CURLOPT(CURLOPT_EGDSOCKET, CURLOPTTYPE_STRINGPOINT, 77), | |
1316 | + | |
1317 | + /* Time-out connect operations after this amount of seconds, if connects are | |
1318 | + OK within this time, then fine... This only aborts the connect phase. */ | |
1319 | + CURLOPT(CURLOPT_CONNECTTIMEOUT, CURLOPTTYPE_LONG, 78), | |
1320 | + | |
1321 | + /* Function that will be called to store headers (instead of fwrite). The | |
1322 | + * parameters will use fwrite() syntax, make sure to follow them. */ | |
1323 | + CURLOPT(CURLOPT_HEADERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 79), | |
1324 | + | |
1325 | + /* Set this to force the HTTP request to get back to GET. Only really usable | |
1326 | + if POST, PUT or a custom request have been used first. | |
1327 | + */ | |
1328 | + CURLOPT(CURLOPT_HTTPGET, CURLOPTTYPE_LONG, 80), | |
1329 | + | |
1330 | + /* Set if we should verify the Common name from the peer certificate in ssl | |
1331 | + * handshake, set 1 to check existence, 2 to ensure that it matches the | |
1332 | + * provided hostname. */ | |
1333 | + CURLOPT(CURLOPT_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 81), | |
1334 | + | |
1335 | + /* Specify which file name to write all known cookies in after completed | |
1336 | + operation. Set file name to "-" (dash) to make it go to stdout. */ | |
1337 | + CURLOPT(CURLOPT_COOKIEJAR, CURLOPTTYPE_STRINGPOINT, 82), | |
1338 | + | |
1339 | + /* Specify which SSL ciphers to use */ | |
1340 | + CURLOPT(CURLOPT_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 83), | |
1341 | + | |
1342 | + /* Specify which HTTP version to use! This must be set to one of the | |
1343 | + CURL_HTTP_VERSION* enums set below. */ | |
1344 | + CURLOPT(CURLOPT_HTTP_VERSION, CURLOPTTYPE_VALUES, 84), | |
1345 | + | |
1346 | + /* Specifically switch on or off the FTP engine's use of the EPSV command. By | |
1347 | + default, that one will always be attempted before the more traditional | |
1348 | + PASV command. */ | |
1349 | + CURLOPT(CURLOPT_FTP_USE_EPSV, CURLOPTTYPE_LONG, 85), | |
1350 | + | |
1351 | + /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ | |
1352 | + CURLOPT(CURLOPT_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 86), | |
1353 | + | |
1354 | + /* name of the file keeping your private SSL-key */ | |
1355 | + CURLOPT(CURLOPT_SSLKEY, CURLOPTTYPE_STRINGPOINT, 87), | |
1356 | + | |
1357 | + /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ | |
1358 | + CURLOPT(CURLOPT_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 88), | |
1359 | + | |
1360 | + /* crypto engine for the SSL-sub system */ | |
1361 | + CURLOPT(CURLOPT_SSLENGINE, CURLOPTTYPE_STRINGPOINT, 89), | |
1362 | + | |
1363 | + /* set the crypto engine for the SSL-sub system as default | |
1364 | + the param has no meaning... | |
1365 | + */ | |
1366 | + CURLOPT(CURLOPT_SSLENGINE_DEFAULT, CURLOPTTYPE_LONG, 90), | |
1367 | + | |
1368 | + /* Non-zero value means to use the global dns cache */ | |
1369 | + /* DEPRECATED, do not use! */ | |
1370 | + CURLOPT(CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOPTTYPE_LONG, 91), | |
1371 | + | |
1372 | + /* DNS cache timeout */ | |
1373 | + CURLOPT(CURLOPT_DNS_CACHE_TIMEOUT, CURLOPTTYPE_LONG, 92), | |
1374 | + | |
1375 | + /* send linked-list of pre-transfer QUOTE commands */ | |
1376 | + CURLOPT(CURLOPT_PREQUOTE, CURLOPTTYPE_SLISTPOINT, 93), | |
1377 | + | |
1378 | + /* set the debug function */ | |
1379 | + CURLOPT(CURLOPT_DEBUGFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 94), | |
1380 | + | |
1381 | + /* set the data for the debug function */ | |
1382 | + CURLOPT(CURLOPT_DEBUGDATA, CURLOPTTYPE_CBPOINT, 95), | |
1383 | + | |
1384 | + /* mark this as start of a cookie session */ | |
1385 | + CURLOPT(CURLOPT_COOKIESESSION, CURLOPTTYPE_LONG, 96), | |
1386 | + | |
1387 | + /* The CApath directory used to validate the peer certificate | |
1388 | + this option is used only if SSL_VERIFYPEER is true */ | |
1389 | + CURLOPT(CURLOPT_CAPATH, CURLOPTTYPE_STRINGPOINT, 97), | |
1390 | + | |
1391 | + /* Instruct libcurl to use a smaller receive buffer */ | |
1392 | + CURLOPT(CURLOPT_BUFFERSIZE, CURLOPTTYPE_LONG, 98), | |
1393 | + | |
1394 | + /* Instruct libcurl to not use any signal/alarm handlers, even when using | |
1395 | + timeouts. This option is useful for multi-threaded applications. | |
1396 | + See libcurl-the-guide for more background information. */ | |
1397 | + CURLOPT(CURLOPT_NOSIGNAL, CURLOPTTYPE_LONG, 99), | |
1398 | + | |
1399 | + /* Provide a CURLShare for mutexing non-ts data */ | |
1400 | + CURLOPT(CURLOPT_SHARE, CURLOPTTYPE_OBJECTPOINT, 100), | |
1401 | + | |
1402 | + /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), | |
1403 | + CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and | |
1404 | + CURLPROXY_SOCKS5. */ | |
1405 | + CURLOPT(CURLOPT_PROXYTYPE, CURLOPTTYPE_VALUES, 101), | |
1406 | + | |
1407 | + /* Set the Accept-Encoding string. Use this to tell a server you would like | |
1408 | + the response to be compressed. Before 7.21.6, this was known as | |
1409 | + CURLOPT_ENCODING */ | |
1410 | + CURLOPT(CURLOPT_ACCEPT_ENCODING, CURLOPTTYPE_STRINGPOINT, 102), | |
1411 | + | |
1412 | + /* Set pointer to private data */ | |
1413 | + CURLOPT(CURLOPT_PRIVATE, CURLOPTTYPE_OBJECTPOINT, 103), | |
1414 | + | |
1415 | + /* Set aliases for HTTP 200 in the HTTP Response header */ | |
1416 | + CURLOPT(CURLOPT_HTTP200ALIASES, CURLOPTTYPE_SLISTPOINT, 104), | |
1417 | + | |
1418 | + /* Continue to send authentication (user+password) when following locations, | |
1419 | + even when hostname changed. This can potentially send off the name | |
1420 | + and password to whatever host the server decides. */ | |
1421 | + CURLOPT(CURLOPT_UNRESTRICTED_AUTH, CURLOPTTYPE_LONG, 105), | |
1422 | + | |
1423 | + /* Specifically switch on or off the FTP engine's use of the EPRT command ( | |
1424 | + it also disables the LPRT attempt). By default, those ones will always be | |
1425 | + attempted before the good old traditional PORT command. */ | |
1426 | + CURLOPT(CURLOPT_FTP_USE_EPRT, CURLOPTTYPE_LONG, 106), | |
1427 | + | |
1428 | + /* Set this to a bitmask value to enable the particular authentications | |
1429 | + methods you like. Use this in combination with CURLOPT_USERPWD. | |
1430 | + Note that setting multiple bits may cause extra network round-trips. */ | |
1431 | + CURLOPT(CURLOPT_HTTPAUTH, CURLOPTTYPE_VALUES, 107), | |
1432 | + | |
1433 | + /* Set the ssl context callback function, currently only for OpenSSL or | |
1434 | + WolfSSL ssl_ctx, or mbedTLS mbedtls_ssl_config in the second argument. | |
1435 | + The function must match the curl_ssl_ctx_callback prototype. */ | |
1436 | + CURLOPT(CURLOPT_SSL_CTX_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 108), | |
1437 | + | |
1438 | + /* Set the userdata for the ssl context callback function's third | |
1439 | + argument */ | |
1440 | + CURLOPT(CURLOPT_SSL_CTX_DATA, CURLOPTTYPE_CBPOINT, 109), | |
1441 | + | |
1442 | + /* FTP Option that causes missing dirs to be created on the remote server. | |
1443 | + In 7.19.4 we introduced the convenience enums for this option using the | |
1444 | + CURLFTP_CREATE_DIR prefix. | |
1445 | + */ | |
1446 | + CURLOPT(CURLOPT_FTP_CREATE_MISSING_DIRS, CURLOPTTYPE_LONG, 110), | |
1447 | + | |
1448 | + /* Set this to a bitmask value to enable the particular authentications | |
1449 | + methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. | |
1450 | + Note that setting multiple bits may cause extra network round-trips. */ | |
1451 | + CURLOPT(CURLOPT_PROXYAUTH, CURLOPTTYPE_VALUES, 111), | |
1452 | + | |
1453 | + /* FTP option that changes the timeout, in seconds, associated with | |
1454 | + getting a response. This is different from transfer timeout time and | |
1455 | + essentially places a demand on the FTP server to acknowledge commands | |
1456 | + in a timely manner. */ | |
1457 | + CURLOPT(CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPTTYPE_LONG, 112), | |
1458 | +#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT | |
1459 | + | |
1460 | + /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to | |
1461 | + tell libcurl to resolve names to those IP versions only. This only has | |
1462 | + affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ | |
1463 | + CURLOPT(CURLOPT_IPRESOLVE, CURLOPTTYPE_VALUES, 113), | |
1464 | + | |
1465 | + /* Set this option to limit the size of a file that will be downloaded from | |
1466 | + an HTTP or FTP server. | |
1467 | + | |
1468 | + Note there is also _LARGE version which adds large file support for | |
1469 | + platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ | |
1470 | + CURLOPT(CURLOPT_MAXFILESIZE, CURLOPTTYPE_LONG, 114), | |
1471 | + | |
1472 | + /* See the comment for INFILESIZE above, but in short, specifies | |
1473 | + * the size of the file being uploaded. -1 means unknown. | |
1474 | + */ | |
1475 | + CURLOPT(CURLOPT_INFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 115), | |
1476 | + | |
1477 | + /* Sets the continuation offset. There is also a CURLOPTTYPE_LONG version | |
1478 | + * of this; look above for RESUME_FROM. | |
1479 | + */ | |
1480 | + CURLOPT(CURLOPT_RESUME_FROM_LARGE, CURLOPTTYPE_OFF_T, 116), | |
1481 | + | |
1482 | + /* Sets the maximum size of data that will be downloaded from | |
1483 | + * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. | |
1484 | + */ | |
1485 | + CURLOPT(CURLOPT_MAXFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 117), | |
1486 | + | |
1487 | + /* Set this option to the file name of your .netrc file you want libcurl | |
1488 | + to parse (using the CURLOPT_NETRC option). If not set, libcurl will do | |
1489 | + a poor attempt to find the user's home directory and check for a .netrc | |
1490 | + file in there. */ | |
1491 | + CURLOPT(CURLOPT_NETRC_FILE, CURLOPTTYPE_STRINGPOINT, 118), | |
1492 | + | |
1493 | + /* Enable SSL/TLS for FTP, pick one of: | |
1494 | + CURLUSESSL_TRY - try using SSL, proceed anyway otherwise | |
1495 | + CURLUSESSL_CONTROL - SSL for the control connection or fail | |
1496 | + CURLUSESSL_ALL - SSL for all communication or fail | |
1497 | + */ | |
1498 | + CURLOPT(CURLOPT_USE_SSL, CURLOPTTYPE_VALUES, 119), | |
1499 | + | |
1500 | + /* The _LARGE version of the standard POSTFIELDSIZE option */ | |
1501 | + CURLOPT(CURLOPT_POSTFIELDSIZE_LARGE, CURLOPTTYPE_OFF_T, 120), | |
1502 | + | |
1503 | + /* Enable/disable the TCP Nagle algorithm */ | |
1504 | + CURLOPT(CURLOPT_TCP_NODELAY, CURLOPTTYPE_LONG, 121), | |
1505 | + | |
1506 | + /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1507 | + /* 123 OBSOLETE. Gone in 7.16.0 */ | |
1508 | + /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1509 | + /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1510 | + /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1511 | + /* 127 OBSOLETE. Gone in 7.16.0 */ | |
1512 | + /* 128 OBSOLETE. Gone in 7.16.0 */ | |
1513 | + | |
1514 | + /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option | |
1515 | + can be used to change libcurl's default action which is to first try | |
1516 | + "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK | |
1517 | + response has been received. | |
1518 | + | |
1519 | + Available parameters are: | |
1520 | + CURLFTPAUTH_DEFAULT - let libcurl decide | |
1521 | + CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS | |
1522 | + CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL | |
1523 | + */ | |
1524 | + CURLOPT(CURLOPT_FTPSSLAUTH, CURLOPTTYPE_VALUES, 129), | |
1525 | + | |
1526 | + CURLOPT(CURLOPT_IOCTLFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 130), | |
1527 | + CURLOPT(CURLOPT_IOCTLDATA, CURLOPTTYPE_CBPOINT, 131), | |
1528 | + | |
1529 | + /* 132 OBSOLETE. Gone in 7.16.0 */ | |
1530 | + /* 133 OBSOLETE. Gone in 7.16.0 */ | |
1531 | + | |
1532 | + /* null-terminated string for pass on to the FTP server when asked for | |
1533 | + "account" info */ | |
1534 | + CURLOPT(CURLOPT_FTP_ACCOUNT, CURLOPTTYPE_STRINGPOINT, 134), | |
1535 | + | |
1536 | + /* feed cookie into cookie engine */ | |
1537 | + CURLOPT(CURLOPT_COOKIELIST, CURLOPTTYPE_STRINGPOINT, 135), | |
1538 | + | |
1539 | + /* ignore Content-Length */ | |
1540 | + CURLOPT(CURLOPT_IGNORE_CONTENT_LENGTH, CURLOPTTYPE_LONG, 136), | |
1541 | + | |
1542 | + /* Set to non-zero to skip the IP address received in a 227 PASV FTP server | |
1543 | + response. Typically used for FTP-SSL purposes but is not restricted to | |
1544 | + that. libcurl will then instead use the same IP address it used for the | |
1545 | + control connection. */ | |
1546 | + CURLOPT(CURLOPT_FTP_SKIP_PASV_IP, CURLOPTTYPE_LONG, 137), | |
1547 | + | |
1548 | + /* Select "file method" to use when doing FTP, see the curl_ftpmethod | |
1549 | + above. */ | |
1550 | + CURLOPT(CURLOPT_FTP_FILEMETHOD, CURLOPTTYPE_VALUES, 138), | |
1551 | + | |
1552 | + /* Local port number to bind the socket to */ | |
1553 | + CURLOPT(CURLOPT_LOCALPORT, CURLOPTTYPE_LONG, 139), | |
1554 | + | |
1555 | + /* Number of ports to try, including the first one set with LOCALPORT. | |
1556 | + Thus, setting it to 1 will make no additional attempts but the first. | |
1557 | + */ | |
1558 | + CURLOPT(CURLOPT_LOCALPORTRANGE, CURLOPTTYPE_LONG, 140), | |
1559 | + | |
1560 | + /* no transfer, set up connection and let application use the socket by | |
1561 | + extracting it with CURLINFO_LASTSOCKET */ | |
1562 | + CURLOPT(CURLOPT_CONNECT_ONLY, CURLOPTTYPE_LONG, 141), | |
1563 | + | |
1564 | + /* Function that will be called to convert from the | |
1565 | + network encoding (instead of using the iconv calls in libcurl) */ | |
1566 | + CURLOPT(CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 142), | |
1567 | + | |
1568 | + /* Function that will be called to convert to the | |
1569 | + network encoding (instead of using the iconv calls in libcurl) */ | |
1570 | + CURLOPT(CURLOPT_CONV_TO_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 143), | |
1571 | + | |
1572 | + /* Function that will be called to convert from UTF8 | |
1573 | + (instead of using the iconv calls in libcurl) | |
1574 | + Note that this is used only for SSL certificate processing */ | |
1575 | + CURLOPT(CURLOPT_CONV_FROM_UTF8_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 144), | |
1576 | + | |
1577 | + /* if the connection proceeds too quickly then need to slow it down */ | |
1578 | + /* limit-rate: maximum number of bytes per second to send or receive */ | |
1579 | + CURLOPT(CURLOPT_MAX_SEND_SPEED_LARGE, CURLOPTTYPE_OFF_T, 145), | |
1580 | + CURLOPT(CURLOPT_MAX_RECV_SPEED_LARGE, CURLOPTTYPE_OFF_T, 146), | |
1581 | + | |
1582 | + /* Pointer to command string to send if USER/PASS fails. */ | |
1583 | + CURLOPT(CURLOPT_FTP_ALTERNATIVE_TO_USER, CURLOPTTYPE_STRINGPOINT, 147), | |
1584 | + | |
1585 | + /* callback function for setting socket options */ | |
1586 | + CURLOPT(CURLOPT_SOCKOPTFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 148), | |
1587 | + CURLOPT(CURLOPT_SOCKOPTDATA, CURLOPTTYPE_CBPOINT, 149), | |
1588 | + | |
1589 | + /* set to 0 to disable session ID re-use for this transfer, default is | |
1590 | + enabled (== 1) */ | |
1591 | + CURLOPT(CURLOPT_SSL_SESSIONID_CACHE, CURLOPTTYPE_LONG, 150), | |
1592 | + | |
1593 | + /* allowed SSH authentication methods */ | |
1594 | + CURLOPT(CURLOPT_SSH_AUTH_TYPES, CURLOPTTYPE_VALUES, 151), | |
1595 | + | |
1596 | + /* Used by scp/sftp to do public/private key authentication */ | |
1597 | + CURLOPT(CURLOPT_SSH_PUBLIC_KEYFILE, CURLOPTTYPE_STRINGPOINT, 152), | |
1598 | + CURLOPT(CURLOPT_SSH_PRIVATE_KEYFILE, CURLOPTTYPE_STRINGPOINT, 153), | |
1599 | + | |
1600 | + /* Send CCC (Clear Command Channel) after authentication */ | |
1601 | + CURLOPT(CURLOPT_FTP_SSL_CCC, CURLOPTTYPE_LONG, 154), | |
1602 | + | |
1603 | + /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ | |
1604 | + CURLOPT(CURLOPT_TIMEOUT_MS, CURLOPTTYPE_LONG, 155), | |
1605 | + CURLOPT(CURLOPT_CONNECTTIMEOUT_MS, CURLOPTTYPE_LONG, 156), | |
1606 | + | |
1607 | + /* set to zero to disable the libcurl's decoding and thus pass the raw body | |
1608 | + data to the application even when it is encoded/compressed */ | |
1609 | + CURLOPT(CURLOPT_HTTP_TRANSFER_DECODING, CURLOPTTYPE_LONG, 157), | |
1610 | + CURLOPT(CURLOPT_HTTP_CONTENT_DECODING, CURLOPTTYPE_LONG, 158), | |
1611 | + | |
1612 | + /* Permission used when creating new files and directories on the remote | |
1613 | + server for protocols that support it, SFTP/SCP/FILE */ | |
1614 | + CURLOPT(CURLOPT_NEW_FILE_PERMS, CURLOPTTYPE_LONG, 159), | |
1615 | + CURLOPT(CURLOPT_NEW_DIRECTORY_PERMS, CURLOPTTYPE_LONG, 160), | |
1616 | + | |
1617 | + /* Set the behaviour of POST when redirecting. Values must be set to one | |
1618 | + of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ | |
1619 | + CURLOPT(CURLOPT_POSTREDIR, CURLOPTTYPE_VALUES, 161), | |
1620 | + | |
1621 | + /* used by scp/sftp to verify the host's public key */ | |
1622 | + CURLOPT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, CURLOPTTYPE_STRINGPOINT, 162), | |
1623 | + | |
1624 | + /* Callback function for opening socket (instead of socket(2)). Optionally, | |
1625 | + callback is able change the address or refuse to connect returning | |
1626 | + CURL_SOCKET_BAD. The callback should have type | |
1627 | + curl_opensocket_callback */ | |
1628 | + CURLOPT(CURLOPT_OPENSOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 163), | |
1629 | + CURLOPT(CURLOPT_OPENSOCKETDATA, CURLOPTTYPE_CBPOINT, 164), | |
1630 | + | |
1631 | + /* POST volatile input fields. */ | |
1632 | + CURLOPT(CURLOPT_COPYPOSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 165), | |
1633 | + | |
1634 | + /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */ | |
1635 | + CURLOPT(CURLOPT_PROXY_TRANSFER_MODE, CURLOPTTYPE_LONG, 166), | |
1636 | + | |
1637 | + /* Callback function for seeking in the input stream */ | |
1638 | + CURLOPT(CURLOPT_SEEKFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 167), | |
1639 | + CURLOPT(CURLOPT_SEEKDATA, CURLOPTTYPE_CBPOINT, 168), | |
1640 | + | |
1641 | + /* CRL file */ | |
1642 | + CURLOPT(CURLOPT_CRLFILE, CURLOPTTYPE_STRINGPOINT, 169), | |
1643 | + | |
1644 | + /* Issuer certificate */ | |
1645 | + CURLOPT(CURLOPT_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 170), | |
1646 | + | |
1647 | + /* (IPv6) Address scope */ | |
1648 | + CURLOPT(CURLOPT_ADDRESS_SCOPE, CURLOPTTYPE_LONG, 171), | |
1649 | + | |
1650 | + /* Collect certificate chain info and allow it to get retrievable with | |
1651 | + CURLINFO_CERTINFO after the transfer is complete. */ | |
1652 | + CURLOPT(CURLOPT_CERTINFO, CURLOPTTYPE_LONG, 172), | |
1653 | + | |
1654 | + /* "name" and "pwd" to use when fetching. */ | |
1655 | + CURLOPT(CURLOPT_USERNAME, CURLOPTTYPE_STRINGPOINT, 173), | |
1656 | + CURLOPT(CURLOPT_PASSWORD, CURLOPTTYPE_STRINGPOINT, 174), | |
1657 | + | |
1658 | + /* "name" and "pwd" to use with Proxy when fetching. */ | |
1659 | + CURLOPT(CURLOPT_PROXYUSERNAME, CURLOPTTYPE_STRINGPOINT, 175), | |
1660 | + CURLOPT(CURLOPT_PROXYPASSWORD, CURLOPTTYPE_STRINGPOINT, 176), | |
1661 | + | |
1662 | + /* Comma separated list of hostnames defining no-proxy zones. These should | |
1663 | + match both hostnames directly, and hostnames within a domain. For | |
1664 | + example, local.com will match local.com and www.local.com, but NOT | |
1665 | + notlocal.com or www.notlocal.com. For compatibility with other | |
1666 | + implementations of this, .local.com will be considered to be the same as | |
1667 | + local.com. A single * is the only valid wildcard, and effectively | |
1668 | + disables the use of proxy. */ | |
1669 | + CURLOPT(CURLOPT_NOPROXY, CURLOPTTYPE_STRINGPOINT, 177), | |
1670 | + | |
1671 | + /* block size for TFTP transfers */ | |
1672 | + CURLOPT(CURLOPT_TFTP_BLKSIZE, CURLOPTTYPE_LONG, 178), | |
1673 | + | |
1674 | + /* Socks Service */ | |
1675 | + /* DEPRECATED, do not use! */ | |
1676 | + CURLOPT(CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOPTTYPE_STRINGPOINT, 179), | |
1677 | + | |
1678 | + /* Socks Service */ | |
1679 | + CURLOPT(CURLOPT_SOCKS5_GSSAPI_NEC, CURLOPTTYPE_LONG, 180), | |
1680 | + | |
1681 | + /* set the bitmask for the protocols that are allowed to be used for the | |
1682 | + transfer, which thus helps the app which takes URLs from users or other | |
1683 | + external inputs and want to restrict what protocol(s) to deal | |
1684 | + with. Defaults to CURLPROTO_ALL. */ | |
1685 | + CURLOPT(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181), | |
1686 | + | |
1687 | + /* set the bitmask for the protocols that libcurl is allowed to follow to, | |
1688 | + as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs | |
1689 | + to be set in both bitmasks to be allowed to get redirected to. */ | |
1690 | + CURLOPT(CURLOPT_REDIR_PROTOCOLS, CURLOPTTYPE_LONG, 182), | |
1691 | + | |
1692 | + /* set the SSH knownhost file name to use */ | |
1693 | + CURLOPT(CURLOPT_SSH_KNOWNHOSTS, CURLOPTTYPE_STRINGPOINT, 183), | |
1694 | + | |
1695 | + /* set the SSH host key callback, must point to a curl_sshkeycallback | |
1696 | + function */ | |
1697 | + CURLOPT(CURLOPT_SSH_KEYFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 184), | |
1698 | + | |
1699 | + /* set the SSH host key callback custom pointer */ | |
1700 | + CURLOPT(CURLOPT_SSH_KEYDATA, CURLOPTTYPE_CBPOINT, 185), | |
1701 | + | |
1702 | + /* set the SMTP mail originator */ | |
1703 | + CURLOPT(CURLOPT_MAIL_FROM, CURLOPTTYPE_STRINGPOINT, 186), | |
1704 | + | |
1705 | + /* set the list of SMTP mail receiver(s) */ | |
1706 | + CURLOPT(CURLOPT_MAIL_RCPT, CURLOPTTYPE_SLISTPOINT, 187), | |
1707 | + | |
1708 | + /* FTP: send PRET before PASV */ | |
1709 | + CURLOPT(CURLOPT_FTP_USE_PRET, CURLOPTTYPE_LONG, 188), | |
1710 | + | |
1711 | + /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ | |
1712 | + CURLOPT(CURLOPT_RTSP_REQUEST, CURLOPTTYPE_VALUES, 189), | |
1713 | + | |
1714 | + /* The RTSP session identifier */ | |
1715 | + CURLOPT(CURLOPT_RTSP_SESSION_ID, CURLOPTTYPE_STRINGPOINT, 190), | |
1716 | + | |
1717 | + /* The RTSP stream URI */ | |
1718 | + CURLOPT(CURLOPT_RTSP_STREAM_URI, CURLOPTTYPE_STRINGPOINT, 191), | |
1719 | + | |
1720 | + /* The Transport: header to use in RTSP requests */ | |
1721 | + CURLOPT(CURLOPT_RTSP_TRANSPORT, CURLOPTTYPE_STRINGPOINT, 192), | |
1722 | + | |
1723 | + /* Manually initialize the client RTSP CSeq for this handle */ | |
1724 | + CURLOPT(CURLOPT_RTSP_CLIENT_CSEQ, CURLOPTTYPE_LONG, 193), | |
1725 | + | |
1726 | + /* Manually initialize the server RTSP CSeq for this handle */ | |
1727 | + CURLOPT(CURLOPT_RTSP_SERVER_CSEQ, CURLOPTTYPE_LONG, 194), | |
1728 | + | |
1729 | + /* The stream to pass to INTERLEAVEFUNCTION. */ | |
1730 | + CURLOPT(CURLOPT_INTERLEAVEDATA, CURLOPTTYPE_CBPOINT, 195), | |
1731 | + | |
1732 | + /* Let the application define a custom write method for RTP data */ | |
1733 | + CURLOPT(CURLOPT_INTERLEAVEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 196), | |
1734 | + | |
1735 | + /* Turn on wildcard matching */ | |
1736 | + CURLOPT(CURLOPT_WILDCARDMATCH, CURLOPTTYPE_LONG, 197), | |
1737 | + | |
1738 | + /* Directory matching callback called before downloading of an | |
1739 | + individual file (chunk) started */ | |
1740 | + CURLOPT(CURLOPT_CHUNK_BGN_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 198), | |
1741 | + | |
1742 | + /* Directory matching callback called after the file (chunk) | |
1743 | + was downloaded, or skipped */ | |
1744 | + CURLOPT(CURLOPT_CHUNK_END_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 199), | |
1745 | + | |
1746 | + /* Change match (fnmatch-like) callback for wildcard matching */ | |
1747 | + CURLOPT(CURLOPT_FNMATCH_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 200), | |
1748 | + | |
1749 | + /* Let the application define custom chunk data pointer */ | |
1750 | + CURLOPT(CURLOPT_CHUNK_DATA, CURLOPTTYPE_CBPOINT, 201), | |
1751 | + | |
1752 | + /* FNMATCH_FUNCTION user pointer */ | |
1753 | + CURLOPT(CURLOPT_FNMATCH_DATA, CURLOPTTYPE_CBPOINT, 202), | |
1754 | + | |
1755 | + /* send linked-list of name:port:address sets */ | |
1756 | + CURLOPT(CURLOPT_RESOLVE, CURLOPTTYPE_SLISTPOINT, 203), | |
1757 | + | |
1758 | + /* Set a username for authenticated TLS */ | |
1759 | + CURLOPT(CURLOPT_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 204), | |
1760 | + | |
1761 | + /* Set a password for authenticated TLS */ | |
1762 | + CURLOPT(CURLOPT_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 205), | |
1763 | + | |
1764 | + /* Set authentication type for authenticated TLS */ | |
1765 | + CURLOPT(CURLOPT_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 206), | |
1766 | + | |
1767 | + /* Set to 1 to enable the "TE:" header in HTTP requests to ask for | |
1768 | + compressed transfer-encoded responses. Set to 0 to disable the use of TE: | |
1769 | + in outgoing requests. The current default is 0, but it might change in a | |
1770 | + future libcurl release. | |
1771 | + | |
1772 | + libcurl will ask for the compressed methods it knows of, and if that | |
1773 | + isn't any, it will not ask for transfer-encoding at all even if this | |
1774 | + option is set to 1. | |
1775 | + | |
1776 | + */ | |
1777 | + CURLOPT(CURLOPT_TRANSFER_ENCODING, CURLOPTTYPE_LONG, 207), | |
1778 | + | |
1779 | + /* Callback function for closing socket (instead of close(2)). The callback | |
1780 | + should have type curl_closesocket_callback */ | |
1781 | + CURLOPT(CURLOPT_CLOSESOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 208), | |
1782 | + CURLOPT(CURLOPT_CLOSESOCKETDATA, CURLOPTTYPE_CBPOINT, 209), | |
1783 | + | |
1784 | + /* allow GSSAPI credential delegation */ | |
1785 | + CURLOPT(CURLOPT_GSSAPI_DELEGATION, CURLOPTTYPE_VALUES, 210), | |
1786 | + | |
1787 | + /* Set the name servers to use for DNS resolution */ | |
1788 | + CURLOPT(CURLOPT_DNS_SERVERS, CURLOPTTYPE_STRINGPOINT, 211), | |
1789 | + | |
1790 | + /* Time-out accept operations (currently for FTP only) after this amount | |
1791 | + of milliseconds. */ | |
1792 | + CURLOPT(CURLOPT_ACCEPTTIMEOUT_MS, CURLOPTTYPE_LONG, 212), | |
1793 | + | |
1794 | + /* Set TCP keepalive */ | |
1795 | + CURLOPT(CURLOPT_TCP_KEEPALIVE, CURLOPTTYPE_LONG, 213), | |
1796 | + | |
1797 | + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ | |
1798 | + CURLOPT(CURLOPT_TCP_KEEPIDLE, CURLOPTTYPE_LONG, 214), | |
1799 | + CURLOPT(CURLOPT_TCP_KEEPINTVL, CURLOPTTYPE_LONG, 215), | |
1800 | + | |
1801 | + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ | |
1802 | + CURLOPT(CURLOPT_SSL_OPTIONS, CURLOPTTYPE_VALUES, 216), | |
1803 | + | |
1804 | + /* Set the SMTP auth originator */ | |
1805 | + CURLOPT(CURLOPT_MAIL_AUTH, CURLOPTTYPE_STRINGPOINT, 217), | |
1806 | + | |
1807 | + /* Enable/disable SASL initial response */ | |
1808 | + CURLOPT(CURLOPT_SASL_IR, CURLOPTTYPE_LONG, 218), | |
1809 | + | |
1810 | + /* Function that will be called instead of the internal progress display | |
1811 | + * function. This function should be defined as the curl_xferinfo_callback | |
1812 | + * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */ | |
1813 | + CURLOPT(CURLOPT_XFERINFOFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 219), | |
1814 | + | |
1815 | + /* The XOAUTH2 bearer token */ | |
1816 | + CURLOPT(CURLOPT_XOAUTH2_BEARER, CURLOPTTYPE_STRINGPOINT, 220), | |
1817 | + | |
1818 | + /* Set the interface string to use as outgoing network | |
1819 | + * interface for DNS requests. | |
1820 | + * Only supported by the c-ares DNS backend */ | |
1821 | + CURLOPT(CURLOPT_DNS_INTERFACE, CURLOPTTYPE_STRINGPOINT, 221), | |
1822 | + | |
1823 | + /* Set the local IPv4 address to use for outgoing DNS requests. | |
1824 | + * Only supported by the c-ares DNS backend */ | |
1825 | + CURLOPT(CURLOPT_DNS_LOCAL_IP4, CURLOPTTYPE_STRINGPOINT, 222), | |
1826 | + | |
1827 | + /* Set the local IPv6 address to use for outgoing DNS requests. | |
1828 | + * Only supported by the c-ares DNS backend */ | |
1829 | + CURLOPT(CURLOPT_DNS_LOCAL_IP6, CURLOPTTYPE_STRINGPOINT, 223), | |
1830 | + | |
1831 | + /* Set authentication options directly */ | |
1832 | + CURLOPT(CURLOPT_LOGIN_OPTIONS, CURLOPTTYPE_STRINGPOINT, 224), | |
1833 | + | |
1834 | + /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */ | |
1835 | + CURLOPT(CURLOPT_SSL_ENABLE_NPN, CURLOPTTYPE_LONG, 225), | |
1836 | + | |
1837 | + /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */ | |
1838 | + CURLOPT(CURLOPT_SSL_ENABLE_ALPN, CURLOPTTYPE_LONG, 226), | |
1839 | + | |
1840 | + /* Time to wait for a response to a HTTP request containing an | |
1841 | + * Expect: 100-continue header before sending the data anyway. */ | |
1842 | + CURLOPT(CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOPTTYPE_LONG, 227), | |
1843 | + | |
1844 | + /* This points to a linked list of headers used for proxy requests only, | |
1845 | + struct curl_slist kind */ | |
1846 | + CURLOPT(CURLOPT_PROXYHEADER, CURLOPTTYPE_SLISTPOINT, 228), | |
1847 | + | |
1848 | + /* Pass in a bitmask of "header options" */ | |
1849 | + CURLOPT(CURLOPT_HEADEROPT, CURLOPTTYPE_VALUES, 229), | |
1850 | + | |
1851 | + /* The public key in DER form used to validate the peer public key | |
1852 | + this option is used only if SSL_VERIFYPEER is true */ | |
1853 | + CURLOPT(CURLOPT_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 230), | |
1854 | + | |
1855 | + /* Path to Unix domain socket */ | |
1856 | + CURLOPT(CURLOPT_UNIX_SOCKET_PATH, CURLOPTTYPE_STRINGPOINT, 231), | |
1857 | + | |
1858 | + /* Set if we should verify the certificate status. */ | |
1859 | + CURLOPT(CURLOPT_SSL_VERIFYSTATUS, CURLOPTTYPE_LONG, 232), | |
1860 | + | |
1861 | + /* Set if we should enable TLS false start. */ | |
1862 | + CURLOPT(CURLOPT_SSL_FALSESTART, CURLOPTTYPE_LONG, 233), | |
1863 | + | |
1864 | + /* Do not squash dot-dot sequences */ | |
1865 | + CURLOPT(CURLOPT_PATH_AS_IS, CURLOPTTYPE_LONG, 234), | |
1866 | + | |
1867 | + /* Proxy Service Name */ | |
1868 | + CURLOPT(CURLOPT_PROXY_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 235), | |
1869 | + | |
1870 | + /* Service Name */ | |
1871 | + CURLOPT(CURLOPT_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 236), | |
1872 | + | |
1873 | + /* Wait/don't wait for pipe/mutex to clarify */ | |
1874 | + CURLOPT(CURLOPT_PIPEWAIT, CURLOPTTYPE_LONG, 237), | |
1875 | + | |
1876 | + /* Set the protocol used when curl is given a URL without a protocol */ | |
1877 | + CURLOPT(CURLOPT_DEFAULT_PROTOCOL, CURLOPTTYPE_STRINGPOINT, 238), | |
1878 | + | |
1879 | + /* Set stream weight, 1 - 256 (default is 16) */ | |
1880 | + CURLOPT(CURLOPT_STREAM_WEIGHT, CURLOPTTYPE_LONG, 239), | |
1881 | + | |
1882 | + /* Set stream dependency on another CURL handle */ | |
1883 | + CURLOPT(CURLOPT_STREAM_DEPENDS, CURLOPTTYPE_OBJECTPOINT, 240), | |
1884 | + | |
1885 | + /* Set E-xclusive stream dependency on another CURL handle */ | |
1886 | + CURLOPT(CURLOPT_STREAM_DEPENDS_E, CURLOPTTYPE_OBJECTPOINT, 241), | |
1887 | + | |
1888 | + /* Do not send any tftp option requests to the server */ | |
1889 | + CURLOPT(CURLOPT_TFTP_NO_OPTIONS, CURLOPTTYPE_LONG, 242), | |
1890 | + | |
1891 | + /* Linked-list of host:port:connect-to-host:connect-to-port, | |
1892 | + overrides the URL's host:port (only for the network layer) */ | |
1893 | + CURLOPT(CURLOPT_CONNECT_TO, CURLOPTTYPE_SLISTPOINT, 243), | |
1894 | + | |
1895 | + /* Set TCP Fast Open */ | |
1896 | + CURLOPT(CURLOPT_TCP_FASTOPEN, CURLOPTTYPE_LONG, 244), | |
1897 | + | |
1898 | + /* Continue to send data if the server responds early with an | |
1899 | + * HTTP status code >= 300 */ | |
1900 | + CURLOPT(CURLOPT_KEEP_SENDING_ON_ERROR, CURLOPTTYPE_LONG, 245), | |
1901 | + | |
1902 | + /* The CApath or CAfile used to validate the proxy certificate | |
1903 | + this option is used only if PROXY_SSL_VERIFYPEER is true */ | |
1904 | + CURLOPT(CURLOPT_PROXY_CAINFO, CURLOPTTYPE_STRINGPOINT, 246), | |
1905 | + | |
1906 | + /* The CApath directory used to validate the proxy certificate | |
1907 | + this option is used only if PROXY_SSL_VERIFYPEER is true */ | |
1908 | + CURLOPT(CURLOPT_PROXY_CAPATH, CURLOPTTYPE_STRINGPOINT, 247), | |
1909 | + | |
1910 | + /* Set if we should verify the proxy in ssl handshake, | |
1911 | + set 1 to verify. */ | |
1912 | + CURLOPT(CURLOPT_PROXY_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 248), | |
1913 | + | |
1914 | + /* Set if we should verify the Common name from the proxy certificate in ssl | |
1915 | + * handshake, set 1 to check existence, 2 to ensure that it matches | |
1916 | + * the provided hostname. */ | |
1917 | + CURLOPT(CURLOPT_PROXY_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 249), | |
1918 | + | |
1919 | + /* What version to specifically try to use for proxy. | |
1920 | + See CURL_SSLVERSION defines below. */ | |
1921 | + CURLOPT(CURLOPT_PROXY_SSLVERSION, CURLOPTTYPE_VALUES, 250), | |
1922 | + | |
1923 | + /* Set a username for authenticated TLS for proxy */ | |
1924 | + CURLOPT(CURLOPT_PROXY_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 251), | |
1925 | + | |
1926 | + /* Set a password for authenticated TLS for proxy */ | |
1927 | + CURLOPT(CURLOPT_PROXY_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 252), | |
1928 | + | |
1929 | + /* Set authentication type for authenticated TLS for proxy */ | |
1930 | + CURLOPT(CURLOPT_PROXY_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 253), | |
1931 | + | |
1932 | + /* name of the file keeping your private SSL-certificate for proxy */ | |
1933 | + CURLOPT(CURLOPT_PROXY_SSLCERT, CURLOPTTYPE_STRINGPOINT, 254), | |
1934 | + | |
1935 | + /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for | |
1936 | + proxy */ | |
1937 | + CURLOPT(CURLOPT_PROXY_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 255), | |
1938 | + | |
1939 | + /* name of the file keeping your private SSL-key for proxy */ | |
1940 | + CURLOPT(CURLOPT_PROXY_SSLKEY, CURLOPTTYPE_STRINGPOINT, 256), | |
1941 | + | |
1942 | + /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for | |
1943 | + proxy */ | |
1944 | + CURLOPT(CURLOPT_PROXY_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 257), | |
1945 | + | |
1946 | + /* password for the SSL private key for proxy */ | |
1947 | + CURLOPT(CURLOPT_PROXY_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 258), | |
1948 | + | |
1949 | + /* Specify which SSL ciphers to use for proxy */ | |
1950 | + CURLOPT(CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 259), | |
1951 | + | |
1952 | + /* CRL file for proxy */ | |
1953 | + CURLOPT(CURLOPT_PROXY_CRLFILE, CURLOPTTYPE_STRINGPOINT, 260), | |
1954 | + | |
1955 | + /* Enable/disable specific SSL features with a bitmask for proxy, see | |
1956 | + CURLSSLOPT_* */ | |
1957 | + CURLOPT(CURLOPT_PROXY_SSL_OPTIONS, CURLOPTTYPE_LONG, 261), | |
1958 | + | |
1959 | + /* Name of pre proxy to use. */ | |
1960 | + CURLOPT(CURLOPT_PRE_PROXY, CURLOPTTYPE_STRINGPOINT, 262), | |
1961 | + | |
1962 | + /* The public key in DER form used to validate the proxy public key | |
1963 | + this option is used only if PROXY_SSL_VERIFYPEER is true */ | |
1964 | + CURLOPT(CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 263), | |
1965 | + | |
1966 | + /* Path to an abstract Unix domain socket */ | |
1967 | + CURLOPT(CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOPTTYPE_STRINGPOINT, 264), | |
1968 | + | |
1969 | + /* Suppress proxy CONNECT response headers from user callbacks */ | |
1970 | + CURLOPT(CURLOPT_SUPPRESS_CONNECT_HEADERS, CURLOPTTYPE_LONG, 265), | |
1971 | + | |
1972 | + /* The request target, instead of extracted from the URL */ | |
1973 | + CURLOPT(CURLOPT_REQUEST_TARGET, CURLOPTTYPE_STRINGPOINT, 266), | |
1974 | + | |
1975 | + /* bitmask of allowed auth methods for connections to SOCKS5 proxies */ | |
1976 | + CURLOPT(CURLOPT_SOCKS5_AUTH, CURLOPTTYPE_LONG, 267), | |
1977 | + | |
1978 | + /* Enable/disable SSH compression */ | |
1979 | + CURLOPT(CURLOPT_SSH_COMPRESSION, CURLOPTTYPE_LONG, 268), | |
1980 | + | |
1981 | + /* Post MIME data. */ | |
1982 | + CURLOPT(CURLOPT_MIMEPOST, CURLOPTTYPE_OBJECTPOINT, 269), | |
1983 | + | |
1984 | + /* Time to use with the CURLOPT_TIMECONDITION. Specified in number of | |
1985 | + seconds since 1 Jan 1970. */ | |
1986 | + CURLOPT(CURLOPT_TIMEVALUE_LARGE, CURLOPTTYPE_OFF_T, 270), | |
1987 | + | |
1988 | + /* Head start in milliseconds to give happy eyeballs. */ | |
1989 | + CURLOPT(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, CURLOPTTYPE_LONG, 271), | |
1990 | + | |
1991 | + /* Function that will be called before a resolver request is made */ | |
1992 | + CURLOPT(CURLOPT_RESOLVER_START_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 272), | |
1993 | + | |
1994 | + /* User data to pass to the resolver start callback. */ | |
1995 | + CURLOPT(CURLOPT_RESOLVER_START_DATA, CURLOPTTYPE_CBPOINT, 273), | |
1996 | + | |
1997 | + /* send HAProxy PROXY protocol header? */ | |
1998 | + CURLOPT(CURLOPT_HAPROXYPROTOCOL, CURLOPTTYPE_LONG, 274), | |
1999 | + | |
2000 | + /* shuffle addresses before use when DNS returns multiple */ | |
2001 | + CURLOPT(CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOPTTYPE_LONG, 275), | |
2002 | + | |
2003 | + /* Specify which TLS 1.3 ciphers suites to use */ | |
2004 | + CURLOPT(CURLOPT_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 276), | |
2005 | + CURLOPT(CURLOPT_PROXY_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 277), | |
2006 | + | |
2007 | + /* Disallow specifying username/login in URL. */ | |
2008 | + CURLOPT(CURLOPT_DISALLOW_USERNAME_IN_URL, CURLOPTTYPE_LONG, 278), | |
2009 | + | |
2010 | + /* DNS-over-HTTPS URL */ | |
2011 | + CURLOPT(CURLOPT_DOH_URL, CURLOPTTYPE_STRINGPOINT, 279), | |
2012 | + | |
2013 | + /* Preferred buffer size to use for uploads */ | |
2014 | + CURLOPT(CURLOPT_UPLOAD_BUFFERSIZE, CURLOPTTYPE_LONG, 280), | |
2015 | + | |
2016 | + /* Time in ms between connection upkeep calls for long-lived connections. */ | |
2017 | + CURLOPT(CURLOPT_UPKEEP_INTERVAL_MS, CURLOPTTYPE_LONG, 281), | |
2018 | + | |
2019 | + /* Specify URL using CURL URL API. */ | |
2020 | + CURLOPT(CURLOPT_CURLU, CURLOPTTYPE_OBJECTPOINT, 282), | |
2021 | + | |
2022 | + /* add trailing data just after no more data is available */ | |
2023 | + CURLOPT(CURLOPT_TRAILERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 283), | |
2024 | + | |
2025 | + /* pointer to be passed to HTTP_TRAILER_FUNCTION */ | |
2026 | + CURLOPT(CURLOPT_TRAILERDATA, CURLOPTTYPE_CBPOINT, 284), | |
2027 | + | |
2028 | + /* set this to 1L to allow HTTP/0.9 responses or 0L to disallow */ | |
2029 | + CURLOPT(CURLOPT_HTTP09_ALLOWED, CURLOPTTYPE_LONG, 285), | |
2030 | + | |
2031 | + /* alt-svc control bitmask */ | |
2032 | + CURLOPT(CURLOPT_ALTSVC_CTRL, CURLOPTTYPE_LONG, 286), | |
2033 | + | |
2034 | + /* alt-svc cache file name to possibly read from/write to */ | |
2035 | + CURLOPT(CURLOPT_ALTSVC, CURLOPTTYPE_STRINGPOINT, 287), | |
2036 | + | |
2037 | + /* maximum age of a connection to consider it for reuse (in seconds) */ | |
2038 | + CURLOPT(CURLOPT_MAXAGE_CONN, CURLOPTTYPE_LONG, 288), | |
2039 | + | |
2040 | + /* SASL authorisation identity */ | |
2041 | + CURLOPT(CURLOPT_SASL_AUTHZID, CURLOPTTYPE_STRINGPOINT, 289), | |
2042 | + | |
2043 | + /* allow RCPT TO command to fail for some recipients */ | |
2044 | + CURLOPT(CURLOPT_MAIL_RCPT_ALLLOWFAILS, CURLOPTTYPE_LONG, 290), | |
2045 | + | |
2046 | + /* the private SSL-certificate as a "blob" */ | |
2047 | + CURLOPT(CURLOPT_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 291), | |
2048 | + CURLOPT(CURLOPT_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 292), | |
2049 | + CURLOPT(CURLOPT_PROXY_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 293), | |
2050 | + CURLOPT(CURLOPT_PROXY_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 294), | |
2051 | + CURLOPT(CURLOPT_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 295), | |
2052 | + | |
2053 | + /* Issuer certificate for proxy */ | |
2054 | + CURLOPT(CURLOPT_PROXY_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 296), | |
2055 | + CURLOPT(CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 297), | |
2056 | + | |
2057 | + /* the EC curves requested by the TLS client (RFC 8422, 5.1); | |
2058 | + * OpenSSL support via 'set_groups'/'set_curves': | |
2059 | + * https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set1_groups.html | |
2060 | + */ | |
2061 | + CURLOPT(CURLOPT_SSL_EC_CURVES, CURLOPTTYPE_STRINGPOINT, 298), | |
2062 | + | |
2063 | + /* HSTS bitmask */ | |
2064 | + CURLOPT(CURLOPT_HSTS_CTRL, CURLOPTTYPE_LONG, 299), | |
2065 | + /* HSTS file name */ | |
2066 | + CURLOPT(CURLOPT_HSTS, CURLOPTTYPE_STRINGPOINT, 300), | |
2067 | + | |
2068 | + /* HSTS read callback */ | |
2069 | + CURLOPT(CURLOPT_HSTSREADFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 301), | |
2070 | + CURLOPT(CURLOPT_HSTSREADDATA, CURLOPTTYPE_CBPOINT, 302), | |
2071 | + | |
2072 | + /* HSTS write callback */ | |
2073 | + CURLOPT(CURLOPT_HSTSWRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 303), | |
2074 | + CURLOPT(CURLOPT_HSTSWRITEDATA, CURLOPTTYPE_CBPOINT, 304), | |
2075 | + | |
2076 | + CURLOPT_LASTENTRY /* the last unused */ | |
2077 | +} CURLoption; | |
2078 | + | |
2079 | +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all | |
2080 | + the obsolete stuff removed! */ | |
2081 | + | |
2082 | +/* Backwards compatibility with older names */ | |
2083 | +/* These are scheduled to disappear by 2011 */ | |
2084 | + | |
2085 | +/* This was added in version 7.19.1 */ | |
2086 | +#define CURLOPT_POST301 CURLOPT_POSTREDIR | |
2087 | + | |
2088 | +/* These are scheduled to disappear by 2009 */ | |
2089 | + | |
2090 | +/* The following were added in 7.17.0 */ | |
2091 | +#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD | |
2092 | +#define CURLOPT_FTPAPPEND CURLOPT_APPEND | |
2093 | +#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY | |
2094 | +#define CURLOPT_FTP_SSL CURLOPT_USE_SSL | |
2095 | + | |
2096 | +/* The following were added earlier */ | |
2097 | + | |
2098 | +#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD | |
2099 | +#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL | |
2100 | + | |
2101 | +#else | |
2102 | +/* This is set if CURL_NO_OLDIES is defined at compile-time */ | |
2103 | +#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ | |
2104 | +#endif | |
2105 | + | |
2106 | + | |
2107 | + /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host | |
2108 | + name resolves addresses using more than one IP protocol version, this | |
2109 | + option might be handy to force libcurl to use a specific IP version. */ | |
2110 | +#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP | |
2111 | + versions that your system allows */ | |
2112 | +#define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */ | |
2113 | +#define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */ | |
2114 | + | |
2115 | + /* three convenient "aliases" that follow the name scheme better */ | |
2116 | +#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER | |
2117 | + | |
2118 | + /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ | |
2119 | +enum { | |
2120 | + CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd | |
2121 | + like the library to choose the best possible | |
2122 | + for us! */ | |
2123 | + CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ | |
2124 | + CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ | |
2125 | + CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */ | |
2126 | + CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */ | |
2127 | + CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* please use HTTP 2 without HTTP/1.1 | |
2128 | + Upgrade */ | |
2129 | + CURL_HTTP_VERSION_3 = 30, /* Makes use of explicit HTTP/3 without fallback. | |
2130 | + Use CURLOPT_ALTSVC to enable HTTP/3 upgrade */ | |
2131 | + CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ | |
2132 | +}; | |
2133 | + | |
2134 | +/* Convenience definition simple because the name of the version is HTTP/2 and | |
2135 | + not 2.0. The 2_0 version of the enum name was set while the version was | |
2136 | + still planned to be 2.0 and we stick to it for compatibility. */ | |
2137 | +#define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0 | |
2138 | + | |
2139 | +/* | |
2140 | + * Public API enums for RTSP requests | |
2141 | + */ | |
2142 | +enum { | |
2143 | + CURL_RTSPREQ_NONE, /* first in list */ | |
2144 | + CURL_RTSPREQ_OPTIONS, | |
2145 | + CURL_RTSPREQ_DESCRIBE, | |
2146 | + CURL_RTSPREQ_ANNOUNCE, | |
2147 | + CURL_RTSPREQ_SETUP, | |
2148 | + CURL_RTSPREQ_PLAY, | |
2149 | + CURL_RTSPREQ_PAUSE, | |
2150 | + CURL_RTSPREQ_TEARDOWN, | |
2151 | + CURL_RTSPREQ_GET_PARAMETER, | |
2152 | + CURL_RTSPREQ_SET_PARAMETER, | |
2153 | + CURL_RTSPREQ_RECORD, | |
2154 | + CURL_RTSPREQ_RECEIVE, | |
2155 | + CURL_RTSPREQ_LAST /* last in list */ | |
2156 | +}; | |
2157 | + | |
2158 | + /* These enums are for use with the CURLOPT_NETRC option. */ | |
2159 | +enum CURL_NETRC_OPTION { | |
2160 | + CURL_NETRC_IGNORED, /* The .netrc will never be read. | |
2161 | + * This is the default. */ | |
2162 | + CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred | |
2163 | + * to one in the .netrc. */ | |
2164 | + CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. | |
2165 | + * Unless one is set programmatically, the .netrc | |
2166 | + * will be queried. */ | |
2167 | + CURL_NETRC_LAST | |
2168 | +}; | |
2169 | + | |
2170 | +enum { | |
2171 | + CURL_SSLVERSION_DEFAULT, | |
2172 | + CURL_SSLVERSION_TLSv1, /* TLS 1.x */ | |
2173 | + CURL_SSLVERSION_SSLv2, | |
2174 | + CURL_SSLVERSION_SSLv3, | |
2175 | + CURL_SSLVERSION_TLSv1_0, | |
2176 | + CURL_SSLVERSION_TLSv1_1, | |
2177 | + CURL_SSLVERSION_TLSv1_2, | |
2178 | + CURL_SSLVERSION_TLSv1_3, | |
2179 | + | |
2180 | + CURL_SSLVERSION_LAST /* never use, keep last */ | |
2181 | +}; | |
2182 | + | |
2183 | +enum { | |
2184 | + CURL_SSLVERSION_MAX_NONE = 0, | |
2185 | + CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16), | |
2186 | + CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16), | |
2187 | + CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16), | |
2188 | + CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16), | |
2189 | + CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16), | |
2190 | + | |
2191 | + /* never use, keep last */ | |
2192 | + CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16) | |
2193 | +}; | |
2194 | + | |
2195 | +enum CURL_TLSAUTH { | |
2196 | + CURL_TLSAUTH_NONE, | |
2197 | + CURL_TLSAUTH_SRP, | |
2198 | + CURL_TLSAUTH_LAST /* never use, keep last */ | |
2199 | +}; | |
2200 | + | |
2201 | +/* symbols to use with CURLOPT_POSTREDIR. | |
2202 | + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 | |
2203 | + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 | |
2204 | + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ | |
2205 | + | |
2206 | +#define CURL_REDIR_GET_ALL 0 | |
2207 | +#define CURL_REDIR_POST_301 1 | |
2208 | +#define CURL_REDIR_POST_302 2 | |
2209 | +#define CURL_REDIR_POST_303 4 | |
2210 | +#define CURL_REDIR_POST_ALL \ | |
2211 | + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) | |
2212 | + | |
2213 | +typedef enum { | |
2214 | + CURL_TIMECOND_NONE, | |
2215 | + | |
2216 | + CURL_TIMECOND_IFMODSINCE, | |
2217 | + CURL_TIMECOND_IFUNMODSINCE, | |
2218 | + CURL_TIMECOND_LASTMOD, | |
2219 | + | |
2220 | + CURL_TIMECOND_LAST | |
2221 | +} curl_TimeCond; | |
2222 | + | |
2223 | +/* Special size_t value signaling a null-terminated string. */ | |
2224 | +#define CURL_ZERO_TERMINATED ((size_t) -1) | |
2225 | + | |
2226 | +/* curl_strequal() and curl_strnequal() are subject for removal in a future | |
2227 | + release */ | |
2228 | +CURL_EXTERN int curl_strequal(const char *s1, const char *s2); | |
2229 | +CURL_EXTERN int curl_strnequal(const char *s1, const char *s2, size_t n); | |
2230 | + | |
2231 | +/* Mime/form handling support. */ | |
2232 | +typedef struct curl_mime curl_mime; /* Mime context. */ | |
2233 | +typedef struct curl_mimepart curl_mimepart; /* Mime part context. */ | |
2234 | + | |
2235 | +/* | |
2236 | + * NAME curl_mime_init() | |
2237 | + * | |
2238 | + * DESCRIPTION | |
2239 | + * | |
2240 | + * Create a mime context and return its handle. The easy parameter is the | |
2241 | + * target handle. | |
2242 | + */ | |
2243 | +CURL_EXTERN curl_mime *curl_mime_init(CURL *easy); | |
2244 | + | |
2245 | +/* | |
2246 | + * NAME curl_mime_free() | |
2247 | + * | |
2248 | + * DESCRIPTION | |
2249 | + * | |
2250 | + * release a mime handle and its substructures. | |
2251 | + */ | |
2252 | +CURL_EXTERN void curl_mime_free(curl_mime *mime); | |
2253 | + | |
2254 | +/* | |
2255 | + * NAME curl_mime_addpart() | |
2256 | + * | |
2257 | + * DESCRIPTION | |
2258 | + * | |
2259 | + * Append a new empty part to the given mime context and return a handle to | |
2260 | + * the created part. | |
2261 | + */ | |
2262 | +CURL_EXTERN curl_mimepart *curl_mime_addpart(curl_mime *mime); | |
2263 | + | |
2264 | +/* | |
2265 | + * NAME curl_mime_name() | |
2266 | + * | |
2267 | + * DESCRIPTION | |
2268 | + * | |
2269 | + * Set mime/form part name. | |
2270 | + */ | |
2271 | +CURL_EXTERN CURLcode curl_mime_name(curl_mimepart *part, const char *name); | |
2272 | + | |
2273 | +/* | |
2274 | + * NAME curl_mime_filename() | |
2275 | + * | |
2276 | + * DESCRIPTION | |
2277 | + * | |
2278 | + * Set mime part remote file name. | |
2279 | + */ | |
2280 | +CURL_EXTERN CURLcode curl_mime_filename(curl_mimepart *part, | |
2281 | + const char *filename); | |
2282 | + | |
2283 | +/* | |
2284 | + * NAME curl_mime_type() | |
2285 | + * | |
2286 | + * DESCRIPTION | |
2287 | + * | |
2288 | + * Set mime part type. | |
2289 | + */ | |
2290 | +CURL_EXTERN CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype); | |
2291 | + | |
2292 | +/* | |
2293 | + * NAME curl_mime_encoder() | |
2294 | + * | |
2295 | + * DESCRIPTION | |
2296 | + * | |
2297 | + * Set mime data transfer encoder. | |
2298 | + */ | |
2299 | +CURL_EXTERN CURLcode curl_mime_encoder(curl_mimepart *part, | |
2300 | + const char *encoding); | |
2301 | + | |
2302 | +/* | |
2303 | + * NAME curl_mime_data() | |
2304 | + * | |
2305 | + * DESCRIPTION | |
2306 | + * | |
2307 | + * Set mime part data source from memory data, | |
2308 | + */ | |
2309 | +CURL_EXTERN CURLcode curl_mime_data(curl_mimepart *part, | |
2310 | + const char *data, size_t datasize); | |
2311 | + | |
2312 | +/* | |
2313 | + * NAME curl_mime_filedata() | |
2314 | + * | |
2315 | + * DESCRIPTION | |
2316 | + * | |
2317 | + * Set mime part data source from named file. | |
2318 | + */ | |
2319 | +CURL_EXTERN CURLcode curl_mime_filedata(curl_mimepart *part, | |
2320 | + const char *filename); | |
2321 | + | |
2322 | +/* | |
2323 | + * NAME curl_mime_data_cb() | |
2324 | + * | |
2325 | + * DESCRIPTION | |
2326 | + * | |
2327 | + * Set mime part data source from callback function. | |
2328 | + */ | |
2329 | +CURL_EXTERN CURLcode curl_mime_data_cb(curl_mimepart *part, | |
2330 | + curl_off_t datasize, | |
2331 | + curl_read_callback readfunc, | |
2332 | + curl_seek_callback seekfunc, | |
2333 | + curl_free_callback freefunc, | |
2334 | + void *arg); | |
2335 | + | |
2336 | +/* | |
2337 | + * NAME curl_mime_subparts() | |
2338 | + * | |
2339 | + * DESCRIPTION | |
2340 | + * | |
2341 | + * Set mime part data source from subparts. | |
2342 | + */ | |
2343 | +CURL_EXTERN CURLcode curl_mime_subparts(curl_mimepart *part, | |
2344 | + curl_mime *subparts); | |
2345 | +/* | |
2346 | + * NAME curl_mime_headers() | |
2347 | + * | |
2348 | + * DESCRIPTION | |
2349 | + * | |
2350 | + * Set mime part headers. | |
2351 | + */ | |
2352 | +CURL_EXTERN CURLcode curl_mime_headers(curl_mimepart *part, | |
2353 | + struct curl_slist *headers, | |
2354 | + int take_ownership); | |
2355 | + | |
2356 | +typedef enum { | |
2357 | + CURLFORM_NOTHING, /********* the first one is unused ************/ | |
2358 | + CURLFORM_COPYNAME, | |
2359 | + CURLFORM_PTRNAME, | |
2360 | + CURLFORM_NAMELENGTH, | |
2361 | + CURLFORM_COPYCONTENTS, | |
2362 | + CURLFORM_PTRCONTENTS, | |
2363 | + CURLFORM_CONTENTSLENGTH, | |
2364 | + CURLFORM_FILECONTENT, | |
2365 | + CURLFORM_ARRAY, | |
2366 | + CURLFORM_OBSOLETE, | |
2367 | + CURLFORM_FILE, | |
2368 | + | |
2369 | + CURLFORM_BUFFER, | |
2370 | + CURLFORM_BUFFERPTR, | |
2371 | + CURLFORM_BUFFERLENGTH, | |
2372 | + | |
2373 | + CURLFORM_CONTENTTYPE, | |
2374 | + CURLFORM_CONTENTHEADER, | |
2375 | + CURLFORM_FILENAME, | |
2376 | + CURLFORM_END, | |
2377 | + CURLFORM_OBSOLETE2, | |
2378 | + | |
2379 | + CURLFORM_STREAM, | |
2380 | + CURLFORM_CONTENTLEN, /* added in 7.46.0, provide a curl_off_t length */ | |
2381 | + | |
2382 | + CURLFORM_LASTENTRY /* the last unused */ | |
2383 | +} CURLformoption; | |
2384 | + | |
2385 | +/* structure to be used as parameter for CURLFORM_ARRAY */ | |
2386 | +struct curl_forms { | |
2387 | + CURLformoption option; | |
2388 | + const char *value; | |
2389 | +}; | |
2390 | + | |
2391 | +/* use this for multipart formpost building */ | |
2392 | +/* Returns code for curl_formadd() | |
2393 | + * | |
2394 | + * Returns: | |
2395 | + * CURL_FORMADD_OK on success | |
2396 | + * CURL_FORMADD_MEMORY if the FormInfo allocation fails | |
2397 | + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form | |
2398 | + * CURL_FORMADD_NULL if a null pointer was given for a char | |
2399 | + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed | |
2400 | + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used | |
2401 | + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) | |
2402 | + * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated | |
2403 | + * CURL_FORMADD_MEMORY if some allocation for string copying failed. | |
2404 | + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array | |
2405 | + * | |
2406 | + ***************************************************************************/ | |
2407 | +typedef enum { | |
2408 | + CURL_FORMADD_OK, /* first, no error */ | |
2409 | + | |
2410 | + CURL_FORMADD_MEMORY, | |
2411 | + CURL_FORMADD_OPTION_TWICE, | |
2412 | + CURL_FORMADD_NULL, | |
2413 | + CURL_FORMADD_UNKNOWN_OPTION, | |
2414 | + CURL_FORMADD_INCOMPLETE, | |
2415 | + CURL_FORMADD_ILLEGAL_ARRAY, | |
2416 | + CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ | |
2417 | + | |
2418 | + CURL_FORMADD_LAST /* last */ | |
2419 | +} CURLFORMcode; | |
2420 | + | |
2421 | +/* | |
2422 | + * NAME curl_formadd() | |
2423 | + * | |
2424 | + * DESCRIPTION | |
2425 | + * | |
2426 | + * Pretty advanced function for building multi-part formposts. Each invoke | |
2427 | + * adds one part that together construct a full post. Then use | |
2428 | + * CURLOPT_HTTPPOST to send it off to libcurl. | |
2429 | + */ | |
2430 | +CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, | |
2431 | + struct curl_httppost **last_post, | |
2432 | + ...); | |
2433 | + | |
2434 | +/* | |
2435 | + * callback function for curl_formget() | |
2436 | + * The void *arg pointer will be the one passed as second argument to | |
2437 | + * curl_formget(). | |
2438 | + * The character buffer passed to it must not be freed. | |
2439 | + * Should return the buffer length passed to it as the argument "len" on | |
2440 | + * success. | |
2441 | + */ | |
2442 | +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, | |
2443 | + size_t len); | |
2444 | + | |
2445 | +/* | |
2446 | + * NAME curl_formget() | |
2447 | + * | |
2448 | + * DESCRIPTION | |
2449 | + * | |
2450 | + * Serialize a curl_httppost struct built with curl_formadd(). | |
2451 | + * Accepts a void pointer as second argument which will be passed to | |
2452 | + * the curl_formget_callback function. | |
2453 | + * Returns 0 on success. | |
2454 | + */ | |
2455 | +CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, | |
2456 | + curl_formget_callback append); | |
2457 | +/* | |
2458 | + * NAME curl_formfree() | |
2459 | + * | |
2460 | + * DESCRIPTION | |
2461 | + * | |
2462 | + * Free a multipart formpost previously built with curl_formadd(). | |
2463 | + */ | |
2464 | +CURL_EXTERN void curl_formfree(struct curl_httppost *form); | |
2465 | + | |
2466 | +/* | |
2467 | + * NAME curl_getenv() | |
2468 | + * | |
2469 | + * DESCRIPTION | |
2470 | + * | |
2471 | + * Returns a malloc()'ed string that MUST be curl_free()ed after usage is | |
2472 | + * complete. DEPRECATED - see lib/README.curlx | |
2473 | + */ | |
2474 | +CURL_EXTERN char *curl_getenv(const char *variable); | |
2475 | + | |
2476 | +/* | |
2477 | + * NAME curl_version() | |
2478 | + * | |
2479 | + * DESCRIPTION | |
2480 | + * | |
2481 | + * Returns a static ascii string of the libcurl version. | |
2482 | + */ | |
2483 | +CURL_EXTERN char *curl_version(void); | |
2484 | + | |
2485 | +/* | |
2486 | + * NAME curl_easy_escape() | |
2487 | + * | |
2488 | + * DESCRIPTION | |
2489 | + * | |
2490 | + * Escapes URL strings (converts all letters consider illegal in URLs to their | |
2491 | + * %XX versions). This function returns a new allocated string or NULL if an | |
2492 | + * error occurred. | |
2493 | + */ | |
2494 | +CURL_EXTERN char *curl_easy_escape(CURL *handle, | |
2495 | + const char *string, | |
2496 | + int length); | |
2497 | + | |
2498 | +/* the previous version: */ | |
2499 | +CURL_EXTERN char *curl_escape(const char *string, | |
2500 | + int length); | |
2501 | + | |
2502 | + | |
2503 | +/* | |
2504 | + * NAME curl_easy_unescape() | |
2505 | + * | |
2506 | + * DESCRIPTION | |
2507 | + * | |
2508 | + * Unescapes URL encoding in strings (converts all %XX codes to their 8bit | |
2509 | + * versions). This function returns a new allocated string or NULL if an error | |
2510 | + * occurred. | |
2511 | + * Conversion Note: On non-ASCII platforms the ASCII %XX codes are | |
2512 | + * converted into the host encoding. | |
2513 | + */ | |
2514 | +CURL_EXTERN char *curl_easy_unescape(CURL *handle, | |
2515 | + const char *string, | |
2516 | + int length, | |
2517 | + int *outlength); | |
2518 | + | |
2519 | +/* the previous version */ | |
2520 | +CURL_EXTERN char *curl_unescape(const char *string, | |
2521 | + int length); | |
2522 | + | |
2523 | +/* | |
2524 | + * NAME curl_free() | |
2525 | + * | |
2526 | + * DESCRIPTION | |
2527 | + * | |
2528 | + * Provided for de-allocation in the same translation unit that did the | |
2529 | + * allocation. Added in libcurl 7.10 | |
2530 | + */ | |
2531 | +CURL_EXTERN void curl_free(void *p); | |
2532 | + | |
2533 | +/* | |
2534 | + * NAME curl_global_init() | |
2535 | + * | |
2536 | + * DESCRIPTION | |
2537 | + * | |
2538 | + * curl_global_init() should be invoked exactly once for each application that | |
2539 | + * uses libcurl and before any call of other libcurl functions. | |
2540 | + * | |
2541 | + * This function is not thread-safe! | |
2542 | + */ | |
2543 | +CURL_EXTERN CURLcode curl_global_init(long flags); | |
2544 | + | |
2545 | +/* | |
2546 | + * NAME curl_global_init_mem() | |
2547 | + * | |
2548 | + * DESCRIPTION | |
2549 | + * | |
2550 | + * curl_global_init() or curl_global_init_mem() should be invoked exactly once | |
2551 | + * for each application that uses libcurl. This function can be used to | |
2552 | + * initialize libcurl and set user defined memory management callback | |
2553 | + * functions. Users can implement memory management routines to check for | |
2554 | + * memory leaks, check for mis-use of the curl library etc. User registered | |
2555 | + * callback routines will be invoked by this library instead of the system | |
2556 | + * memory management routines like malloc, free etc. | |
2557 | + */ | |
2558 | +CURL_EXTERN CURLcode curl_global_init_mem(long flags, | |
2559 | + curl_malloc_callback m, | |
2560 | + curl_free_callback f, | |
2561 | + curl_realloc_callback r, | |
2562 | + curl_strdup_callback s, | |
2563 | + curl_calloc_callback c); | |
2564 | + | |
2565 | +/* | |
2566 | + * NAME curl_global_cleanup() | |
2567 | + * | |
2568 | + * DESCRIPTION | |
2569 | + * | |
2570 | + * curl_global_cleanup() should be invoked exactly once for each application | |
2571 | + * that uses libcurl | |
2572 | + */ | |
2573 | +CURL_EXTERN void curl_global_cleanup(void); | |
2574 | + | |
2575 | +/* linked-list structure for the CURLOPT_QUOTE option (and other) */ | |
2576 | +struct curl_slist { | |
2577 | + char *data; | |
2578 | + struct curl_slist *next; | |
2579 | +}; | |
2580 | + | |
2581 | +/* | |
2582 | + * NAME curl_global_sslset() | |
2583 | + * | |
2584 | + * DESCRIPTION | |
2585 | + * | |
2586 | + * When built with multiple SSL backends, curl_global_sslset() allows to | |
2587 | + * choose one. This function can only be called once, and it must be called | |
2588 | + * *before* curl_global_init(). | |
2589 | + * | |
2590 | + * The backend can be identified by the id (e.g. CURLSSLBACKEND_OPENSSL). The | |
2591 | + * backend can also be specified via the name parameter (passing -1 as id). | |
2592 | + * If both id and name are specified, the name will be ignored. If neither id | |
2593 | + * nor name are specified, the function will fail with | |
2594 | + * CURLSSLSET_UNKNOWN_BACKEND and set the "avail" pointer to the | |
2595 | + * NULL-terminated list of available backends. | |
2596 | + * | |
2597 | + * Upon success, the function returns CURLSSLSET_OK. | |
2598 | + * | |
2599 | + * If the specified SSL backend is not available, the function returns | |
2600 | + * CURLSSLSET_UNKNOWN_BACKEND and sets the "avail" pointer to a NULL-terminated | |
2601 | + * list of available SSL backends. | |
2602 | + * | |
2603 | + * The SSL backend can be set only once. If it has already been set, a | |
2604 | + * subsequent attempt to change it will result in a CURLSSLSET_TOO_LATE. | |
2605 | + */ | |
2606 | + | |
2607 | +struct curl_ssl_backend { | |
2608 | + curl_sslbackend id; | |
2609 | + const char *name; | |
2610 | +}; | |
2611 | +typedef struct curl_ssl_backend curl_ssl_backend; | |
2612 | + | |
2613 | +typedef enum { | |
2614 | + CURLSSLSET_OK = 0, | |
2615 | + CURLSSLSET_UNKNOWN_BACKEND, | |
2616 | + CURLSSLSET_TOO_LATE, | |
2617 | + CURLSSLSET_NO_BACKENDS /* libcurl was built without any SSL support */ | |
2618 | +} CURLsslset; | |
2619 | + | |
2620 | +CURL_EXTERN CURLsslset curl_global_sslset(curl_sslbackend id, const char *name, | |
2621 | + const curl_ssl_backend ***avail); | |
2622 | + | |
2623 | +/* | |
2624 | + * NAME curl_slist_append() | |
2625 | + * | |
2626 | + * DESCRIPTION | |
2627 | + * | |
2628 | + * Appends a string to a linked list. If no list exists, it will be created | |
2629 | + * first. Returns the new list, after appending. | |
2630 | + */ | |
2631 | +CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, | |
2632 | + const char *); | |
2633 | + | |
2634 | +/* | |
2635 | + * NAME curl_slist_free_all() | |
2636 | + * | |
2637 | + * DESCRIPTION | |
2638 | + * | |
2639 | + * free a previously built curl_slist. | |
2640 | + */ | |
2641 | +CURL_EXTERN void curl_slist_free_all(struct curl_slist *); | |
2642 | + | |
2643 | +/* | |
2644 | + * NAME curl_getdate() | |
2645 | + * | |
2646 | + * DESCRIPTION | |
2647 | + * | |
2648 | + * Returns the time, in seconds since 1 Jan 1970 of the time string given in | |
2649 | + * the first argument. The time argument in the second parameter is unused | |
2650 | + * and should be set to NULL. | |
2651 | + */ | |
2652 | +CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); | |
2653 | + | |
2654 | +/* info about the certificate chain, only for OpenSSL, GnuTLS, Schannel, NSS | |
2655 | + and GSKit builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ | |
2656 | +struct curl_certinfo { | |
2657 | + int num_of_certs; /* number of certificates with information */ | |
2658 | + struct curl_slist **certinfo; /* for each index in this array, there's a | |
2659 | + linked list with textual information in the | |
2660 | + format "name: value" */ | |
2661 | +}; | |
2662 | + | |
2663 | +/* Information about the SSL library used and the respective internal SSL | |
2664 | + handle, which can be used to obtain further information regarding the | |
2665 | + connection. Asked for with CURLINFO_TLS_SSL_PTR or CURLINFO_TLS_SESSION. */ | |
2666 | +struct curl_tlssessioninfo { | |
2667 | + curl_sslbackend backend; | |
2668 | + void *internals; | |
2669 | +}; | |
2670 | + | |
2671 | +#define CURLINFO_STRING 0x100000 | |
2672 | +#define CURLINFO_LONG 0x200000 | |
2673 | +#define CURLINFO_DOUBLE 0x300000 | |
2674 | +#define CURLINFO_SLIST 0x400000 | |
2675 | +#define CURLINFO_PTR 0x400000 /* same as SLIST */ | |
2676 | +#define CURLINFO_SOCKET 0x500000 | |
2677 | +#define CURLINFO_OFF_T 0x600000 | |
2678 | +#define CURLINFO_MASK 0x0fffff | |
2679 | +#define CURLINFO_TYPEMASK 0xf00000 | |
2680 | + | |
2681 | +typedef enum { | |
2682 | + CURLINFO_NONE, /* first, never use this */ | |
2683 | + CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, | |
2684 | + CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, | |
2685 | + CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, | |
2686 | + CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, | |
2687 | + CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, | |
2688 | + CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, | |
2689 | + CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, | |
2690 | + CURLINFO_SIZE_UPLOAD_T = CURLINFO_OFF_T + 7, | |
2691 | + CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, | |
2692 | + CURLINFO_SIZE_DOWNLOAD_T = CURLINFO_OFF_T + 8, | |
2693 | + CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, | |
2694 | + CURLINFO_SPEED_DOWNLOAD_T = CURLINFO_OFF_T + 9, | |
2695 | + CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, | |
2696 | + CURLINFO_SPEED_UPLOAD_T = CURLINFO_OFF_T + 10, | |
2697 | + CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, | |
2698 | + CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, | |
2699 | + CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, | |
2700 | + CURLINFO_FILETIME = CURLINFO_LONG + 14, | |
2701 | + CURLINFO_FILETIME_T = CURLINFO_OFF_T + 14, | |
2702 | + CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, | |
2703 | + CURLINFO_CONTENT_LENGTH_DOWNLOAD_T = CURLINFO_OFF_T + 15, | |
2704 | + CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, | |
2705 | + CURLINFO_CONTENT_LENGTH_UPLOAD_T = CURLINFO_OFF_T + 16, | |
2706 | + CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, | |
2707 | + CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, | |
2708 | + CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, | |
2709 | + CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, | |
2710 | + CURLINFO_PRIVATE = CURLINFO_STRING + 21, | |
2711 | + CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, | |
2712 | + CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, | |
2713 | + CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, | |
2714 | + CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, | |
2715 | + CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, | |
2716 | + CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, | |
2717 | + CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, | |
2718 | + CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, | |
2719 | + CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, | |
2720 | + CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, | |
2721 | + CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, | |
2722 | + CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, | |
2723 | + CURLINFO_CERTINFO = CURLINFO_PTR + 34, | |
2724 | + CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, | |
2725 | + CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, | |
2726 | + CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, | |
2727 | + CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, | |
2728 | + CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, | |
2729 | + CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, | |
2730 | + CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, | |
2731 | + CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, | |
2732 | + CURLINFO_TLS_SESSION = CURLINFO_PTR + 43, | |
2733 | + CURLINFO_ACTIVESOCKET = CURLINFO_SOCKET + 44, | |
2734 | + CURLINFO_TLS_SSL_PTR = CURLINFO_PTR + 45, | |
2735 | + CURLINFO_HTTP_VERSION = CURLINFO_LONG + 46, | |
2736 | + CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47, | |
2737 | + CURLINFO_PROTOCOL = CURLINFO_LONG + 48, | |
2738 | + CURLINFO_SCHEME = CURLINFO_STRING + 49, | |
2739 | + CURLINFO_TOTAL_TIME_T = CURLINFO_OFF_T + 50, | |
2740 | + CURLINFO_NAMELOOKUP_TIME_T = CURLINFO_OFF_T + 51, | |
2741 | + CURLINFO_CONNECT_TIME_T = CURLINFO_OFF_T + 52, | |
2742 | + CURLINFO_PRETRANSFER_TIME_T = CURLINFO_OFF_T + 53, | |
2743 | + CURLINFO_STARTTRANSFER_TIME_T = CURLINFO_OFF_T + 54, | |
2744 | + CURLINFO_REDIRECT_TIME_T = CURLINFO_OFF_T + 55, | |
2745 | + CURLINFO_APPCONNECT_TIME_T = CURLINFO_OFF_T + 56, | |
2746 | + CURLINFO_RETRY_AFTER = CURLINFO_OFF_T + 57, | |
2747 | + CURLINFO_EFFECTIVE_METHOD = CURLINFO_STRING + 58, | |
2748 | + CURLINFO_PROXY_ERROR = CURLINFO_LONG + 59, | |
2749 | + | |
2750 | + CURLINFO_LASTONE = 59 | |
2751 | +} CURLINFO; | |
2752 | + | |
2753 | +/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as | |
2754 | + CURLINFO_HTTP_CODE */ | |
2755 | +#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE | |
2756 | + | |
2757 | +typedef enum { | |
2758 | + CURLCLOSEPOLICY_NONE, /* first, never use this */ | |
2759 | + | |
2760 | + CURLCLOSEPOLICY_OLDEST, | |
2761 | + CURLCLOSEPOLICY_LEAST_RECENTLY_USED, | |
2762 | + CURLCLOSEPOLICY_LEAST_TRAFFIC, | |
2763 | + CURLCLOSEPOLICY_SLOWEST, | |
2764 | + CURLCLOSEPOLICY_CALLBACK, | |
2765 | + | |
2766 | + CURLCLOSEPOLICY_LAST /* last, never use this */ | |
2767 | +} curl_closepolicy; | |
2768 | + | |
2769 | +#define CURL_GLOBAL_SSL (1<<0) /* no purpose since since 7.57.0 */ | |
2770 | +#define CURL_GLOBAL_WIN32 (1<<1) | |
2771 | +#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) | |
2772 | +#define CURL_GLOBAL_NOTHING 0 | |
2773 | +#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL | |
2774 | +#define CURL_GLOBAL_ACK_EINTR (1<<2) | |
2775 | + | |
2776 | + | |
2777 | +/***************************************************************************** | |
2778 | + * Setup defines, protos etc for the sharing stuff. | |
2779 | + */ | |
2780 | + | |
2781 | +/* Different data locks for a single share */ | |
2782 | +typedef enum { | |
2783 | + CURL_LOCK_DATA_NONE = 0, | |
2784 | + /* CURL_LOCK_DATA_SHARE is used internally to say that | |
2785 | + * the locking is just made to change the internal state of the share | |
2786 | + * itself. | |
2787 | + */ | |
2788 | + CURL_LOCK_DATA_SHARE, | |
2789 | + CURL_LOCK_DATA_COOKIE, | |
2790 | + CURL_LOCK_DATA_DNS, | |
2791 | + CURL_LOCK_DATA_SSL_SESSION, | |
2792 | + CURL_LOCK_DATA_CONNECT, | |
2793 | + CURL_LOCK_DATA_PSL, | |
2794 | + CURL_LOCK_DATA_LAST | |
2795 | +} curl_lock_data; | |
2796 | + | |
2797 | +/* Different lock access types */ | |
2798 | +typedef enum { | |
2799 | + CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ | |
2800 | + CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ | |
2801 | + CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ | |
2802 | + CURL_LOCK_ACCESS_LAST /* never use */ | |
2803 | +} curl_lock_access; | |
2804 | + | |
2805 | +typedef void (*curl_lock_function)(CURL *handle, | |
2806 | + curl_lock_data data, | |
2807 | + curl_lock_access locktype, | |
2808 | + void *userptr); | |
2809 | +typedef void (*curl_unlock_function)(CURL *handle, | |
2810 | + curl_lock_data data, | |
2811 | + void *userptr); | |
2812 | + | |
2813 | + | |
2814 | +typedef enum { | |
2815 | + CURLSHE_OK, /* all is fine */ | |
2816 | + CURLSHE_BAD_OPTION, /* 1 */ | |
2817 | + CURLSHE_IN_USE, /* 2 */ | |
2818 | + CURLSHE_INVALID, /* 3 */ | |
2819 | + CURLSHE_NOMEM, /* 4 out of memory */ | |
2820 | + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ | |
2821 | + CURLSHE_LAST /* never use */ | |
2822 | +} CURLSHcode; | |
2823 | + | |
2824 | +typedef enum { | |
2825 | + CURLSHOPT_NONE, /* don't use */ | |
2826 | + CURLSHOPT_SHARE, /* specify a data type to share */ | |
2827 | + CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ | |
2828 | + CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ | |
2829 | + CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ | |
2830 | + CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock | |
2831 | + callback functions */ | |
2832 | + CURLSHOPT_LAST /* never use */ | |
2833 | +} CURLSHoption; | |
2834 | + | |
2835 | +CURL_EXTERN CURLSH *curl_share_init(void); | |
2836 | +CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); | |
2837 | +CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); | |
2838 | + | |
2839 | +/**************************************************************************** | |
2840 | + * Structures for querying information about the curl library at runtime. | |
2841 | + */ | |
2842 | + | |
2843 | +typedef enum { | |
2844 | + CURLVERSION_FIRST, | |
2845 | + CURLVERSION_SECOND, | |
2846 | + CURLVERSION_THIRD, | |
2847 | + CURLVERSION_FOURTH, | |
2848 | + CURLVERSION_FIFTH, | |
2849 | + CURLVERSION_SIXTH, | |
2850 | + CURLVERSION_SEVENTH, | |
2851 | + CURLVERSION_EIGHTH, | |
2852 | + CURLVERSION_LAST /* never actually use this */ | |
2853 | +} CURLversion; | |
2854 | + | |
2855 | +/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by | |
2856 | + basically all programs ever that want to get version information. It is | |
2857 | + meant to be a built-in version number for what kind of struct the caller | |
2858 | + expects. If the struct ever changes, we redefine the NOW to another enum | |
2859 | + from above. */ | |
2860 | +#define CURLVERSION_NOW CURLVERSION_EIGHTH | |
2861 | + | |
2862 | +struct curl_version_info_data { | |
2863 | + CURLversion age; /* age of the returned struct */ | |
2864 | + const char *version; /* LIBCURL_VERSION */ | |
2865 | + unsigned int version_num; /* LIBCURL_VERSION_NUM */ | |
2866 | + const char *host; /* OS/host/cpu/machine when configured */ | |
2867 | + int features; /* bitmask, see defines below */ | |
2868 | + const char *ssl_version; /* human readable string */ | |
2869 | + long ssl_version_num; /* not used anymore, always 0 */ | |
2870 | + const char *libz_version; /* human readable string */ | |
2871 | + /* protocols is terminated by an entry with a NULL protoname */ | |
2872 | + const char * const *protocols; | |
2873 | + | |
2874 | + /* The fields below this were added in CURLVERSION_SECOND */ | |
2875 | + const char *ares; | |
2876 | + int ares_num; | |
2877 | + | |
2878 | + /* This field was added in CURLVERSION_THIRD */ | |
2879 | + const char *libidn; | |
2880 | + | |
2881 | + /* These field were added in CURLVERSION_FOURTH */ | |
2882 | + | |
2883 | + /* Same as '_libiconv_version' if built with HAVE_ICONV */ | |
2884 | + int iconv_ver_num; | |
2885 | + | |
2886 | + const char *libssh_version; /* human readable string */ | |
2887 | + | |
2888 | + /* These fields were added in CURLVERSION_FIFTH */ | |
2889 | + unsigned int brotli_ver_num; /* Numeric Brotli version | |
2890 | + (MAJOR << 24) | (MINOR << 12) | PATCH */ | |
2891 | + const char *brotli_version; /* human readable string. */ | |
2892 | + | |
2893 | + /* These fields were added in CURLVERSION_SIXTH */ | |
2894 | + unsigned int nghttp2_ver_num; /* Numeric nghttp2 version | |
2895 | + (MAJOR << 16) | (MINOR << 8) | PATCH */ | |
2896 | + const char *nghttp2_version; /* human readable string. */ | |
2897 | + const char *quic_version; /* human readable quic (+ HTTP/3) library + | |
2898 | + version or NULL */ | |
2899 | + | |
2900 | + /* These fields were added in CURLVERSION_SEVENTH */ | |
2901 | + const char *cainfo; /* the built-in default CURLOPT_CAINFO, might | |
2902 | + be NULL */ | |
2903 | + const char *capath; /* the built-in default CURLOPT_CAPATH, might | |
2904 | + be NULL */ | |
2905 | + | |
2906 | + /* These fields were added in CURLVERSION_EIGHTH */ | |
2907 | + unsigned int zstd_ver_num; /* Numeric Zstd version | |
2908 | + (MAJOR << 24) | (MINOR << 12) | PATCH */ | |
2909 | + const char *zstd_version; /* human readable string. */ | |
2910 | + | |
2911 | +}; | |
2912 | +typedef struct curl_version_info_data curl_version_info_data; | |
2913 | + | |
2914 | +#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ | |
2915 | +#define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported | |
2916 | + (deprecated) */ | |
2917 | +#define CURL_VERSION_SSL (1<<2) /* SSL options are present */ | |
2918 | +#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ | |
2919 | +#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ | |
2920 | +#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported | |
2921 | + (deprecated) */ | |
2922 | +#define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */ | |
2923 | +#define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */ | |
2924 | +#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */ | |
2925 | +#define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */ | |
2926 | +#define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are | |
2927 | + supported */ | |
2928 | +#define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */ | |
2929 | +#define CURL_VERSION_CONV (1<<12) /* Character conversions supported */ | |
2930 | +#define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */ | |
2931 | +#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ | |
2932 | +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper | |
2933 | + is supported */ | |
2934 | +#define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */ | |
2935 | +#define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */ | |
2936 | +#define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */ | |
2937 | +#define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */ | |
2938 | +#define CURL_VERSION_PSL (1<<20) /* Mozilla's Public Suffix List, used | |
2939 | + for cookie domain verification */ | |
2940 | +#define CURL_VERSION_HTTPS_PROXY (1<<21) /* HTTPS-proxy support built-in */ | |
2941 | +#define CURL_VERSION_MULTI_SSL (1<<22) /* Multiple SSL backends available */ | |
2942 | +#define CURL_VERSION_BROTLI (1<<23) /* Brotli features are present. */ | |
2943 | +#define CURL_VERSION_ALTSVC (1<<24) /* Alt-Svc handling built-in */ | |
2944 | +#define CURL_VERSION_HTTP3 (1<<25) /* HTTP3 support built-in */ | |
2945 | +#define CURL_VERSION_ZSTD (1<<26) /* zstd features are present */ | |
2946 | +#define CURL_VERSION_UNICODE (1<<27) /* Unicode support on Windows */ | |
2947 | +#define CURL_VERSION_HSTS (1<<28) /* HSTS is supported */ | |
2948 | + | |
2949 | + /* | |
2950 | + * NAME curl_version_info() | |
2951 | + * | |
2952 | + * DESCRIPTION | |
2953 | + * | |
2954 | + * This function returns a pointer to a static copy of the version info | |
2955 | + * struct. See above. | |
2956 | + */ | |
2957 | +CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); | |
2958 | + | |
2959 | +/* | |
2960 | + * NAME curl_easy_strerror() | |
2961 | + * | |
2962 | + * DESCRIPTION | |
2963 | + * | |
2964 | + * The curl_easy_strerror function may be used to turn a CURLcode value | |
2965 | + * into the equivalent human readable error string. This is useful | |
2966 | + * for printing meaningful error messages. | |
2967 | + */ | |
2968 | +CURL_EXTERN const char *curl_easy_strerror(CURLcode); | |
2969 | + | |
2970 | +/* | |
2971 | + * NAME curl_share_strerror() | |
2972 | + * | |
2973 | + * DESCRIPTION | |
2974 | + * | |
2975 | + * The curl_share_strerror function may be used to turn a CURLSHcode value | |
2976 | + * into the equivalent human readable error string. This is useful | |
2977 | + * for printing meaningful error messages. | |
2978 | + */ | |
2979 | +CURL_EXTERN const char *curl_share_strerror(CURLSHcode); | |
2980 | + | |
2981 | +/* | |
2982 | + * NAME curl_easy_pause() | |
2983 | + * | |
2984 | + * DESCRIPTION | |
2985 | + * | |
2986 | + * The curl_easy_pause function pauses or unpauses transfers. Select the new | |
2987 | + * state by setting the bitmask, use the convenience defines below. | |
2988 | + * | |
2989 | + */ | |
2990 | +CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); | |
2991 | + | |
2992 | +#define CURLPAUSE_RECV (1<<0) | |
2993 | +#define CURLPAUSE_RECV_CONT (0) | |
2994 | + | |
2995 | +#define CURLPAUSE_SEND (1<<2) | |
2996 | +#define CURLPAUSE_SEND_CONT (0) | |
2997 | + | |
2998 | +#define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) | |
2999 | +#define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) | |
3000 | + | |
3001 | +#ifdef __cplusplus | |
3002 | +} | |
3003 | +#endif | |
3004 | + | |
3005 | +/* unfortunately, the easy.h and multi.h include files need options and info | |
3006 | + stuff before they can be included! */ | |
3007 | +#include "easy.h" /* nothing in curl is fun without the easy stuff */ | |
3008 | +#include "multi.h" | |
3009 | +#include "urlapi.h" | |
3010 | +#include "options.h" | |
3011 | + | |
3012 | +/* the typechecker doesn't work in C++ (yet) */ | |
3013 | +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ | |
3014 | + ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ | |
3015 | + !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) | |
3016 | +#include "typecheck-gcc.h" | |
3017 | +#else | |
3018 | +#if defined(__STDC__) && (__STDC__ >= 1) | |
3019 | +/* This preprocessor magic that replaces a call with the exact same call is | |
3020 | + only done to make sure application authors pass exactly three arguments | |
3021 | + to these functions. */ | |
3022 | +#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) | |
3023 | +#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) | |
3024 | +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) | |
3025 | +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) | |
3026 | +#endif /* __STDC__ >= 1 */ | |
3027 | +#endif /* gcc >= 4.3 && !__cplusplus */ | |
3028 | + | |
3029 | +#endif /* CURLINC_CURL_H */ |
@@ -0,0 +1,77 @@ | ||
1 | +#ifndef CURLINC_CURLVER_H | |
2 | +#define CURLINC_CURLVER_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 - 2020 Daniel Stenberg, <daniel@haxx.se>." | |
30 | + | |
31 | +/* This is the version number of the libcurl package from which this header | |
32 | + file origins: */ | |
33 | +#define LIBCURL_VERSION "7.74.0" | |
34 | + | |
35 | +/* The numeric version number is also available "in parts" by using these | |
36 | + defines: */ | |
37 | +#define LIBCURL_VERSION_MAJOR 7 | |
38 | +#define LIBCURL_VERSION_MINOR 74 | |
39 | +#define LIBCURL_VERSION_PATCH 0 | |
40 | + | |
41 | +/* This is the numeric version of the libcurl version number, meant for easier | |
42 | + parsing and comparisons 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 0x074a00 | |
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 "2020-12-09" | |
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 /* CURLINC_CURLVER_H */ |
@@ -0,0 +1,123 @@ | ||
1 | +#ifndef CURLINC_EASY_H | |
2 | +#define CURLINC_EASY_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | +#ifdef __cplusplus | |
25 | +extern "C" { | |
26 | +#endif | |
27 | + | |
28 | +/* Flag bits in the curl_blob struct: */ | |
29 | +#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ | |
30 | +#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ | |
31 | + | |
32 | +struct curl_blob { | |
33 | + void *data; | |
34 | + size_t len; | |
35 | + unsigned int flags; /* bit 0 is defined, the rest are reserved and should be | |
36 | + left zeroes */ | |
37 | +}; | |
38 | + | |
39 | +CURL_EXTERN CURL *curl_easy_init(void); | |
40 | +CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); | |
41 | +CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); | |
42 | +CURL_EXTERN void curl_easy_cleanup(CURL *curl); | |
43 | + | |
44 | +/* | |
45 | + * NAME curl_easy_getinfo() | |
46 | + * | |
47 | + * DESCRIPTION | |
48 | + * | |
49 | + * Request internal information from the curl session with this function. The | |
50 | + * third argument MUST be a pointer to a long, a pointer to a char * or a | |
51 | + * pointer to a double (as the documentation describes elsewhere). The data | |
52 | + * pointed to will be filled in accordingly and can be relied upon only if the | |
53 | + * function returns CURLE_OK. This function is intended to get used *AFTER* a | |
54 | + * performed transfer, all results from this function are undefined until the | |
55 | + * transfer is completed. | |
56 | + */ | |
57 | +CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); | |
58 | + | |
59 | + | |
60 | +/* | |
61 | + * NAME curl_easy_duphandle() | |
62 | + * | |
63 | + * DESCRIPTION | |
64 | + * | |
65 | + * Creates a new curl session handle with the same options set for the handle | |
66 | + * passed in. Duplicating a handle could only be a matter of cloning data and | |
67 | + * options, internal state info and things like persistent connections cannot | |
68 | + * be transferred. It is useful in multithreaded applications when you can run | |
69 | + * curl_easy_duphandle() for each new thread to avoid a series of identical | |
70 | + * curl_easy_setopt() invokes in every thread. | |
71 | + */ | |
72 | +CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); | |
73 | + | |
74 | +/* | |
75 | + * NAME curl_easy_reset() | |
76 | + * | |
77 | + * DESCRIPTION | |
78 | + * | |
79 | + * Re-initializes a CURL handle to the default values. This puts back the | |
80 | + * handle to the same state as it was in when it was just created. | |
81 | + * | |
82 | + * It does keep: live connections, the Session ID cache, the DNS cache and the | |
83 | + * cookies. | |
84 | + */ | |
85 | +CURL_EXTERN void curl_easy_reset(CURL *curl); | |
86 | + | |
87 | +/* | |
88 | + * NAME curl_easy_recv() | |
89 | + * | |
90 | + * DESCRIPTION | |
91 | + * | |
92 | + * Receives data from the connected socket. Use after successful | |
93 | + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. | |
94 | + */ | |
95 | +CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, | |
96 | + size_t *n); | |
97 | + | |
98 | +/* | |
99 | + * NAME curl_easy_send() | |
100 | + * | |
101 | + * DESCRIPTION | |
102 | + * | |
103 | + * Sends data over the connected socket. Use after successful | |
104 | + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. | |
105 | + */ | |
106 | +CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, | |
107 | + size_t buflen, size_t *n); | |
108 | + | |
109 | + | |
110 | +/* | |
111 | + * NAME curl_easy_upkeep() | |
112 | + * | |
113 | + * DESCRIPTION | |
114 | + * | |
115 | + * Performs connection upkeep for the given session handle. | |
116 | + */ | |
117 | +CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); | |
118 | + | |
119 | +#ifdef __cplusplus | |
120 | +} | |
121 | +#endif | |
122 | + | |
123 | +#endif |
@@ -0,0 +1,50 @@ | ||
1 | +#ifndef CURLINC_MPRINTF_H | |
2 | +#define CURLINC_MPRINTF_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | + | |
25 | +#include <stdarg.h> | |
26 | +#include <stdio.h> /* needed for FILE */ | |
27 | +#include "curl.h" /* for CURL_EXTERN */ | |
28 | + | |
29 | +#ifdef __cplusplus | |
30 | +extern "C" { | |
31 | +#endif | |
32 | + | |
33 | +CURL_EXTERN int curl_mprintf(const char *format, ...); | |
34 | +CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); | |
35 | +CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); | |
36 | +CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, | |
37 | + const char *format, ...); | |
38 | +CURL_EXTERN int curl_mvprintf(const char *format, va_list args); | |
39 | +CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); | |
40 | +CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); | |
41 | +CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, | |
42 | + const char *format, va_list args); | |
43 | +CURL_EXTERN char *curl_maprintf(const char *format, ...); | |
44 | +CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); | |
45 | + | |
46 | +#ifdef __cplusplus | |
47 | +} | |
48 | +#endif | |
49 | + | |
50 | +#endif /* CURLINC_MPRINTF_H */ |
@@ -0,0 +1,456 @@ | ||
1 | +#ifndef CURLINC_MULTI_H | |
2 | +#define CURLINC_MULTI_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | +/* | |
25 | + This is an "external" header file. Don't give away any internals here! | |
26 | + | |
27 | + GOALS | |
28 | + | |
29 | + o Enable a "pull" interface. The application that uses libcurl decides where | |
30 | + and when to ask libcurl to get/send data. | |
31 | + | |
32 | + o Enable multiple simultaneous transfers in the same thread without making it | |
33 | + complicated for the application. | |
34 | + | |
35 | + o Enable the application to select() on its own file descriptors and curl's | |
36 | + file descriptors simultaneous easily. | |
37 | + | |
38 | +*/ | |
39 | + | |
40 | +/* | |
41 | + * This header file should not really need to include "curl.h" since curl.h | |
42 | + * itself includes this file and we expect user applications to do #include | |
43 | + * <curl/curl.h> without the need for especially including multi.h. | |
44 | + * | |
45 | + * For some reason we added this include here at one point, and rather than to | |
46 | + * break existing (wrongly written) libcurl applications, we leave it as-is | |
47 | + * but with this warning attached. | |
48 | + */ | |
49 | +#include "curl.h" | |
50 | + | |
51 | +#ifdef __cplusplus | |
52 | +extern "C" { | |
53 | +#endif | |
54 | + | |
55 | +#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) | |
56 | +typedef struct Curl_multi CURLM; | |
57 | +#else | |
58 | +typedef void CURLM; | |
59 | +#endif | |
60 | + | |
61 | +typedef enum { | |
62 | + CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or | |
63 | + curl_multi_socket*() soon */ | |
64 | + CURLM_OK, | |
65 | + CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ | |
66 | + CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ | |
67 | + CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ | |
68 | + CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ | |
69 | + CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ | |
70 | + CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ | |
71 | + CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was | |
72 | + attempted to get added - again */ | |
73 | + CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a | |
74 | + callback */ | |
75 | + CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */ | |
76 | + CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */ | |
77 | + CURLM_LAST | |
78 | +} CURLMcode; | |
79 | + | |
80 | +/* just to make code nicer when using curl_multi_socket() you can now check | |
81 | + for CURLM_CALL_MULTI_SOCKET too in the same style it works for | |
82 | + curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ | |
83 | +#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM | |
84 | + | |
85 | +/* bitmask bits for CURLMOPT_PIPELINING */ | |
86 | +#define CURLPIPE_NOTHING 0L | |
87 | +#define CURLPIPE_HTTP1 1L | |
88 | +#define CURLPIPE_MULTIPLEX 2L | |
89 | + | |
90 | +typedef enum { | |
91 | + CURLMSG_NONE, /* first, not used */ | |
92 | + CURLMSG_DONE, /* This easy handle has completed. 'result' contains | |
93 | + the CURLcode of the transfer */ | |
94 | + CURLMSG_LAST /* last, not used */ | |
95 | +} CURLMSG; | |
96 | + | |
97 | +struct CURLMsg { | |
98 | + CURLMSG msg; /* what this message means */ | |
99 | + CURL *easy_handle; /* the handle it concerns */ | |
100 | + union { | |
101 | + void *whatever; /* message-specific data */ | |
102 | + CURLcode result; /* return code for transfer */ | |
103 | + } data; | |
104 | +}; | |
105 | +typedef struct CURLMsg CURLMsg; | |
106 | + | |
107 | +/* Based on poll(2) structure and values. | |
108 | + * We don't use pollfd and POLL* constants explicitly | |
109 | + * to cover platforms without poll(). */ | |
110 | +#define CURL_WAIT_POLLIN 0x0001 | |
111 | +#define CURL_WAIT_POLLPRI 0x0002 | |
112 | +#define CURL_WAIT_POLLOUT 0x0004 | |
113 | + | |
114 | +struct curl_waitfd { | |
115 | + curl_socket_t fd; | |
116 | + short events; | |
117 | + short revents; /* not supported yet */ | |
118 | +}; | |
119 | + | |
120 | +/* | |
121 | + * Name: curl_multi_init() | |
122 | + * | |
123 | + * Desc: inititalize multi-style curl usage | |
124 | + * | |
125 | + * Returns: a new CURLM handle to use in all 'curl_multi' functions. | |
126 | + */ | |
127 | +CURL_EXTERN CURLM *curl_multi_init(void); | |
128 | + | |
129 | +/* | |
130 | + * Name: curl_multi_add_handle() | |
131 | + * | |
132 | + * Desc: add a standard curl handle to the multi stack | |
133 | + * | |
134 | + * Returns: CURLMcode type, general multi error code. | |
135 | + */ | |
136 | +CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, | |
137 | + CURL *curl_handle); | |
138 | + | |
139 | + /* | |
140 | + * Name: curl_multi_remove_handle() | |
141 | + * | |
142 | + * Desc: removes a curl handle from the multi stack again | |
143 | + * | |
144 | + * Returns: CURLMcode type, general multi error code. | |
145 | + */ | |
146 | +CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, | |
147 | + CURL *curl_handle); | |
148 | + | |
149 | + /* | |
150 | + * Name: curl_multi_fdset() | |
151 | + * | |
152 | + * Desc: Ask curl for its fd_set sets. The app can use these to select() or | |
153 | + * poll() on. We want curl_multi_perform() called as soon as one of | |
154 | + * them are ready. | |
155 | + * | |
156 | + * Returns: CURLMcode type, general multi error code. | |
157 | + */ | |
158 | +CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, | |
159 | + fd_set *read_fd_set, | |
160 | + fd_set *write_fd_set, | |
161 | + fd_set *exc_fd_set, | |
162 | + int *max_fd); | |
163 | + | |
164 | +/* | |
165 | + * Name: curl_multi_wait() | |
166 | + * | |
167 | + * Desc: Poll on all fds within a CURLM set as well as any | |
168 | + * additional fds passed to the function. | |
169 | + * | |
170 | + * Returns: CURLMcode type, general multi error code. | |
171 | + */ | |
172 | +CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, | |
173 | + struct curl_waitfd extra_fds[], | |
174 | + unsigned int extra_nfds, | |
175 | + int timeout_ms, | |
176 | + int *ret); | |
177 | + | |
178 | +/* | |
179 | + * Name: curl_multi_poll() | |
180 | + * | |
181 | + * Desc: Poll on all fds within a CURLM set as well as any | |
182 | + * additional fds passed to the function. | |
183 | + * | |
184 | + * Returns: CURLMcode type, general multi error code. | |
185 | + */ | |
186 | +CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, | |
187 | + struct curl_waitfd extra_fds[], | |
188 | + unsigned int extra_nfds, | |
189 | + int timeout_ms, | |
190 | + int *ret); | |
191 | + | |
192 | +/* | |
193 | + * Name: curl_multi_wakeup() | |
194 | + * | |
195 | + * Desc: wakes up a sleeping curl_multi_poll call. | |
196 | + * | |
197 | + * Returns: CURLMcode type, general multi error code. | |
198 | + */ | |
199 | +CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); | |
200 | + | |
201 | + /* | |
202 | + * Name: curl_multi_perform() | |
203 | + * | |
204 | + * Desc: When the app thinks there's data available for curl it calls this | |
205 | + * function to read/write whatever there is right now. This returns | |
206 | + * as soon as the reads and writes are done. This function does not | |
207 | + * require that there actually is data available for reading or that | |
208 | + * data can be written, it can be called just in case. It returns | |
209 | + * the number of handles that still transfer data in the second | |
210 | + * argument's integer-pointer. | |
211 | + * | |
212 | + * Returns: CURLMcode type, general multi error code. *NOTE* that this only | |
213 | + * returns errors etc regarding the whole multi stack. There might | |
214 | + * still have occurred problems on individual transfers even when | |
215 | + * this returns OK. | |
216 | + */ | |
217 | +CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, | |
218 | + int *running_handles); | |
219 | + | |
220 | + /* | |
221 | + * Name: curl_multi_cleanup() | |
222 | + * | |
223 | + * Desc: Cleans up and removes a whole multi stack. It does not free or | |
224 | + * touch any individual easy handles in any way. We need to define | |
225 | + * in what state those handles will be if this function is called | |
226 | + * in the middle of a transfer. | |
227 | + * | |
228 | + * Returns: CURLMcode type, general multi error code. | |
229 | + */ | |
230 | +CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); | |
231 | + | |
232 | +/* | |
233 | + * Name: curl_multi_info_read() | |
234 | + * | |
235 | + * Desc: Ask the multi handle if there's any messages/informationals from | |
236 | + * the individual transfers. Messages include informationals such as | |
237 | + * error code from the transfer or just the fact that a transfer is | |
238 | + * completed. More details on these should be written down as well. | |
239 | + * | |
240 | + * Repeated calls to this function will return a new struct each | |
241 | + * time, until a special "end of msgs" struct is returned as a signal | |
242 | + * that there is no more to get at this point. | |
243 | + * | |
244 | + * The data the returned pointer points to will not survive calling | |
245 | + * curl_multi_cleanup(). | |
246 | + * | |
247 | + * The 'CURLMsg' struct is meant to be very simple and only contain | |
248 | + * very basic information. If more involved information is wanted, | |
249 | + * we will provide the particular "transfer handle" in that struct | |
250 | + * and that should/could/would be used in subsequent | |
251 | + * curl_easy_getinfo() calls (or similar). The point being that we | |
252 | + * must never expose complex structs to applications, as then we'll | |
253 | + * undoubtably get backwards compatibility problems in the future. | |
254 | + * | |
255 | + * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out | |
256 | + * of structs. It also writes the number of messages left in the | |
257 | + * queue (after this read) in the integer the second argument points | |
258 | + * to. | |
259 | + */ | |
260 | +CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, | |
261 | + int *msgs_in_queue); | |
262 | + | |
263 | +/* | |
264 | + * Name: curl_multi_strerror() | |
265 | + * | |
266 | + * Desc: The curl_multi_strerror function may be used to turn a CURLMcode | |
267 | + * value into the equivalent human readable error string. This is | |
268 | + * useful for printing meaningful error messages. | |
269 | + * | |
270 | + * Returns: A pointer to a null-terminated error message. | |
271 | + */ | |
272 | +CURL_EXTERN const char *curl_multi_strerror(CURLMcode); | |
273 | + | |
274 | +/* | |
275 | + * Name: curl_multi_socket() and | |
276 | + * curl_multi_socket_all() | |
277 | + * | |
278 | + * Desc: An alternative version of curl_multi_perform() that allows the | |
279 | + * application to pass in one of the file descriptors that have been | |
280 | + * detected to have "action" on them and let libcurl perform. | |
281 | + * See man page for details. | |
282 | + */ | |
283 | +#define CURL_POLL_NONE 0 | |
284 | +#define CURL_POLL_IN 1 | |
285 | +#define CURL_POLL_OUT 2 | |
286 | +#define CURL_POLL_INOUT 3 | |
287 | +#define CURL_POLL_REMOVE 4 | |
288 | + | |
289 | +#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD | |
290 | + | |
291 | +#define CURL_CSELECT_IN 0x01 | |
292 | +#define CURL_CSELECT_OUT 0x02 | |
293 | +#define CURL_CSELECT_ERR 0x04 | |
294 | + | |
295 | +typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ | |
296 | + curl_socket_t s, /* socket */ | |
297 | + int what, /* see above */ | |
298 | + void *userp, /* private callback | |
299 | + pointer */ | |
300 | + void *socketp); /* private socket | |
301 | + pointer */ | |
302 | +/* | |
303 | + * Name: curl_multi_timer_callback | |
304 | + * | |
305 | + * Desc: Called by libcurl whenever the library detects a change in the | |
306 | + * maximum number of milliseconds the app is allowed to wait before | |
307 | + * curl_multi_socket() or curl_multi_perform() must be called | |
308 | + * (to allow libcurl's timed events to take place). | |
309 | + * | |
310 | + * Returns: The callback should return zero. | |
311 | + */ | |
312 | +typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ | |
313 | + long timeout_ms, /* see above */ | |
314 | + void *userp); /* private callback | |
315 | + pointer */ | |
316 | + | |
317 | +CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, | |
318 | + int *running_handles); | |
319 | + | |
320 | +CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, | |
321 | + curl_socket_t s, | |
322 | + int ev_bitmask, | |
323 | + int *running_handles); | |
324 | + | |
325 | +CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, | |
326 | + int *running_handles); | |
327 | + | |
328 | +#ifndef CURL_ALLOW_OLD_MULTI_SOCKET | |
329 | +/* This macro below was added in 7.16.3 to push users who recompile to use | |
330 | + the new curl_multi_socket_action() instead of the old curl_multi_socket() | |
331 | +*/ | |
332 | +#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) | |
333 | +#endif | |
334 | + | |
335 | +/* | |
336 | + * Name: curl_multi_timeout() | |
337 | + * | |
338 | + * Desc: Returns the maximum number of milliseconds the app is allowed to | |
339 | + * wait before curl_multi_socket() or curl_multi_perform() must be | |
340 | + * called (to allow libcurl's timed events to take place). | |
341 | + * | |
342 | + * Returns: CURLM error code. | |
343 | + */ | |
344 | +CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, | |
345 | + long *milliseconds); | |
346 | + | |
347 | +typedef enum { | |
348 | + /* This is the socket callback function pointer */ | |
349 | + CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), | |
350 | + | |
351 | + /* This is the argument passed to the socket callback */ | |
352 | + CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), | |
353 | + | |
354 | + /* set to 1 to enable pipelining for this multi handle */ | |
355 | + CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), | |
356 | + | |
357 | + /* This is the timer callback function pointer */ | |
358 | + CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), | |
359 | + | |
360 | + /* This is the argument passed to the timer callback */ | |
361 | + CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), | |
362 | + | |
363 | + /* maximum number of entries in the connection cache */ | |
364 | + CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), | |
365 | + | |
366 | + /* maximum number of (pipelining) connections to one host */ | |
367 | + CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), | |
368 | + | |
369 | + /* maximum number of requests in a pipeline */ | |
370 | + CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), | |
371 | + | |
372 | + /* a connection with a content-length longer than this | |
373 | + will not be considered for pipelining */ | |
374 | + CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), | |
375 | + | |
376 | + /* a connection with a chunk length longer than this | |
377 | + will not be considered for pipelining */ | |
378 | + CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), | |
379 | + | |
380 | + /* a list of site names(+port) that are blocked from pipelining */ | |
381 | + CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), | |
382 | + | |
383 | + /* a list of server types that are blocked from pipelining */ | |
384 | + CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), | |
385 | + | |
386 | + /* maximum number of open connections in total */ | |
387 | + CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), | |
388 | + | |
389 | + /* This is the server push callback function pointer */ | |
390 | + CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), | |
391 | + | |
392 | + /* This is the argument passed to the server push callback */ | |
393 | + CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), | |
394 | + | |
395 | + /* maximum number of concurrent streams to support on a connection */ | |
396 | + CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), | |
397 | + | |
398 | + CURLMOPT_LASTENTRY /* the last unused */ | |
399 | +} CURLMoption; | |
400 | + | |
401 | + | |
402 | +/* | |
403 | + * Name: curl_multi_setopt() | |
404 | + * | |
405 | + * Desc: Sets options for the multi handle. | |
406 | + * | |
407 | + * Returns: CURLM error code. | |
408 | + */ | |
409 | +CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, | |
410 | + CURLMoption option, ...); | |
411 | + | |
412 | + | |
413 | +/* | |
414 | + * Name: curl_multi_assign() | |
415 | + * | |
416 | + * Desc: This function sets an association in the multi handle between the | |
417 | + * given socket and a private pointer of the application. This is | |
418 | + * (only) useful for curl_multi_socket uses. | |
419 | + * | |
420 | + * Returns: CURLM error code. | |
421 | + */ | |
422 | +CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, | |
423 | + curl_socket_t sockfd, void *sockp); | |
424 | + | |
425 | + | |
426 | +/* | |
427 | + * Name: curl_push_callback | |
428 | + * | |
429 | + * Desc: This callback gets called when a new stream is being pushed by the | |
430 | + * server. It approves or denies the new stream. It can also decide | |
431 | + * to completely fail the connection. | |
432 | + * | |
433 | + * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT | |
434 | + */ | |
435 | +#define CURL_PUSH_OK 0 | |
436 | +#define CURL_PUSH_DENY 1 | |
437 | +#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */ | |
438 | + | |
439 | +struct curl_pushheaders; /* forward declaration only */ | |
440 | + | |
441 | +CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, | |
442 | + size_t num); | |
443 | +CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, | |
444 | + const char *name); | |
445 | + | |
446 | +typedef int (*curl_push_callback)(CURL *parent, | |
447 | + CURL *easy, | |
448 | + size_t num_headers, | |
449 | + struct curl_pushheaders *headers, | |
450 | + void *userp); | |
451 | + | |
452 | +#ifdef __cplusplus | |
453 | +} /* end of extern "C" */ | |
454 | +#endif | |
455 | + | |
456 | +#endif |
@@ -0,0 +1,68 @@ | ||
1 | +#ifndef CURLINC_OPTIONS_H | |
2 | +#define CURLINC_OPTIONS_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 | +#ifdef __cplusplus | |
26 | +extern "C" { | |
27 | +#endif | |
28 | + | |
29 | +typedef enum { | |
30 | + CURLOT_LONG, /* long (a range of values) */ | |
31 | + CURLOT_VALUES, /* (a defined set or bitmask) */ | |
32 | + CURLOT_OFF_T, /* curl_off_t (a range of values) */ | |
33 | + CURLOT_OBJECT, /* pointer (void *) */ | |
34 | + CURLOT_STRING, /* (char * to zero terminated buffer) */ | |
35 | + CURLOT_SLIST, /* (struct curl_slist *) */ | |
36 | + CURLOT_CBPTR, /* (void * passed as-is to a callback) */ | |
37 | + CURLOT_BLOB, /* blob (struct curl_blob *) */ | |
38 | + CURLOT_FUNCTION /* function pointer */ | |
39 | +} curl_easytype; | |
40 | + | |
41 | +/* Flag bits */ | |
42 | + | |
43 | +/* "alias" means it is provided for old programs to remain functional, | |
44 | + we prefer another name */ | |
45 | +#define CURLOT_FLAG_ALIAS (1<<0) | |
46 | + | |
47 | +/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size | |
48 | + to use for curl_easy_setopt() for the given id */ | |
49 | +struct curl_easyoption { | |
50 | + const char *name; | |
51 | + CURLoption id; | |
52 | + curl_easytype type; | |
53 | + unsigned int flags; | |
54 | +}; | |
55 | + | |
56 | +CURL_EXTERN const struct curl_easyoption * | |
57 | +curl_easy_option_by_name(const char *name); | |
58 | + | |
59 | +CURL_EXTERN const struct curl_easyoption * | |
60 | +curl_easy_option_by_id (CURLoption id); | |
61 | + | |
62 | +CURL_EXTERN const struct curl_easyoption * | |
63 | +curl_easy_option_next(const struct curl_easyoption *prev); | |
64 | + | |
65 | +#ifdef __cplusplus | |
66 | +} /* end of extern "C" */ | |
67 | +#endif | |
68 | +#endif /* CURLINC_OPTIONS_H */ |
@@ -0,0 +1,33 @@ | ||
1 | +#ifndef CURLINC_STDCHEADERS_H | |
2 | +#define CURLINC_STDCHEADERS_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | + | |
25 | +#include <sys/types.h> | |
26 | + | |
27 | +size_t fread(void *, size_t, size_t, FILE *); | |
28 | +size_t fwrite(const void *, size_t, size_t, FILE *); | |
29 | + | |
30 | +int strcasecmp(const char *, const char *); | |
31 | +int strncasecmp(const char *, const char *, size_t); | |
32 | + | |
33 | +#endif /* CURLINC_STDCHEADERS_H */ |
@@ -0,0 +1,504 @@ | ||
1 | +#ifndef CURLINC_SYSTEM_H | |
2 | +#define CURLINC_SYSTEM_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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_TYPEOF_CURL_OFF_T long long | |
56 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
57 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
58 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
59 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
60 | +# else | |
61 | +# define CURL_TYPEOF_CURL_OFF_T long | |
62 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
63 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
64 | +# define CURL_SUFFIX_CURL_OFF_T L | |
65 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
66 | +# endif | |
67 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
68 | + | |
69 | +#elif defined(__SALFORDC__) | |
70 | +# define CURL_TYPEOF_CURL_OFF_T long | |
71 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
72 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
73 | +# define CURL_SUFFIX_CURL_OFF_T L | |
74 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
75 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
76 | + | |
77 | +#elif defined(__BORLANDC__) | |
78 | +# if (__BORLANDC__ < 0x520) | |
79 | +# define CURL_TYPEOF_CURL_OFF_T long | |
80 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
81 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
82 | +# define CURL_SUFFIX_CURL_OFF_T L | |
83 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
84 | +# else | |
85 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
86 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
87 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
88 | +# define CURL_SUFFIX_CURL_OFF_T i64 | |
89 | +# define CURL_SUFFIX_CURL_OFF_TU ui64 | |
90 | +# endif | |
91 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
92 | + | |
93 | +#elif defined(__TURBOC__) | |
94 | +# define CURL_TYPEOF_CURL_OFF_T long | |
95 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
96 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
97 | +# define CURL_SUFFIX_CURL_OFF_T L | |
98 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
99 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
100 | + | |
101 | +#elif defined(__WATCOMC__) | |
102 | +# if defined(__386__) | |
103 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
104 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
105 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
106 | +# define CURL_SUFFIX_CURL_OFF_T i64 | |
107 | +# define CURL_SUFFIX_CURL_OFF_TU ui64 | |
108 | +# else | |
109 | +# define CURL_TYPEOF_CURL_OFF_T long | |
110 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
111 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
112 | +# define CURL_SUFFIX_CURL_OFF_T L | |
113 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
114 | +# endif | |
115 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
116 | + | |
117 | +#elif defined(__POCC__) | |
118 | +# if (__POCC__ < 280) | |
119 | +# define CURL_TYPEOF_CURL_OFF_T long | |
120 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
121 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
122 | +# define CURL_SUFFIX_CURL_OFF_T L | |
123 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
124 | +# elif defined(_MSC_VER) | |
125 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
126 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
127 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
128 | +# define CURL_SUFFIX_CURL_OFF_T i64 | |
129 | +# define CURL_SUFFIX_CURL_OFF_TU ui64 | |
130 | +# else | |
131 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
132 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
133 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
134 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
135 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
136 | +# endif | |
137 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
138 | + | |
139 | +#elif defined(__LCC__) | |
140 | +# if defined(__e2k__) /* MCST eLbrus C Compiler */ | |
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_SUFFIX_CURL_OFF_T L | |
145 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
146 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
147 | +# define CURL_PULL_SYS_TYPES_H 1 | |
148 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
149 | +# else /* Local (or Little) C Compiler */ | |
150 | +# define CURL_TYPEOF_CURL_OFF_T long | |
151 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
152 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
153 | +# define CURL_SUFFIX_CURL_OFF_T L | |
154 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
155 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
156 | +# endif | |
157 | + | |
158 | +#elif defined(__SYMBIAN32__) | |
159 | +# if defined(__EABI__) /* Treat all ARM compilers equally */ | |
160 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
161 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
162 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
163 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
164 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
165 | +# elif defined(__CW32__) | |
166 | +# pragma longlong on | |
167 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
168 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
169 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
170 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
171 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
172 | +# elif defined(__VC32__) | |
173 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
174 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
175 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
176 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
177 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
178 | +# endif | |
179 | +# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int | |
180 | + | |
181 | +#elif defined(__MWERKS__) | |
182 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
183 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
184 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
185 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
186 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
187 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
188 | + | |
189 | +#elif defined(_WIN32_WCE) | |
190 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
191 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
192 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
193 | +# define CURL_SUFFIX_CURL_OFF_T i64 | |
194 | +# define CURL_SUFFIX_CURL_OFF_TU ui64 | |
195 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
196 | + | |
197 | +#elif defined(__MINGW32__) | |
198 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
199 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
200 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
201 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
202 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
203 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
204 | +# define CURL_PULL_SYS_TYPES_H 1 | |
205 | +# define CURL_PULL_WS2TCPIP_H 1 | |
206 | + | |
207 | +#elif defined(__VMS) | |
208 | +# if defined(__VAX) | |
209 | +# define CURL_TYPEOF_CURL_OFF_T long | |
210 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
211 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
212 | +# define CURL_SUFFIX_CURL_OFF_T L | |
213 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
214 | +# else | |
215 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
216 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
217 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
218 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
219 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
220 | +# endif | |
221 | +# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int | |
222 | + | |
223 | +#elif defined(__OS400__) | |
224 | +# if defined(__ILEC400__) | |
225 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
226 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
227 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
228 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
229 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
230 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
231 | +# define CURL_PULL_SYS_TYPES_H 1 | |
232 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
233 | +# endif | |
234 | + | |
235 | +#elif defined(__MVS__) | |
236 | +# if defined(__IBMC__) || defined(__IBMCPP__) | |
237 | +# if defined(_ILP32) | |
238 | +# elif defined(_LP64) | |
239 | +# endif | |
240 | +# if defined(_LONG_LONG) | |
241 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
242 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
243 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
244 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
245 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
246 | +# elif defined(_LP64) | |
247 | +# define CURL_TYPEOF_CURL_OFF_T long | |
248 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
249 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
250 | +# define CURL_SUFFIX_CURL_OFF_T L | |
251 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
252 | +# else | |
253 | +# define CURL_TYPEOF_CURL_OFF_T long | |
254 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
255 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
256 | +# define CURL_SUFFIX_CURL_OFF_T L | |
257 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
258 | +# endif | |
259 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
260 | +# define CURL_PULL_SYS_TYPES_H 1 | |
261 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
262 | +# endif | |
263 | + | |
264 | +#elif defined(__370__) | |
265 | +# if defined(__IBMC__) || defined(__IBMCPP__) | |
266 | +# if defined(_ILP32) | |
267 | +# elif defined(_LP64) | |
268 | +# endif | |
269 | +# if defined(_LONG_LONG) | |
270 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
271 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
272 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
273 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
274 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
275 | +# elif defined(_LP64) | |
276 | +# define CURL_TYPEOF_CURL_OFF_T long | |
277 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
278 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
279 | +# define CURL_SUFFIX_CURL_OFF_T L | |
280 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
281 | +# else | |
282 | +# define CURL_TYPEOF_CURL_OFF_T long | |
283 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
284 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
285 | +# define CURL_SUFFIX_CURL_OFF_T L | |
286 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
287 | +# endif | |
288 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
289 | +# define CURL_PULL_SYS_TYPES_H 1 | |
290 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
291 | +# endif | |
292 | + | |
293 | +#elif defined(TPF) | |
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_SUFFIX_CURL_OFF_T L | |
298 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
299 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
300 | + | |
301 | +#elif defined(__TINYC__) /* also known as tcc */ | |
302 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
303 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
304 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
305 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
306 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
307 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
308 | +# define CURL_PULL_SYS_TYPES_H 1 | |
309 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
310 | + | |
311 | +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ | |
312 | +# if !defined(__LP64) && (defined(__ILP32) || \ | |
313 | + defined(__i386) || \ | |
314 | + defined(__sparcv8) || \ | |
315 | + defined(__sparcv8plus)) | |
316 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
317 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
318 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
319 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
320 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
321 | +# elif defined(__LP64) || \ | |
322 | + defined(__amd64) || defined(__sparcv9) | |
323 | +# define CURL_TYPEOF_CURL_OFF_T long | |
324 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
325 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
326 | +# define CURL_SUFFIX_CURL_OFF_T L | |
327 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
328 | +# endif | |
329 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
330 | +# define CURL_PULL_SYS_TYPES_H 1 | |
331 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
332 | + | |
333 | +#elif defined(__xlc__) /* IBM xlc compiler */ | |
334 | +# if !defined(_LP64) | |
335 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
336 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
337 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
338 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
339 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
340 | +# else | |
341 | +# define CURL_TYPEOF_CURL_OFF_T long | |
342 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
343 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
344 | +# define CURL_SUFFIX_CURL_OFF_T L | |
345 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
346 | +# endif | |
347 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
348 | +# define CURL_PULL_SYS_TYPES_H 1 | |
349 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
350 | + | |
351 | +/* ===================================== */ | |
352 | +/* KEEP MSVC THE PENULTIMATE ENTRY */ | |
353 | +/* ===================================== */ | |
354 | + | |
355 | +#elif defined(_MSC_VER) | |
356 | +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) | |
357 | +# define CURL_TYPEOF_CURL_OFF_T __int64 | |
358 | +# define CURL_FORMAT_CURL_OFF_T "I64d" | |
359 | +# define CURL_FORMAT_CURL_OFF_TU "I64u" | |
360 | +# define CURL_SUFFIX_CURL_OFF_T i64 | |
361 | +# define CURL_SUFFIX_CURL_OFF_TU ui64 | |
362 | +# else | |
363 | +# define CURL_TYPEOF_CURL_OFF_T long | |
364 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
365 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
366 | +# define CURL_SUFFIX_CURL_OFF_T L | |
367 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
368 | +# endif | |
369 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
370 | + | |
371 | +/* ===================================== */ | |
372 | +/* KEEP GENERIC GCC THE LAST ENTRY */ | |
373 | +/* ===================================== */ | |
374 | + | |
375 | +#elif defined(__GNUC__) && !defined(_SCO_DS) | |
376 | +# if !defined(__LP64__) && \ | |
377 | + (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \ | |
378 | + defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \ | |
379 | + defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ | |
380 | + defined(__XTENSA__) || \ | |
381 | + (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ | |
382 | + (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) | |
383 | +# define CURL_TYPEOF_CURL_OFF_T long long | |
384 | +# define CURL_FORMAT_CURL_OFF_T "lld" | |
385 | +# define CURL_FORMAT_CURL_OFF_TU "llu" | |
386 | +# define CURL_SUFFIX_CURL_OFF_T LL | |
387 | +# define CURL_SUFFIX_CURL_OFF_TU ULL | |
388 | +# elif defined(__LP64__) || \ | |
389 | + defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ | |
390 | + defined(__e2k__) || \ | |
391 | + (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ | |
392 | + (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) | |
393 | +# define CURL_TYPEOF_CURL_OFF_T long | |
394 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
395 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
396 | +# define CURL_SUFFIX_CURL_OFF_T L | |
397 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
398 | +# endif | |
399 | +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t | |
400 | +# define CURL_PULL_SYS_TYPES_H 1 | |
401 | +# define CURL_PULL_SYS_SOCKET_H 1 | |
402 | + | |
403 | +#else | |
404 | +/* generic "safe guess" on old 32 bit style */ | |
405 | +# define CURL_TYPEOF_CURL_OFF_T long | |
406 | +# define CURL_FORMAT_CURL_OFF_T "ld" | |
407 | +# define CURL_FORMAT_CURL_OFF_TU "lu" | |
408 | +# define CURL_SUFFIX_CURL_OFF_T L | |
409 | +# define CURL_SUFFIX_CURL_OFF_TU UL | |
410 | +# define CURL_TYPEOF_CURL_SOCKLEN_T int | |
411 | +#endif | |
412 | + | |
413 | +#ifdef _AIX | |
414 | +/* AIX needs <sys/poll.h> */ | |
415 | +#define CURL_PULL_SYS_POLL_H | |
416 | +#endif | |
417 | + | |
418 | + | |
419 | +/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ | |
420 | +/* ws2tcpip.h is required here to properly make type definitions below. */ | |
421 | +#ifdef CURL_PULL_WS2TCPIP_H | |
422 | +# include <winsock2.h> | |
423 | +# include <windows.h> | |
424 | +# include <ws2tcpip.h> | |
425 | +#endif | |
426 | + | |
427 | +/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ | |
428 | +/* sys/types.h is required here to properly make type definitions below. */ | |
429 | +#ifdef CURL_PULL_SYS_TYPES_H | |
430 | +# include <sys/types.h> | |
431 | +#endif | |
432 | + | |
433 | +/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ | |
434 | +/* sys/socket.h is required here to properly make type definitions below. */ | |
435 | +#ifdef CURL_PULL_SYS_SOCKET_H | |
436 | +# include <sys/socket.h> | |
437 | +#endif | |
438 | + | |
439 | +/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ | |
440 | +/* sys/poll.h is required here to properly make type definitions below. */ | |
441 | +#ifdef CURL_PULL_SYS_POLL_H | |
442 | +# include <sys/poll.h> | |
443 | +#endif | |
444 | + | |
445 | +/* Data type definition of curl_socklen_t. */ | |
446 | +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T | |
447 | + typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; | |
448 | +#endif | |
449 | + | |
450 | +/* Data type definition of curl_off_t. */ | |
451 | + | |
452 | +#ifdef CURL_TYPEOF_CURL_OFF_T | |
453 | + typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; | |
454 | +#endif | |
455 | + | |
456 | +/* | |
457 | + * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow | |
458 | + * these to be visible and exported by the external libcurl interface API, | |
459 | + * while also making them visible to the library internals, simply including | |
460 | + * curl_setup.h, without actually needing to include curl.h internally. | |
461 | + * If some day this section would grow big enough, all this should be moved | |
462 | + * to its own header file. | |
463 | + */ | |
464 | + | |
465 | +/* | |
466 | + * Figure out if we can use the ## preprocessor operator, which is supported | |
467 | + * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ | |
468 | + * or __cplusplus so we need to carefully check for them too. | |
469 | + */ | |
470 | + | |
471 | +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ | |
472 | + defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ | |
473 | + defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ | |
474 | + defined(__ILEC400__) | |
475 | + /* This compiler is believed to have an ISO compatible preprocessor */ | |
476 | +#define CURL_ISOCPP | |
477 | +#else | |
478 | + /* This compiler is believed NOT to have an ISO compatible preprocessor */ | |
479 | +#undef CURL_ISOCPP | |
480 | +#endif | |
481 | + | |
482 | +/* | |
483 | + * Macros for minimum-width signed and unsigned curl_off_t integer constants. | |
484 | + */ | |
485 | + | |
486 | +#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) | |
487 | +# define CURLINC_OFF_T_C_HLPR2(x) x | |
488 | +# define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x) | |
489 | +# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ | |
490 | + CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) | |
491 | +# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \ | |
492 | + CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) | |
493 | +#else | |
494 | +# ifdef CURL_ISOCPP | |
495 | +# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix | |
496 | +# else | |
497 | +# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix | |
498 | +# endif | |
499 | +# define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix) | |
500 | +# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) | |
501 | +# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) | |
502 | +#endif | |
503 | + | |
504 | +#endif /* CURLINC_SYSTEM_H */ |
@@ -0,0 +1,704 @@ | ||
1 | +#ifndef CURLINC_TYPECHECK_GCC_H | |
2 | +#define CURLINC_TYPECHECK_GCC_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | + | |
25 | +/* wraps curl_easy_setopt() with typechecking */ | |
26 | + | |
27 | +/* To add a new kind of warning, add an | |
28 | + * if(curlcheck_sometype_option(_curl_opt)) | |
29 | + * if(!curlcheck_sometype(value)) | |
30 | + * _curl_easy_setopt_err_sometype(); | |
31 | + * block and define curlcheck_sometype_option, curlcheck_sometype and | |
32 | + * _curl_easy_setopt_err_sometype below | |
33 | + * | |
34 | + * NOTE: We use two nested 'if' statements here instead of the && operator, in | |
35 | + * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x | |
36 | + * when compiling with -Wlogical-op. | |
37 | + * | |
38 | + * To add an option that uses the same type as an existing option, you'll just | |
39 | + * need to extend the appropriate _curl_*_option macro | |
40 | + */ | |
41 | +#define curl_easy_setopt(handle, option, value) \ | |
42 | + __extension__({ \ | |
43 | + __typeof__(option) _curl_opt = option; \ | |
44 | + if(__builtin_constant_p(_curl_opt)) { \ | |
45 | + if(curlcheck_long_option(_curl_opt)) \ | |
46 | + if(!curlcheck_long(value)) \ | |
47 | + _curl_easy_setopt_err_long(); \ | |
48 | + if(curlcheck_off_t_option(_curl_opt)) \ | |
49 | + if(!curlcheck_off_t(value)) \ | |
50 | + _curl_easy_setopt_err_curl_off_t(); \ | |
51 | + if(curlcheck_string_option(_curl_opt)) \ | |
52 | + if(!curlcheck_string(value)) \ | |
53 | + _curl_easy_setopt_err_string(); \ | |
54 | + if(curlcheck_write_cb_option(_curl_opt)) \ | |
55 | + if(!curlcheck_write_cb(value)) \ | |
56 | + _curl_easy_setopt_err_write_callback(); \ | |
57 | + if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \ | |
58 | + if(!curlcheck_resolver_start_callback(value)) \ | |
59 | + _curl_easy_setopt_err_resolver_start_callback(); \ | |
60 | + if((_curl_opt) == CURLOPT_READFUNCTION) \ | |
61 | + if(!curlcheck_read_cb(value)) \ | |
62 | + _curl_easy_setopt_err_read_cb(); \ | |
63 | + if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ | |
64 | + if(!curlcheck_ioctl_cb(value)) \ | |
65 | + _curl_easy_setopt_err_ioctl_cb(); \ | |
66 | + if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ | |
67 | + if(!curlcheck_sockopt_cb(value)) \ | |
68 | + _curl_easy_setopt_err_sockopt_cb(); \ | |
69 | + if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ | |
70 | + if(!curlcheck_opensocket_cb(value)) \ | |
71 | + _curl_easy_setopt_err_opensocket_cb(); \ | |
72 | + if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ | |
73 | + if(!curlcheck_progress_cb(value)) \ | |
74 | + _curl_easy_setopt_err_progress_cb(); \ | |
75 | + if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ | |
76 | + if(!curlcheck_debug_cb(value)) \ | |
77 | + _curl_easy_setopt_err_debug_cb(); \ | |
78 | + if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ | |
79 | + if(!curlcheck_ssl_ctx_cb(value)) \ | |
80 | + _curl_easy_setopt_err_ssl_ctx_cb(); \ | |
81 | + if(curlcheck_conv_cb_option(_curl_opt)) \ | |
82 | + if(!curlcheck_conv_cb(value)) \ | |
83 | + _curl_easy_setopt_err_conv_cb(); \ | |
84 | + if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ | |
85 | + if(!curlcheck_seek_cb(value)) \ | |
86 | + _curl_easy_setopt_err_seek_cb(); \ | |
87 | + if(curlcheck_cb_data_option(_curl_opt)) \ | |
88 | + if(!curlcheck_cb_data(value)) \ | |
89 | + _curl_easy_setopt_err_cb_data(); \ | |
90 | + if((_curl_opt) == CURLOPT_ERRORBUFFER) \ | |
91 | + if(!curlcheck_error_buffer(value)) \ | |
92 | + _curl_easy_setopt_err_error_buffer(); \ | |
93 | + if((_curl_opt) == CURLOPT_STDERR) \ | |
94 | + if(!curlcheck_FILE(value)) \ | |
95 | + _curl_easy_setopt_err_FILE(); \ | |
96 | + if(curlcheck_postfields_option(_curl_opt)) \ | |
97 | + if(!curlcheck_postfields(value)) \ | |
98 | + _curl_easy_setopt_err_postfields(); \ | |
99 | + if((_curl_opt) == CURLOPT_HTTPPOST) \ | |
100 | + if(!curlcheck_arr((value), struct curl_httppost)) \ | |
101 | + _curl_easy_setopt_err_curl_httpost(); \ | |
102 | + if((_curl_opt) == CURLOPT_MIMEPOST) \ | |
103 | + if(!curlcheck_ptr((value), curl_mime)) \ | |
104 | + _curl_easy_setopt_err_curl_mimepost(); \ | |
105 | + if(curlcheck_slist_option(_curl_opt)) \ | |
106 | + if(!curlcheck_arr((value), struct curl_slist)) \ | |
107 | + _curl_easy_setopt_err_curl_slist(); \ | |
108 | + if((_curl_opt) == CURLOPT_SHARE) \ | |
109 | + if(!curlcheck_ptr((value), CURLSH)) \ | |
110 | + _curl_easy_setopt_err_CURLSH(); \ | |
111 | + } \ | |
112 | + curl_easy_setopt(handle, _curl_opt, value); \ | |
113 | + }) | |
114 | + | |
115 | +/* wraps curl_easy_getinfo() with typechecking */ | |
116 | +#define curl_easy_getinfo(handle, info, arg) \ | |
117 | + __extension__({ \ | |
118 | + __typeof__(info) _curl_info = info; \ | |
119 | + if(__builtin_constant_p(_curl_info)) { \ | |
120 | + if(curlcheck_string_info(_curl_info)) \ | |
121 | + if(!curlcheck_arr((arg), char *)) \ | |
122 | + _curl_easy_getinfo_err_string(); \ | |
123 | + if(curlcheck_long_info(_curl_info)) \ | |
124 | + if(!curlcheck_arr((arg), long)) \ | |
125 | + _curl_easy_getinfo_err_long(); \ | |
126 | + if(curlcheck_double_info(_curl_info)) \ | |
127 | + if(!curlcheck_arr((arg), double)) \ | |
128 | + _curl_easy_getinfo_err_double(); \ | |
129 | + if(curlcheck_slist_info(_curl_info)) \ | |
130 | + if(!curlcheck_arr((arg), struct curl_slist *)) \ | |
131 | + _curl_easy_getinfo_err_curl_slist(); \ | |
132 | + if(curlcheck_tlssessioninfo_info(_curl_info)) \ | |
133 | + if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \ | |
134 | + _curl_easy_getinfo_err_curl_tlssesssioninfo(); \ | |
135 | + if(curlcheck_certinfo_info(_curl_info)) \ | |
136 | + if(!curlcheck_arr((arg), struct curl_certinfo *)) \ | |
137 | + _curl_easy_getinfo_err_curl_certinfo(); \ | |
138 | + if(curlcheck_socket_info(_curl_info)) \ | |
139 | + if(!curlcheck_arr((arg), curl_socket_t)) \ | |
140 | + _curl_easy_getinfo_err_curl_socket(); \ | |
141 | + if(curlcheck_off_t_info(_curl_info)) \ | |
142 | + if(!curlcheck_arr((arg), curl_off_t)) \ | |
143 | + _curl_easy_getinfo_err_curl_off_t(); \ | |
144 | + } \ | |
145 | + curl_easy_getinfo(handle, _curl_info, arg); \ | |
146 | + }) | |
147 | + | |
148 | +/* | |
149 | + * For now, just make sure that the functions are called with three arguments | |
150 | + */ | |
151 | +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) | |
152 | +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) | |
153 | + | |
154 | + | |
155 | +/* the actual warnings, triggered by calling the _curl_easy_setopt_err* | |
156 | + * functions */ | |
157 | + | |
158 | +/* To define a new warning, use _CURL_WARNING(identifier, "message") */ | |
159 | +#define CURLWARNING(id, message) \ | |
160 | + static void __attribute__((__warning__(message))) \ | |
161 | + __attribute__((__unused__)) __attribute__((__noinline__)) \ | |
162 | + id(void) { __asm__(""); } | |
163 | + | |
164 | +CURLWARNING(_curl_easy_setopt_err_long, | |
165 | + "curl_easy_setopt expects a long argument for this option") | |
166 | +CURLWARNING(_curl_easy_setopt_err_curl_off_t, | |
167 | + "curl_easy_setopt expects a curl_off_t argument for this option") | |
168 | +CURLWARNING(_curl_easy_setopt_err_string, | |
169 | + "curl_easy_setopt expects a " | |
170 | + "string ('char *' or char[]) argument for this option" | |
171 | + ) | |
172 | +CURLWARNING(_curl_easy_setopt_err_write_callback, | |
173 | + "curl_easy_setopt expects a curl_write_callback argument for this option") | |
174 | +CURLWARNING(_curl_easy_setopt_err_resolver_start_callback, | |
175 | + "curl_easy_setopt expects a " | |
176 | + "curl_resolver_start_callback argument for this option" | |
177 | + ) | |
178 | +CURLWARNING(_curl_easy_setopt_err_read_cb, | |
179 | + "curl_easy_setopt expects a curl_read_callback argument for this option") | |
180 | +CURLWARNING(_curl_easy_setopt_err_ioctl_cb, | |
181 | + "curl_easy_setopt expects a curl_ioctl_callback argument for this option") | |
182 | +CURLWARNING(_curl_easy_setopt_err_sockopt_cb, | |
183 | + "curl_easy_setopt expects a curl_sockopt_callback argument for this option") | |
184 | +CURLWARNING(_curl_easy_setopt_err_opensocket_cb, | |
185 | + "curl_easy_setopt expects a " | |
186 | + "curl_opensocket_callback argument for this option" | |
187 | + ) | |
188 | +CURLWARNING(_curl_easy_setopt_err_progress_cb, | |
189 | + "curl_easy_setopt expects a curl_progress_callback argument for this option") | |
190 | +CURLWARNING(_curl_easy_setopt_err_debug_cb, | |
191 | + "curl_easy_setopt expects a curl_debug_callback argument for this option") | |
192 | +CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb, | |
193 | + "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") | |
194 | +CURLWARNING(_curl_easy_setopt_err_conv_cb, | |
195 | + "curl_easy_setopt expects a curl_conv_callback argument for this option") | |
196 | +CURLWARNING(_curl_easy_setopt_err_seek_cb, | |
197 | + "curl_easy_setopt expects a curl_seek_callback argument for this option") | |
198 | +CURLWARNING(_curl_easy_setopt_err_cb_data, | |
199 | + "curl_easy_setopt expects a " | |
200 | + "private data pointer as argument for this option") | |
201 | +CURLWARNING(_curl_easy_setopt_err_error_buffer, | |
202 | + "curl_easy_setopt expects a " | |
203 | + "char buffer of CURL_ERROR_SIZE as argument for this option") | |
204 | +CURLWARNING(_curl_easy_setopt_err_FILE, | |
205 | + "curl_easy_setopt expects a 'FILE *' argument for this option") | |
206 | +CURLWARNING(_curl_easy_setopt_err_postfields, | |
207 | + "curl_easy_setopt expects a 'void *' or 'char *' argument for this option") | |
208 | +CURLWARNING(_curl_easy_setopt_err_curl_httpost, | |
209 | + "curl_easy_setopt expects a 'struct curl_httppost *' " | |
210 | + "argument for this option") | |
211 | +CURLWARNING(_curl_easy_setopt_err_curl_mimepost, | |
212 | + "curl_easy_setopt expects a 'curl_mime *' " | |
213 | + "argument for this option") | |
214 | +CURLWARNING(_curl_easy_setopt_err_curl_slist, | |
215 | + "curl_easy_setopt expects a 'struct curl_slist *' argument for this option") | |
216 | +CURLWARNING(_curl_easy_setopt_err_CURLSH, | |
217 | + "curl_easy_setopt expects a CURLSH* argument for this option") | |
218 | + | |
219 | +CURLWARNING(_curl_easy_getinfo_err_string, | |
220 | + "curl_easy_getinfo expects a pointer to 'char *' for this info") | |
221 | +CURLWARNING(_curl_easy_getinfo_err_long, | |
222 | + "curl_easy_getinfo expects a pointer to long for this info") | |
223 | +CURLWARNING(_curl_easy_getinfo_err_double, | |
224 | + "curl_easy_getinfo expects a pointer to double for this info") | |
225 | +CURLWARNING(_curl_easy_getinfo_err_curl_slist, | |
226 | + "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info") | |
227 | +CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo, | |
228 | + "curl_easy_getinfo expects a pointer to " | |
229 | + "'struct curl_tlssessioninfo *' for this info") | |
230 | +CURLWARNING(_curl_easy_getinfo_err_curl_certinfo, | |
231 | + "curl_easy_getinfo expects a pointer to " | |
232 | + "'struct curl_certinfo *' for this info") | |
233 | +CURLWARNING(_curl_easy_getinfo_err_curl_socket, | |
234 | + "curl_easy_getinfo expects a pointer to curl_socket_t for this info") | |
235 | +CURLWARNING(_curl_easy_getinfo_err_curl_off_t, | |
236 | + "curl_easy_getinfo expects a pointer to curl_off_t for this info") | |
237 | + | |
238 | +/* groups of curl_easy_setops options that take the same type of argument */ | |
239 | + | |
240 | +/* To add a new option to one of the groups, just add | |
241 | + * (option) == CURLOPT_SOMETHING | |
242 | + * to the or-expression. If the option takes a long or curl_off_t, you don't | |
243 | + * have to do anything | |
244 | + */ | |
245 | + | |
246 | +/* evaluates to true if option takes a long argument */ | |
247 | +#define curlcheck_long_option(option) \ | |
248 | + (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) | |
249 | + | |
250 | +#define curlcheck_off_t_option(option) \ | |
251 | + (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB)) | |
252 | + | |
253 | +/* evaluates to true if option takes a char* argument */ | |
254 | +#define curlcheck_string_option(option) \ | |
255 | + ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \ | |
256 | + (option) == CURLOPT_ACCEPT_ENCODING || \ | |
257 | + (option) == CURLOPT_ALTSVC || \ | |
258 | + (option) == CURLOPT_CAINFO || \ | |
259 | + (option) == CURLOPT_CAPATH || \ | |
260 | + (option) == CURLOPT_COOKIE || \ | |
261 | + (option) == CURLOPT_COOKIEFILE || \ | |
262 | + (option) == CURLOPT_COOKIEJAR || \ | |
263 | + (option) == CURLOPT_COOKIELIST || \ | |
264 | + (option) == CURLOPT_CRLFILE || \ | |
265 | + (option) == CURLOPT_CUSTOMREQUEST || \ | |
266 | + (option) == CURLOPT_DEFAULT_PROTOCOL || \ | |
267 | + (option) == CURLOPT_DNS_INTERFACE || \ | |
268 | + (option) == CURLOPT_DNS_LOCAL_IP4 || \ | |
269 | + (option) == CURLOPT_DNS_LOCAL_IP6 || \ | |
270 | + (option) == CURLOPT_DNS_SERVERS || \ | |
271 | + (option) == CURLOPT_DOH_URL || \ | |
272 | + (option) == CURLOPT_EGDSOCKET || \ | |
273 | + (option) == CURLOPT_FTPPORT || \ | |
274 | + (option) == CURLOPT_FTP_ACCOUNT || \ | |
275 | + (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ | |
276 | + (option) == CURLOPT_HSTS || \ | |
277 | + (option) == CURLOPT_INTERFACE || \ | |
278 | + (option) == CURLOPT_ISSUERCERT || \ | |
279 | + (option) == CURLOPT_KEYPASSWD || \ | |
280 | + (option) == CURLOPT_KRBLEVEL || \ | |
281 | + (option) == CURLOPT_LOGIN_OPTIONS || \ | |
282 | + (option) == CURLOPT_MAIL_AUTH || \ | |
283 | + (option) == CURLOPT_MAIL_FROM || \ | |
284 | + (option) == CURLOPT_NETRC_FILE || \ | |
285 | + (option) == CURLOPT_NOPROXY || \ | |
286 | + (option) == CURLOPT_PASSWORD || \ | |
287 | + (option) == CURLOPT_PINNEDPUBLICKEY || \ | |
288 | + (option) == CURLOPT_PRE_PROXY || \ | |
289 | + (option) == CURLOPT_PROXY || \ | |
290 | + (option) == CURLOPT_PROXYPASSWORD || \ | |
291 | + (option) == CURLOPT_PROXYUSERNAME || \ | |
292 | + (option) == CURLOPT_PROXYUSERPWD || \ | |
293 | + (option) == CURLOPT_PROXY_CAINFO || \ | |
294 | + (option) == CURLOPT_PROXY_CAPATH || \ | |
295 | + (option) == CURLOPT_PROXY_CRLFILE || \ | |
296 | + (option) == CURLOPT_PROXY_ISSUERCERT || \ | |
297 | + (option) == CURLOPT_PROXY_KEYPASSWD || \ | |
298 | + (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \ | |
299 | + (option) == CURLOPT_PROXY_SERVICE_NAME || \ | |
300 | + (option) == CURLOPT_PROXY_SSLCERT || \ | |
301 | + (option) == CURLOPT_PROXY_SSLCERTTYPE || \ | |
302 | + (option) == CURLOPT_PROXY_SSLKEY || \ | |
303 | + (option) == CURLOPT_PROXY_SSLKEYTYPE || \ | |
304 | + (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \ | |
305 | + (option) == CURLOPT_PROXY_TLS13_CIPHERS || \ | |
306 | + (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \ | |
307 | + (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \ | |
308 | + (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \ | |
309 | + (option) == CURLOPT_RANDOM_FILE || \ | |
310 | + (option) == CURLOPT_RANGE || \ | |
311 | + (option) == CURLOPT_REFERER || \ | |
312 | + (option) == CURLOPT_REQUEST_TARGET || \ | |
313 | + (option) == CURLOPT_RTSP_SESSION_ID || \ | |
314 | + (option) == CURLOPT_RTSP_STREAM_URI || \ | |
315 | + (option) == CURLOPT_RTSP_TRANSPORT || \ | |
316 | + (option) == CURLOPT_SASL_AUTHZID || \ | |
317 | + (option) == CURLOPT_SERVICE_NAME || \ | |
318 | + (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ | |
319 | + (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ | |
320 | + (option) == CURLOPT_SSH_KNOWNHOSTS || \ | |
321 | + (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ | |
322 | + (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ | |
323 | + (option) == CURLOPT_SSLCERT || \ | |
324 | + (option) == CURLOPT_SSLCERTTYPE || \ | |
325 | + (option) == CURLOPT_SSLENGINE || \ | |
326 | + (option) == CURLOPT_SSLKEY || \ | |
327 | + (option) == CURLOPT_SSLKEYTYPE || \ | |
328 | + (option) == CURLOPT_SSL_CIPHER_LIST || \ | |
329 | + (option) == CURLOPT_TLS13_CIPHERS || \ | |
330 | + (option) == CURLOPT_TLSAUTH_PASSWORD || \ | |
331 | + (option) == CURLOPT_TLSAUTH_TYPE || \ | |
332 | + (option) == CURLOPT_TLSAUTH_USERNAME || \ | |
333 | + (option) == CURLOPT_UNIX_SOCKET_PATH || \ | |
334 | + (option) == CURLOPT_URL || \ | |
335 | + (option) == CURLOPT_USERAGENT || \ | |
336 | + (option) == CURLOPT_USERNAME || \ | |
337 | + (option) == CURLOPT_USERPWD || \ | |
338 | + (option) == CURLOPT_XOAUTH2_BEARER || \ | |
339 | + (option) == CURLOPT_SSL_EC_CURVES || \ | |
340 | + 0) | |
341 | + | |
342 | +/* evaluates to true if option takes a curl_write_callback argument */ | |
343 | +#define curlcheck_write_cb_option(option) \ | |
344 | + ((option) == CURLOPT_HEADERFUNCTION || \ | |
345 | + (option) == CURLOPT_WRITEFUNCTION) | |
346 | + | |
347 | +/* evaluates to true if option takes a curl_conv_callback argument */ | |
348 | +#define curlcheck_conv_cb_option(option) \ | |
349 | + ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ | |
350 | + (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ | |
351 | + (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) | |
352 | + | |
353 | +/* evaluates to true if option takes a data argument to pass to a callback */ | |
354 | +#define curlcheck_cb_data_option(option) \ | |
355 | + ((option) == CURLOPT_CHUNK_DATA || \ | |
356 | + (option) == CURLOPT_CLOSESOCKETDATA || \ | |
357 | + (option) == CURLOPT_DEBUGDATA || \ | |
358 | + (option) == CURLOPT_FNMATCH_DATA || \ | |
359 | + (option) == CURLOPT_HEADERDATA || \ | |
360 | + (option) == CURLOPT_HSTSREADDATA || \ | |
361 | + (option) == CURLOPT_HSTSWRITEDATA || \ | |
362 | + (option) == CURLOPT_INTERLEAVEDATA || \ | |
363 | + (option) == CURLOPT_IOCTLDATA || \ | |
364 | + (option) == CURLOPT_OPENSOCKETDATA || \ | |
365 | + (option) == CURLOPT_PROGRESSDATA || \ | |
366 | + (option) == CURLOPT_READDATA || \ | |
367 | + (option) == CURLOPT_SEEKDATA || \ | |
368 | + (option) == CURLOPT_SOCKOPTDATA || \ | |
369 | + (option) == CURLOPT_SSH_KEYDATA || \ | |
370 | + (option) == CURLOPT_SSL_CTX_DATA || \ | |
371 | + (option) == CURLOPT_WRITEDATA || \ | |
372 | + (option) == CURLOPT_RESOLVER_START_DATA || \ | |
373 | + (option) == CURLOPT_TRAILERDATA || \ | |
374 | + 0) | |
375 | + | |
376 | +/* evaluates to true if option takes a POST data argument (void* or char*) */ | |
377 | +#define curlcheck_postfields_option(option) \ | |
378 | + ((option) == CURLOPT_POSTFIELDS || \ | |
379 | + (option) == CURLOPT_COPYPOSTFIELDS || \ | |
380 | + 0) | |
381 | + | |
382 | +/* evaluates to true if option takes a struct curl_slist * argument */ | |
383 | +#define curlcheck_slist_option(option) \ | |
384 | + ((option) == CURLOPT_HTTP200ALIASES || \ | |
385 | + (option) == CURLOPT_HTTPHEADER || \ | |
386 | + (option) == CURLOPT_MAIL_RCPT || \ | |
387 | + (option) == CURLOPT_POSTQUOTE || \ | |
388 | + (option) == CURLOPT_PREQUOTE || \ | |
389 | + (option) == CURLOPT_PROXYHEADER || \ | |
390 | + (option) == CURLOPT_QUOTE || \ | |
391 | + (option) == CURLOPT_RESOLVE || \ | |
392 | + (option) == CURLOPT_TELNETOPTIONS || \ | |
393 | + (option) == CURLOPT_CONNECT_TO || \ | |
394 | + 0) | |
395 | + | |
396 | +/* groups of curl_easy_getinfo infos that take the same type of argument */ | |
397 | + | |
398 | +/* evaluates to true if info expects a pointer to char * argument */ | |
399 | +#define curlcheck_string_info(info) \ | |
400 | + (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \ | |
401 | + (info) != CURLINFO_PRIVATE) | |
402 | + | |
403 | +/* evaluates to true if info expects a pointer to long argument */ | |
404 | +#define curlcheck_long_info(info) \ | |
405 | + (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) | |
406 | + | |
407 | +/* evaluates to true if info expects a pointer to double argument */ | |
408 | +#define curlcheck_double_info(info) \ | |
409 | + (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) | |
410 | + | |
411 | +/* true if info expects a pointer to struct curl_slist * argument */ | |
412 | +#define curlcheck_slist_info(info) \ | |
413 | + (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST)) | |
414 | + | |
415 | +/* true if info expects a pointer to struct curl_tlssessioninfo * argument */ | |
416 | +#define curlcheck_tlssessioninfo_info(info) \ | |
417 | + (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION)) | |
418 | + | |
419 | +/* true if info expects a pointer to struct curl_certinfo * argument */ | |
420 | +#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO) | |
421 | + | |
422 | +/* true if info expects a pointer to struct curl_socket_t argument */ | |
423 | +#define curlcheck_socket_info(info) \ | |
424 | + (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T) | |
425 | + | |
426 | +/* true if info expects a pointer to curl_off_t argument */ | |
427 | +#define curlcheck_off_t_info(info) \ | |
428 | + (CURLINFO_OFF_T < (info)) | |
429 | + | |
430 | + | |
431 | +/* typecheck helpers -- check whether given expression has requested type*/ | |
432 | + | |
433 | +/* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros, | |
434 | + * otherwise define a new macro. Search for __builtin_types_compatible_p | |
435 | + * in the GCC manual. | |
436 | + * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is | |
437 | + * the actual expression passed to the curl_easy_setopt macro. This | |
438 | + * means that you can only apply the sizeof and __typeof__ operators, no | |
439 | + * == or whatsoever. | |
440 | + */ | |
441 | + | |
442 | +/* XXX: should evaluate to true if expr is a pointer */ | |
443 | +#define curlcheck_any_ptr(expr) \ | |
444 | + (sizeof(expr) == sizeof(void *)) | |
445 | + | |
446 | +/* evaluates to true if expr is NULL */ | |
447 | +/* XXX: must not evaluate expr, so this check is not accurate */ | |
448 | +#define curlcheck_NULL(expr) \ | |
449 | + (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) | |
450 | + | |
451 | +/* evaluates to true if expr is type*, const type* or NULL */ | |
452 | +#define curlcheck_ptr(expr, type) \ | |
453 | + (curlcheck_NULL(expr) || \ | |
454 | + __builtin_types_compatible_p(__typeof__(expr), type *) || \ | |
455 | + __builtin_types_compatible_p(__typeof__(expr), const type *)) | |
456 | + | |
457 | +/* evaluates to true if expr is one of type[], type*, NULL or const type* */ | |
458 | +#define curlcheck_arr(expr, type) \ | |
459 | + (curlcheck_ptr((expr), type) || \ | |
460 | + __builtin_types_compatible_p(__typeof__(expr), type [])) | |
461 | + | |
462 | +/* evaluates to true if expr is a string */ | |
463 | +#define curlcheck_string(expr) \ | |
464 | + (curlcheck_arr((expr), char) || \ | |
465 | + curlcheck_arr((expr), signed char) || \ | |
466 | + curlcheck_arr((expr), unsigned char)) | |
467 | + | |
468 | +/* evaluates to true if expr is a long (no matter the signedness) | |
469 | + * XXX: for now, int is also accepted (and therefore short and char, which | |
470 | + * are promoted to int when passed to a variadic function) */ | |
471 | +#define curlcheck_long(expr) \ | |
472 | + (__builtin_types_compatible_p(__typeof__(expr), long) || \ | |
473 | + __builtin_types_compatible_p(__typeof__(expr), signed long) || \ | |
474 | + __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ | |
475 | + __builtin_types_compatible_p(__typeof__(expr), int) || \ | |
476 | + __builtin_types_compatible_p(__typeof__(expr), signed int) || \ | |
477 | + __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ | |
478 | + __builtin_types_compatible_p(__typeof__(expr), short) || \ | |
479 | + __builtin_types_compatible_p(__typeof__(expr), signed short) || \ | |
480 | + __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ | |
481 | + __builtin_types_compatible_p(__typeof__(expr), char) || \ | |
482 | + __builtin_types_compatible_p(__typeof__(expr), signed char) || \ | |
483 | + __builtin_types_compatible_p(__typeof__(expr), unsigned char)) | |
484 | + | |
485 | +/* evaluates to true if expr is of type curl_off_t */ | |
486 | +#define curlcheck_off_t(expr) \ | |
487 | + (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) | |
488 | + | |
489 | +/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ | |
490 | +/* XXX: also check size of an char[] array? */ | |
491 | +#define curlcheck_error_buffer(expr) \ | |
492 | + (curlcheck_NULL(expr) || \ | |
493 | + __builtin_types_compatible_p(__typeof__(expr), char *) || \ | |
494 | + __builtin_types_compatible_p(__typeof__(expr), char[])) | |
495 | + | |
496 | +/* evaluates to true if expr is of type (const) void* or (const) FILE* */ | |
497 | +#if 0 | |
498 | +#define curlcheck_cb_data(expr) \ | |
499 | + (curlcheck_ptr((expr), void) || \ | |
500 | + curlcheck_ptr((expr), FILE)) | |
501 | +#else /* be less strict */ | |
502 | +#define curlcheck_cb_data(expr) \ | |
503 | + curlcheck_any_ptr(expr) | |
504 | +#endif | |
505 | + | |
506 | +/* evaluates to true if expr is of type FILE* */ | |
507 | +#define curlcheck_FILE(expr) \ | |
508 | + (curlcheck_NULL(expr) || \ | |
509 | + (__builtin_types_compatible_p(__typeof__(expr), FILE *))) | |
510 | + | |
511 | +/* evaluates to true if expr can be passed as POST data (void* or char*) */ | |
512 | +#define curlcheck_postfields(expr) \ | |
513 | + (curlcheck_ptr((expr), void) || \ | |
514 | + curlcheck_arr((expr), char) || \ | |
515 | + curlcheck_arr((expr), unsigned char)) | |
516 | + | |
517 | +/* helper: __builtin_types_compatible_p distinguishes between functions and | |
518 | + * function pointers, hide it */ | |
519 | +#define curlcheck_cb_compatible(func, type) \ | |
520 | + (__builtin_types_compatible_p(__typeof__(func), type) || \ | |
521 | + __builtin_types_compatible_p(__typeof__(func) *, type)) | |
522 | + | |
523 | +/* evaluates to true if expr is of type curl_resolver_start_callback */ | |
524 | +#define curlcheck_resolver_start_callback(expr) \ | |
525 | + (curlcheck_NULL(expr) || \ | |
526 | + curlcheck_cb_compatible((expr), curl_resolver_start_callback)) | |
527 | + | |
528 | +/* evaluates to true if expr is of type curl_read_callback or "similar" */ | |
529 | +#define curlcheck_read_cb(expr) \ | |
530 | + (curlcheck_NULL(expr) || \ | |
531 | + curlcheck_cb_compatible((expr), __typeof__(fread) *) || \ | |
532 | + curlcheck_cb_compatible((expr), curl_read_callback) || \ | |
533 | + curlcheck_cb_compatible((expr), _curl_read_callback1) || \ | |
534 | + curlcheck_cb_compatible((expr), _curl_read_callback2) || \ | |
535 | + curlcheck_cb_compatible((expr), _curl_read_callback3) || \ | |
536 | + curlcheck_cb_compatible((expr), _curl_read_callback4) || \ | |
537 | + curlcheck_cb_compatible((expr), _curl_read_callback5) || \ | |
538 | + curlcheck_cb_compatible((expr), _curl_read_callback6)) | |
539 | +typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *); | |
540 | +typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *); | |
541 | +typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *); | |
542 | +typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *); | |
543 | +typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *); | |
544 | +typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *); | |
545 | + | |
546 | +/* evaluates to true if expr is of type curl_write_callback or "similar" */ | |
547 | +#define curlcheck_write_cb(expr) \ | |
548 | + (curlcheck_read_cb(expr) || \ | |
549 | + curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \ | |
550 | + curlcheck_cb_compatible((expr), curl_write_callback) || \ | |
551 | + curlcheck_cb_compatible((expr), _curl_write_callback1) || \ | |
552 | + curlcheck_cb_compatible((expr), _curl_write_callback2) || \ | |
553 | + curlcheck_cb_compatible((expr), _curl_write_callback3) || \ | |
554 | + curlcheck_cb_compatible((expr), _curl_write_callback4) || \ | |
555 | + curlcheck_cb_compatible((expr), _curl_write_callback5) || \ | |
556 | + curlcheck_cb_compatible((expr), _curl_write_callback6)) | |
557 | +typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *); | |
558 | +typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t, | |
559 | + const void *); | |
560 | +typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *); | |
561 | +typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *); | |
562 | +typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t, | |
563 | + const void *); | |
564 | +typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *); | |
565 | + | |
566 | +/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ | |
567 | +#define curlcheck_ioctl_cb(expr) \ | |
568 | + (curlcheck_NULL(expr) || \ | |
569 | + curlcheck_cb_compatible((expr), curl_ioctl_callback) || \ | |
570 | + curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \ | |
571 | + curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \ | |
572 | + curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \ | |
573 | + curlcheck_cb_compatible((expr), _curl_ioctl_callback4)) | |
574 | +typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *); | |
575 | +typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *); | |
576 | +typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *); | |
577 | +typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *); | |
578 | + | |
579 | +/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ | |
580 | +#define curlcheck_sockopt_cb(expr) \ | |
581 | + (curlcheck_NULL(expr) || \ | |
582 | + curlcheck_cb_compatible((expr), curl_sockopt_callback) || \ | |
583 | + curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \ | |
584 | + curlcheck_cb_compatible((expr), _curl_sockopt_callback2)) | |
585 | +typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); | |
586 | +typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t, | |
587 | + curlsocktype); | |
588 | + | |
589 | +/* evaluates to true if expr is of type curl_opensocket_callback or | |
590 | + "similar" */ | |
591 | +#define curlcheck_opensocket_cb(expr) \ | |
592 | + (curlcheck_NULL(expr) || \ | |
593 | + curlcheck_cb_compatible((expr), curl_opensocket_callback) || \ | |
594 | + curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \ | |
595 | + curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \ | |
596 | + curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \ | |
597 | + curlcheck_cb_compatible((expr), _curl_opensocket_callback4)) | |
598 | +typedef curl_socket_t (*_curl_opensocket_callback1) | |
599 | + (void *, curlsocktype, struct curl_sockaddr *); | |
600 | +typedef curl_socket_t (*_curl_opensocket_callback2) | |
601 | + (void *, curlsocktype, const struct curl_sockaddr *); | |
602 | +typedef curl_socket_t (*_curl_opensocket_callback3) | |
603 | + (const void *, curlsocktype, struct curl_sockaddr *); | |
604 | +typedef curl_socket_t (*_curl_opensocket_callback4) | |
605 | + (const void *, curlsocktype, const struct curl_sockaddr *); | |
606 | + | |
607 | +/* evaluates to true if expr is of type curl_progress_callback or "similar" */ | |
608 | +#define curlcheck_progress_cb(expr) \ | |
609 | + (curlcheck_NULL(expr) || \ | |
610 | + curlcheck_cb_compatible((expr), curl_progress_callback) || \ | |
611 | + curlcheck_cb_compatible((expr), _curl_progress_callback1) || \ | |
612 | + curlcheck_cb_compatible((expr), _curl_progress_callback2)) | |
613 | +typedef int (*_curl_progress_callback1)(void *, | |
614 | + double, double, double, double); | |
615 | +typedef int (*_curl_progress_callback2)(const void *, | |
616 | + double, double, double, double); | |
617 | + | |
618 | +/* evaluates to true if expr is of type curl_debug_callback or "similar" */ | |
619 | +#define curlcheck_debug_cb(expr) \ | |
620 | + (curlcheck_NULL(expr) || \ | |
621 | + curlcheck_cb_compatible((expr), curl_debug_callback) || \ | |
622 | + curlcheck_cb_compatible((expr), _curl_debug_callback1) || \ | |
623 | + curlcheck_cb_compatible((expr), _curl_debug_callback2) || \ | |
624 | + curlcheck_cb_compatible((expr), _curl_debug_callback3) || \ | |
625 | + curlcheck_cb_compatible((expr), _curl_debug_callback4) || \ | |
626 | + curlcheck_cb_compatible((expr), _curl_debug_callback5) || \ | |
627 | + curlcheck_cb_compatible((expr), _curl_debug_callback6) || \ | |
628 | + curlcheck_cb_compatible((expr), _curl_debug_callback7) || \ | |
629 | + curlcheck_cb_compatible((expr), _curl_debug_callback8)) | |
630 | +typedef int (*_curl_debug_callback1) (CURL *, | |
631 | + curl_infotype, char *, size_t, void *); | |
632 | +typedef int (*_curl_debug_callback2) (CURL *, | |
633 | + curl_infotype, char *, size_t, const void *); | |
634 | +typedef int (*_curl_debug_callback3) (CURL *, | |
635 | + curl_infotype, const char *, size_t, void *); | |
636 | +typedef int (*_curl_debug_callback4) (CURL *, | |
637 | + curl_infotype, const char *, size_t, const void *); | |
638 | +typedef int (*_curl_debug_callback5) (CURL *, | |
639 | + curl_infotype, unsigned char *, size_t, void *); | |
640 | +typedef int (*_curl_debug_callback6) (CURL *, | |
641 | + curl_infotype, unsigned char *, size_t, const void *); | |
642 | +typedef int (*_curl_debug_callback7) (CURL *, | |
643 | + curl_infotype, const unsigned char *, size_t, void *); | |
644 | +typedef int (*_curl_debug_callback8) (CURL *, | |
645 | + curl_infotype, const unsigned char *, size_t, const void *); | |
646 | + | |
647 | +/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ | |
648 | +/* this is getting even messier... */ | |
649 | +#define curlcheck_ssl_ctx_cb(expr) \ | |
650 | + (curlcheck_NULL(expr) || \ | |
651 | + curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \ | |
652 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \ | |
653 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \ | |
654 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \ | |
655 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \ | |
656 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \ | |
657 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \ | |
658 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \ | |
659 | + curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8)) | |
660 | +typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *); | |
661 | +typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *); | |
662 | +typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *); | |
663 | +typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *, | |
664 | + const void *); | |
665 | +#ifdef HEADER_SSL_H | |
666 | +/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX | |
667 | + * this will of course break if we're included before OpenSSL headers... | |
668 | + */ | |
669 | +typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); | |
670 | +typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); | |
671 | +typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); | |
672 | +typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, | |
673 | + const void *); | |
674 | +#else | |
675 | +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; | |
676 | +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; | |
677 | +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; | |
678 | +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; | |
679 | +#endif | |
680 | + | |
681 | +/* evaluates to true if expr is of type curl_conv_callback or "similar" */ | |
682 | +#define curlcheck_conv_cb(expr) \ | |
683 | + (curlcheck_NULL(expr) || \ | |
684 | + curlcheck_cb_compatible((expr), curl_conv_callback) || \ | |
685 | + curlcheck_cb_compatible((expr), _curl_conv_callback1) || \ | |
686 | + curlcheck_cb_compatible((expr), _curl_conv_callback2) || \ | |
687 | + curlcheck_cb_compatible((expr), _curl_conv_callback3) || \ | |
688 | + curlcheck_cb_compatible((expr), _curl_conv_callback4)) | |
689 | +typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); | |
690 | +typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); | |
691 | +typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); | |
692 | +typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); | |
693 | + | |
694 | +/* evaluates to true if expr is of type curl_seek_callback or "similar" */ | |
695 | +#define curlcheck_seek_cb(expr) \ | |
696 | + (curlcheck_NULL(expr) || \ | |
697 | + curlcheck_cb_compatible((expr), curl_seek_callback) || \ | |
698 | + curlcheck_cb_compatible((expr), _curl_seek_callback1) || \ | |
699 | + curlcheck_cb_compatible((expr), _curl_seek_callback2)) | |
700 | +typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); | |
701 | +typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); | |
702 | + | |
703 | + | |
704 | +#endif /* CURLINC_TYPECHECK_GCC_H */ |
@@ -0,0 +1,125 @@ | ||
1 | +#ifndef CURLINC_URLAPI_H | |
2 | +#define CURLINC_URLAPI_H | |
3 | +/*************************************************************************** | |
4 | + * _ _ ____ _ | |
5 | + * Project ___| | | | _ \| | | |
6 | + * / __| | | | |_) | | | |
7 | + * | (__| |_| | _ <| |___ | |
8 | + * \___|\___/|_| \_\_____| | |
9 | + * | |
10 | + * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html. | |
15 | + * | |
16 | + * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
17 | + * copies of the Software, and permit persons to whom the Software is | |
18 | + * furnished to do so, under the terms of the COPYING file. | |
19 | + * | |
20 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
21 | + * KIND, either express or implied. | |
22 | + * | |
23 | + ***************************************************************************/ | |
24 | + | |
25 | +#include "curl.h" | |
26 | + | |
27 | +#ifdef __cplusplus | |
28 | +extern "C" { | |
29 | +#endif | |
30 | + | |
31 | +/* the error codes for the URL API */ | |
32 | +typedef enum { | |
33 | + CURLUE_OK, | |
34 | + CURLUE_BAD_HANDLE, /* 1 */ | |
35 | + CURLUE_BAD_PARTPOINTER, /* 2 */ | |
36 | + CURLUE_MALFORMED_INPUT, /* 3 */ | |
37 | + CURLUE_BAD_PORT_NUMBER, /* 4 */ | |
38 | + CURLUE_UNSUPPORTED_SCHEME, /* 5 */ | |
39 | + CURLUE_URLDECODE, /* 6 */ | |
40 | + CURLUE_OUT_OF_MEMORY, /* 7 */ | |
41 | + CURLUE_USER_NOT_ALLOWED, /* 8 */ | |
42 | + CURLUE_UNKNOWN_PART, /* 9 */ | |
43 | + CURLUE_NO_SCHEME, /* 10 */ | |
44 | + CURLUE_NO_USER, /* 11 */ | |
45 | + CURLUE_NO_PASSWORD, /* 12 */ | |
46 | + CURLUE_NO_OPTIONS, /* 13 */ | |
47 | + CURLUE_NO_HOST, /* 14 */ | |
48 | + CURLUE_NO_PORT, /* 15 */ | |
49 | + CURLUE_NO_QUERY, /* 16 */ | |
50 | + CURLUE_NO_FRAGMENT /* 17 */ | |
51 | +} CURLUcode; | |
52 | + | |
53 | +typedef enum { | |
54 | + CURLUPART_URL, | |
55 | + CURLUPART_SCHEME, | |
56 | + CURLUPART_USER, | |
57 | + CURLUPART_PASSWORD, | |
58 | + CURLUPART_OPTIONS, | |
59 | + CURLUPART_HOST, | |
60 | + CURLUPART_PORT, | |
61 | + CURLUPART_PATH, | |
62 | + CURLUPART_QUERY, | |
63 | + CURLUPART_FRAGMENT, | |
64 | + CURLUPART_ZONEID /* added in 7.65.0 */ | |
65 | +} CURLUPart; | |
66 | + | |
67 | +#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ | |
68 | +#define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, | |
69 | + if the port number matches the | |
70 | + default for the scheme */ | |
71 | +#define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if | |
72 | + missing */ | |
73 | +#define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ | |
74 | +#define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ | |
75 | +#define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ | |
76 | +#define CURLU_URLDECODE (1<<6) /* URL decode on get */ | |
77 | +#define CURLU_URLENCODE (1<<7) /* URL encode on set */ | |
78 | +#define CURLU_APPENDQUERY (1<<8) /* append a form style part */ | |
79 | +#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ | |
80 | +#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the | |
81 | + scheme is unknown. */ | |
82 | + | |
83 | +typedef struct Curl_URL CURLU; | |
84 | + | |
85 | +/* | |
86 | + * curl_url() creates a new CURLU handle and returns a pointer to it. | |
87 | + * Must be freed with curl_url_cleanup(). | |
88 | + */ | |
89 | +CURL_EXTERN CURLU *curl_url(void); | |
90 | + | |
91 | +/* | |
92 | + * curl_url_cleanup() frees the CURLU handle and related resources used for | |
93 | + * the URL parsing. It will not free strings previously returned with the URL | |
94 | + * API. | |
95 | + */ | |
96 | +CURL_EXTERN void curl_url_cleanup(CURLU *handle); | |
97 | + | |
98 | +/* | |
99 | + * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new | |
100 | + * handle must also be freed with curl_url_cleanup(). | |
101 | + */ | |
102 | +CURL_EXTERN CURLU *curl_url_dup(CURLU *in); | |
103 | + | |
104 | +/* | |
105 | + * curl_url_get() extracts a specific part of the URL from a CURLU | |
106 | + * handle. Returns error code. The returned pointer MUST be freed with | |
107 | + * curl_free() afterwards. | |
108 | + */ | |
109 | +CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, | |
110 | + char **part, unsigned int flags); | |
111 | + | |
112 | +/* | |
113 | + * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns | |
114 | + * error code. The passed in string will be copied. Passing a NULL instead of | |
115 | + * a part string, clears that part. | |
116 | + */ | |
117 | +CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, | |
118 | + const char *part, unsigned int flags); | |
119 | + | |
120 | + | |
121 | +#ifdef __cplusplus | |
122 | +} /* end of extern "C" */ | |
123 | +#endif | |
124 | + | |
125 | +#endif /* CURLINC_URLAPI_H */ |
@@ -56,7 +56,7 @@ AC_ARG_ENABLE(fontset, | ||
56 | 56 | AC_ARG_ENABLE([xft], |
57 | 57 | AS_HELP_STRING([--enable-xft], [Enable xft support])) |
58 | 58 | AC_ARG_ENABLE(worldscore, |
59 | -[ --disable-worldscore disable worldscore support], ,AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server])) | |
59 | +[ --disable-worldscore disable worldscore support], worldscore=no, AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server])) | |
60 | 60 | AC_ARG_ENABLE(chuukei, |
61 | 61 | [ --enable-chuukei enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode])) |
62 | 62 |
@@ -77,6 +77,10 @@ AC_CHECK_LIB(iconv, iconv_open) | ||
77 | 77 | |
78 | 78 | AC_CHECK_FILE(/dev/urandom, AC_DEFINE(RNG_DEVICE, "/dev/urandom", [Random Number Generation device file])) |
79 | 79 | |
80 | +if test "$worldscore" != no; then | |
81 | + PKG_CHECK_MODULES(libcurl, [libcurl]) | |
82 | +fi | |
83 | + | |
80 | 84 | dnl Checks for header files. |
81 | 85 | AC_PATH_XTRA |
82 | 86 | if test "$have_x" = yes; then |
@@ -900,8 +900,8 @@ EXTRA_DIST = \ | ||
900 | 900 | gcc-wrap |
901 | 901 | |
902 | 902 | DEFAULT_INCLUDES = -I$(srcdir) -I$(top_builddir)/src |
903 | -CFLAGS += $(XFT_CFLAGS) | |
904 | -LIBS += $(XFT_LIBS) | |
903 | +CFLAGS += $(XFT_CFLAGS) $(libcurl_CFLAGS) | |
904 | +LIBS += $(XFT_LIBS) $(libcurl_LIBS) | |
905 | 905 | COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ |
906 | 906 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
907 | 907 |
@@ -30,32 +30,21 @@ | ||
30 | 30 | #include "world/world.h" |
31 | 31 | |
32 | 32 | #ifdef WORLD_SCORE |
33 | + | |
33 | 34 | #ifdef WINDOWS |
34 | -#include <winsock.h> | |
35 | -#else | |
36 | -#include <netdb.h> | |
37 | -#include <netinet/in.h> | |
38 | -#include <sys/socket.h> | |
39 | -#include <sys/time.h> | |
40 | -#include <sys/types.h> | |
41 | - | |
42 | -#include <setjmp.h> | |
43 | -#include <signal.h> | |
35 | +#define CURL_STATICLIB | |
44 | 36 | #endif |
37 | +#include <curl/curl.h> | |
45 | 38 | |
46 | 39 | concptr screen_dump = NULL; |
47 | 40 | |
48 | 41 | /* |
49 | 42 | * internet resource value |
50 | 43 | */ |
51 | -#define HTTP_PROXY "" /*!< デフォルトのプロキシURL / Default proxy url */ | |
52 | -#define HTTP_PROXY_PORT 0 /*!< デフォルトのプロキシポート / Default proxy port */ | |
53 | -#define HTTP_TIMEOUT 20 /*!< デフォルトのタイムアウト時間(秒) / Timeout length (second) */ | |
54 | -#define SCORE_SERVER "hengband.osdn.jp" /*!< デフォルトのスコアサーバURL / Default score server url */ | |
55 | -#define SCORE_PORT 80 /*!< デフォルトのスコアサーバポート / Default score server port */ | |
44 | +#define HTTP_TIMEOUT 30 /*!< デフォルトのタイムアウト時間(秒) / Timeout length (second) */ | |
56 | 45 | |
57 | 46 | #ifdef JP |
58 | -#define SCORE_PATH "http://hengband.osdn.jp/score/register_score.php" /*!< スコア開示URL */ | |
47 | +#define SCORE_PATH "https://hengband.osdn.jp/score/register_score.php" /*!< スコア開示URL */ | |
59 | 48 | #else |
60 | 49 | #define SCORE_PATH "http://moon.kmc.gr.jp/hengband/hengscore-en/score.cgi" /*!< スコア開示URL */ |
61 | 50 | #endif |
@@ -66,6 +55,7 @@ concptr screen_dump = NULL; | ||
66 | 55 | typedef struct { |
67 | 56 | size_t max_size; |
68 | 57 | size_t size; |
58 | + size_t read_head; | |
69 | 59 | char *data; |
70 | 60 | } BUF; |
71 | 61 |
@@ -157,43 +147,83 @@ static int buf_sprintf(BUF *buf, concptr fmt, ...) | ||
157 | 147 | return ret; |
158 | 148 | } |
159 | 149 | |
150 | +size_t read_callback(char *buffer, size_t size, size_t nitems, void *userdata) | |
151 | +{ | |
152 | + BUF *buf = userdata; | |
153 | + const size_t remain = buf->size - buf->read_head; | |
154 | + const size_t copy_size = MIN(size * nitems, remain); | |
155 | + | |
156 | + strncpy(buffer, buf->data + buf->read_head, copy_size); | |
157 | + buf->read_head += copy_size; | |
158 | + | |
159 | + return copy_size; | |
160 | +} | |
161 | + | |
160 | 162 | /*! |
161 | 163 | * @brief HTTPによるダンプ内容伝送 |
162 | - * @param sd ソケットID | |
163 | 164 | * @param url 伝送先URL |
164 | 165 | * @param buf 伝送内容バッファ |
165 | - * @return なし | |
166 | + * @return 送信に成功した場合TRUE、失敗した場合FALSE | |
166 | 167 | */ |
167 | -static bool http_post(int sd, concptr url, BUF *buf) | |
168 | +static bool http_post(concptr url, BUF *buf) | |
168 | 169 | { |
169 | - BUF *output; | |
170 | - char response_buf[1024] = ""; | |
171 | - concptr HTTP_RESPONSE_CODE_OK = "HTTP/1.1 200 OK"; | |
172 | - | |
173 | - output = buf_new(); | |
174 | - buf_sprintf(output, "POST %s HTTP/1.0\r\n", url); | |
175 | - buf_sprintf(output, "User-Agent: Hengband %d.%d.%d.%d\r\n", FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA); | |
170 | + bool succeeded = FALSE; | |
171 | + CURL *curl = curl_easy_init(); | |
172 | + if (curl == NULL) { | |
173 | + return FALSE; | |
174 | + } | |
176 | 175 | |
177 | - buf_sprintf(output, "Content-Length: %d\r\n", buf->size); | |
178 | - buf_sprintf(output, "Content-Encoding: binary\r\n"); | |
176 | + struct curl_slist *slist = NULL; | |
177 | + slist = curl_slist_append(slist, | |
179 | 178 | #ifdef JP |
180 | 179 | #ifdef SJIS |
181 | - buf_sprintf(output, "Content-Type: text/plain; charset=SHIFT_JIS\r\n"); | |
180 | + "Content-Type: text/plain; charset=SHIFT_JIS" | |
182 | 181 | #endif |
183 | 182 | #ifdef EUC |
184 | - buf_sprintf(output, "Content-Type: text/plain; charset=EUC-JP\r\n"); | |
183 | + "Content-Type: text/plain; charset=EUC-JP" | |
185 | 184 | #endif |
186 | 185 | #else |
187 | - buf_sprintf(output, "Content-Type: text/plain; charset=ASCII\r\n"); | |
186 | + "Content-Type: text/plain; charset=ASCII" | |
188 | 187 | #endif |
189 | - buf_sprintf(output, "\r\n"); | |
190 | - buf_append(output, buf->data, buf->size); | |
188 | + ); | |
189 | + | |
190 | + curl_easy_setopt(curl, CURLOPT_URL, url); | |
191 | + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist); | |
192 | + | |
193 | + char user_agent[64]; | |
194 | + snprintf(user_agent, sizeof(user_agent), "Hengband %d.%d.%d", FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH); | |
195 | + curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent); | |
196 | + | |
197 | + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); | |
198 | + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); | |
199 | + | |
200 | + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); | |
201 | + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, HTTP_TIMEOUT); | |
202 | + curl_easy_setopt(curl, CURLOPT_TIMEOUT, HTTP_TIMEOUT); | |
203 | + | |
204 | + curl_easy_setopt(curl, CURLOPT_POST, 1); | |
205 | + | |
206 | + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); | |
207 | + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10); | |
208 | + curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); | |
209 | + | |
210 | + buf->read_head = 0; | |
211 | + curl_easy_setopt(curl, CURLOPT_READDATA, buf); | |
212 | + curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); | |
213 | + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, buf->size); | |
191 | 214 | |
192 | - soc_write(sd, output->data, output->size); | |
215 | + if (curl_easy_perform(curl) == CURLE_OK) { | |
216 | + long response_code; | |
217 | + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code); | |
218 | + if (response_code == 200) { | |
219 | + succeeded = TRUE; | |
220 | + } | |
221 | + } | |
193 | 222 | |
194 | - soc_read(sd, response_buf, sizeof(response_buf)); | |
223 | + curl_slist_free_all(slist); | |
224 | + curl_easy_cleanup(curl); | |
195 | 225 | |
196 | - return strncmp(response_buf, HTTP_RESPONSE_CODE_OK, strlen(HTTP_RESPONSE_CODE_OK)) == 0; | |
226 | + return succeeded; | |
197 | 227 | } |
198 | 228 | |
199 | 229 | /*! |
@@ -373,11 +403,6 @@ concptr make_screen_dump(player_type *creature_ptr, void (*process_autopick_file | ||
373 | 403 | */ |
374 | 404 | errr report_score(player_type *creature_ptr, void (*update_playtime)(void), display_player_pf display_player) |
375 | 405 | { |
376 | -#ifdef WINDOWS | |
377 | - WSADATA wsaData; | |
378 | - WORD wVersionRequested = (WORD)((1) | (1 << 8)); | |
379 | -#endif | |
380 | - | |
381 | 406 | BUF *score; |
382 | 407 | score = buf_new(); |
383 | 408 |
@@ -415,98 +440,29 @@ errr report_score(player_type *creature_ptr, void (*update_playtime)(void), disp | ||
415 | 440 | buf_append(score, screen_dump, strlen(screen_dump)); |
416 | 441 | } |
417 | 442 | |
418 | -#ifdef WINDOWS | |
419 | - if (WSAStartup(wVersionRequested, &wsaData)) { | |
420 | - msg_print("Report: WSAStartup failed."); | |
421 | -#ifdef WINDOWS | |
422 | - WSACleanup(); | |
423 | -#endif | |
424 | - return 1; | |
425 | - } | |
426 | -#endif | |
427 | - | |
428 | 443 | term_clear(); |
429 | 444 | |
430 | - int sd; | |
431 | - while (TRUE) { | |
432 | - char buff[160]; | |
433 | -#ifdef JP | |
434 | - prt("接続中...", 0, 0); | |
435 | -#else | |
436 | - prt("connecting...", 0, 0); | |
437 | -#endif | |
445 | + bool succeeded = FALSE; | |
446 | + while (!succeeded) { | |
438 | 447 | term_fresh(); |
439 | 448 | |
440 | - /* プロキシを設定する */ | |
441 | - set_proxy(HTTP_PROXY, HTTP_PROXY_PORT); | |
442 | - | |
443 | - /* Connect to the score server */ | |
444 | - sd = connect_server(HTTP_TIMEOUT, SCORE_SERVER, SCORE_PORT); | |
445 | - | |
446 | - if (sd < 0) { | |
447 | -#ifdef JP | |
448 | - sprintf(buff, "スコア・サーバへの接続に失敗しました。(%s)", soc_err()); | |
449 | -#else | |
450 | - sprintf(buff, "Failed to connect to the score server.(%s)", soc_err()); | |
451 | -#endif | |
452 | - prt(buff, 0, 0); | |
453 | - (void)inkey(); | |
454 | - | |
455 | -#ifdef JP | |
456 | - if (!get_check_strict(creature_ptr, "もう一度接続を試みますか? ", CHECK_NO_HISTORY)) | |
457 | -#else | |
458 | - if (!get_check_strict(creature_ptr, "Try again? ", CHECK_NO_HISTORY)) | |
459 | -#endif | |
460 | - { | |
461 | -#ifdef WINDOWS | |
462 | - WSACleanup(); | |
463 | -#endif | |
464 | - return 1; | |
465 | - } | |
466 | - | |
467 | - continue; | |
468 | - } | |
469 | - | |
470 | -#ifdef JP | |
471 | - prt("スコア送信中...", 0, 0); | |
472 | -#else | |
473 | - prt("Sending the score...", 0, 0); | |
474 | -#endif | |
449 | + prt(_("スコア送信中...", "Sending the score..."), 0, 0); | |
475 | 450 | term_fresh(); |
476 | 451 | |
477 | - if (!http_post(sd, SCORE_PATH, score)) { | |
478 | - disconnect_server(sd); | |
479 | -#ifdef JP | |
480 | - sprintf(buff, "スコア・サーバへの送信に失敗しました。"); | |
481 | -#else | |
482 | - sprintf(buff, "Failed to send to the score server."); | |
483 | -#endif | |
484 | - prt(buff, 0, 0); | |
452 | + if (http_post(SCORE_PATH, score)) { | |
453 | + succeeded = TRUE; | |
454 | + } else { | |
455 | + prt(_("スコア・サーバへの送信に失敗しました。", "Failed to send to the score server."), 0, 0); | |
485 | 456 | (void)inkey(); |
486 | 457 | |
487 | -#ifdef JP | |
488 | - if (!get_check_strict(creature_ptr, "もう一度接続を試みますか? ", CHECK_NO_HISTORY)) | |
489 | -#else | |
490 | - if (!get_check_strict(creature_ptr, "Try again? ", CHECK_NO_HISTORY)) | |
491 | -#endif | |
492 | - { | |
493 | -#ifdef WINDOWS | |
494 | - WSACleanup(); | |
495 | -#endif | |
496 | - return 1; | |
458 | + if (!get_check_strict(creature_ptr, _("もう一度接続を試みますか? ", "Try again? "), CHECK_NO_HISTORY)) { | |
459 | + break; | |
497 | 460 | } |
498 | - | |
499 | - continue; | |
500 | 461 | } |
501 | - | |
502 | - disconnect_server(sd); | |
503 | - break; | |
504 | 462 | } |
505 | 463 | |
506 | -#ifdef WINDOWS | |
507 | - WSACleanup(); | |
508 | -#endif | |
464 | + buf_delete(score); | |
509 | 465 | |
510 | - return 0; | |
466 | + return succeeded ? 0 : 1; | |
511 | 467 | } |
512 | -#endif /* WORLD_SCORE */ | |
\ No newline at end of file | ||
468 | +#endif /* WORLD_SCORE */ |