1 | #ifndef HEADER_CURL_URLDATA_H
|
---|
2 | #define HEADER_CURL_URLDATA_H
|
---|
3 | /***************************************************************************
|
---|
4 | * _ _ ____ _
|
---|
5 | * Project ___| | | | _ \| |
|
---|
6 | * / __| | | | |_) | |
|
---|
7 | * | (__| |_| | _ <| |___
|
---|
8 | * \___|\___/|_| \_\_____|
|
---|
9 | *
|
---|
10 | * Copyright (C) Daniel Stenberg, <[email protected]>, 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 | * SPDX-License-Identifier: curl
|
---|
24 | *
|
---|
25 | ***************************************************************************/
|
---|
26 |
|
---|
27 | /* This file is for lib internal stuff */
|
---|
28 |
|
---|
29 | #include "curl_setup.h"
|
---|
30 |
|
---|
31 | #define PORT_FTP 21
|
---|
32 | #define PORT_FTPS 990
|
---|
33 | #define PORT_TELNET 23
|
---|
34 | #define PORT_HTTP 80
|
---|
35 | #define PORT_HTTPS 443
|
---|
36 | #define PORT_DICT 2628
|
---|
37 | #define PORT_LDAP 389
|
---|
38 | #define PORT_LDAPS 636
|
---|
39 | #define PORT_TFTP 69
|
---|
40 | #define PORT_SSH 22
|
---|
41 | #define PORT_IMAP 143
|
---|
42 | #define PORT_IMAPS 993
|
---|
43 | #define PORT_POP3 110
|
---|
44 | #define PORT_POP3S 995
|
---|
45 | #define PORT_SMB 445
|
---|
46 | #define PORT_SMBS 445
|
---|
47 | #define PORT_SMTP 25
|
---|
48 | #define PORT_SMTPS 465 /* sometimes called SSMTP */
|
---|
49 | #define PORT_RTSP 554
|
---|
50 | #define PORT_RTMP 1935
|
---|
51 | #define PORT_RTMPT PORT_HTTP
|
---|
52 | #define PORT_RTMPS PORT_HTTPS
|
---|
53 | #define PORT_GOPHER 70
|
---|
54 | #define PORT_MQTT 1883
|
---|
55 |
|
---|
56 | struct curl_trc_featt;
|
---|
57 |
|
---|
58 | #ifdef USE_WEBSOCKETS
|
---|
59 | /* CURLPROTO_GOPHERS (29) is the highest publicly used protocol bit number,
|
---|
60 | * the rest are internal information. If we use higher bits we only do this on
|
---|
61 | * platforms that have a >= 64 bit type and then we use such a type for the
|
---|
62 | * protocol fields in the protocol handler.
|
---|
63 | */
|
---|
64 | #define CURLPROTO_WS (1<<30)
|
---|
65 | #define CURLPROTO_WSS ((curl_prot_t)1<<31)
|
---|
66 | #else
|
---|
67 | #define CURLPROTO_WS 0
|
---|
68 | #define CURLPROTO_WSS 0
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | /* This should be undefined once we need bit 32 or higher */
|
---|
72 | #define PROTO_TYPE_SMALL
|
---|
73 |
|
---|
74 | #ifndef PROTO_TYPE_SMALL
|
---|
75 | typedef curl_off_t curl_prot_t;
|
---|
76 | #else
|
---|
77 | typedef unsigned int curl_prot_t;
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | /* This mask is for all the old protocols that are provided and defined in the
|
---|
81 | public header and shall exclude protocols added since which are not exposed
|
---|
82 | in the API */
|
---|
83 | #define CURLPROTO_MASK (0x3ffffff)
|
---|
84 |
|
---|
85 | #define DICT_MATCH "/MATCH:"
|
---|
86 | #define DICT_MATCH2 "/M:"
|
---|
87 | #define DICT_MATCH3 "/FIND:"
|
---|
88 | #define DICT_DEFINE "/DEFINE:"
|
---|
89 | #define DICT_DEFINE2 "/D:"
|
---|
90 | #define DICT_DEFINE3 "/LOOKUP:"
|
---|
91 |
|
---|
92 | #define CURL_DEFAULT_USER "anonymous"
|
---|
93 | #define CURL_DEFAULT_PASSWORD "[email protected]"
|
---|
94 |
|
---|
95 | /* Convenience defines for checking protocols or their SSL based version. Each
|
---|
96 | protocol handler should only ever have a single CURLPROTO_ in its protocol
|
---|
97 | field. */
|
---|
98 | #define PROTO_FAMILY_HTTP (CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_WS| \
|
---|
99 | CURLPROTO_WSS)
|
---|
100 | #define PROTO_FAMILY_FTP (CURLPROTO_FTP|CURLPROTO_FTPS)
|
---|
101 | #define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S)
|
---|
102 | #define PROTO_FAMILY_SMB (CURLPROTO_SMB|CURLPROTO_SMBS)
|
---|
103 | #define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
|
---|
104 | #define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
|
---|
105 |
|
---|
106 | #if !defined(CURL_DISABLE_FTP) || defined(USE_SSH) || \
|
---|
107 | !defined(CURL_DISABLE_POP3)
|
---|
108 | /* these protocols support CURLOPT_DIRLISTONLY */
|
---|
109 | #define CURL_LIST_ONLY_PROTOCOL 1
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | #define DEFAULT_CONNCACHE_SIZE 5
|
---|
113 |
|
---|
114 | /* length of longest IPv6 address string including the trailing null */
|
---|
115 | #define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")
|
---|
116 |
|
---|
117 | /* Default FTP/IMAP etc response timeout in milliseconds */
|
---|
118 | #define RESP_TIMEOUT (120*1000)
|
---|
119 |
|
---|
120 | /* Max string input length is a precaution against abuse and to detect junk
|
---|
121 | input easier and better. */
|
---|
122 | #define CURL_MAX_INPUT_LENGTH 8000000
|
---|
123 |
|
---|
124 |
|
---|
125 | #include "cookie.h"
|
---|
126 | #include "psl.h"
|
---|
127 | #include "formdata.h"
|
---|
128 |
|
---|
129 | #ifdef HAVE_NETINET_IN_H
|
---|
130 | #include <netinet/in.h>
|
---|
131 | #endif
|
---|
132 | #ifdef HAVE_NETINET_IN6_H
|
---|
133 | #include <netinet/in6.h>
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | #include "timeval.h"
|
---|
137 |
|
---|
138 | #include <curl/curl.h>
|
---|
139 |
|
---|
140 | #include "http_chunks.h" /* for the structs and enum stuff */
|
---|
141 | #include "hostip.h"
|
---|
142 | #include "hash.h"
|
---|
143 | #include "splay.h"
|
---|
144 | #include "dynbuf.h"
|
---|
145 | #include "dynhds.h"
|
---|
146 | #include "request.h"
|
---|
147 |
|
---|
148 | /* return the count of bytes sent, or -1 on error */
|
---|
149 | typedef ssize_t (Curl_send)(struct Curl_easy *data, /* transfer */
|
---|
150 | int sockindex, /* socketindex */
|
---|
151 | const void *buf, /* data to write */
|
---|
152 | size_t len, /* max amount to write */
|
---|
153 | CURLcode *err); /* error to return */
|
---|
154 |
|
---|
155 | /* return the count of bytes read, or -1 on error */
|
---|
156 | typedef ssize_t (Curl_recv)(struct Curl_easy *data, /* transfer */
|
---|
157 | int sockindex, /* socketindex */
|
---|
158 | char *buf, /* store data here */
|
---|
159 | size_t len, /* max amount to read */
|
---|
160 | CURLcode *err); /* error to return */
|
---|
161 |
|
---|
162 | #ifdef USE_HYPER
|
---|
163 | typedef CURLcode (*Curl_datastream)(struct Curl_easy *data,
|
---|
164 | struct connectdata *conn,
|
---|
165 | int *didwhat,
|
---|
166 | int select_res);
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | #include "mime.h"
|
---|
170 | #include "imap.h"
|
---|
171 | #include "pop3.h"
|
---|
172 | #include "smtp.h"
|
---|
173 | #include "ftp.h"
|
---|
174 | #include "file.h"
|
---|
175 | #include "vssh/ssh.h"
|
---|
176 | #include "http.h"
|
---|
177 | #include "rtsp.h"
|
---|
178 | #include "smb.h"
|
---|
179 | #include "mqtt.h"
|
---|
180 | #include "ftplistparser.h"
|
---|
181 | #include "multihandle.h"
|
---|
182 | #include "c-hyper.h"
|
---|
183 | #include "cf-socket.h"
|
---|
184 |
|
---|
185 | #ifdef HAVE_GSSAPI
|
---|
186 | # ifdef HAVE_GSSGNU
|
---|
187 | # include <gss.h>
|
---|
188 | # elif defined HAVE_GSSAPI_GSSAPI_H
|
---|
189 | # include <gssapi/gssapi.h>
|
---|
190 | # else
|
---|
191 | # include <gssapi.h>
|
---|
192 | # endif
|
---|
193 | # ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
|
---|
194 | # include <gssapi/gssapi_generic.h>
|
---|
195 | # endif
|
---|
196 | #endif
|
---|
197 |
|
---|
198 | #ifdef USE_LIBSSH2
|
---|
199 | #include <libssh2.h>
|
---|
200 | #include <libssh2_sftp.h>
|
---|
201 | #endif /* USE_LIBSSH2 */
|
---|
202 |
|
---|
203 | #define READBUFFER_SIZE CURL_MAX_WRITE_SIZE
|
---|
204 | #define READBUFFER_MAX CURL_MAX_READ_SIZE
|
---|
205 | #define READBUFFER_MIN 1024
|
---|
206 |
|
---|
207 | /* The default upload buffer size, should not be smaller than
|
---|
208 | CURL_MAX_WRITE_SIZE, as it needs to hold a full buffer as could be sent in
|
---|
209 | a write callback.
|
---|
210 |
|
---|
211 | The size was 16KB for many years but was bumped to 64KB because it makes
|
---|
212 | libcurl able to do significantly faster uploads in some circumstances. Even
|
---|
213 | larger buffers can help further, but this is deemed a fair memory/speed
|
---|
214 | compromise. */
|
---|
215 | #define UPLOADBUFFER_DEFAULT 65536
|
---|
216 | #define UPLOADBUFFER_MAX (2*1024*1024)
|
---|
217 | #define UPLOADBUFFER_MIN CURL_MAX_WRITE_SIZE
|
---|
218 |
|
---|
219 | #define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
|
---|
220 | #ifdef DEBUGBUILD
|
---|
221 | /* On a debug build, we want to fail hard on easy handles that
|
---|
222 | * are not NULL, but no longer have the MAGIC touch. This gives
|
---|
223 | * us early warning on things only discovered by valgrind otherwise. */
|
---|
224 | #define GOOD_EASY_HANDLE(x) \
|
---|
225 | (((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))? TRUE: \
|
---|
226 | (DEBUGASSERT(!(x)), FALSE))
|
---|
227 | #else
|
---|
228 | #define GOOD_EASY_HANDLE(x) \
|
---|
229 | ((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #ifdef HAVE_GSSAPI
|
---|
233 | /* Types needed for krb5-ftp connections */
|
---|
234 | struct krb5buffer {
|
---|
235 | void *data;
|
---|
236 | size_t size;
|
---|
237 | size_t index;
|
---|
238 | BIT(eof_flag);
|
---|
239 | };
|
---|
240 |
|
---|
241 | enum protection_level {
|
---|
242 | PROT_NONE, /* first in list */
|
---|
243 | PROT_CLEAR,
|
---|
244 | PROT_SAFE,
|
---|
245 | PROT_CONFIDENTIAL,
|
---|
246 | PROT_PRIVATE,
|
---|
247 | PROT_CMD,
|
---|
248 | PROT_LAST /* last in list */
|
---|
249 | };
|
---|
250 | #endif
|
---|
251 |
|
---|
252 | /* enum for the nonblocking SSL connection state machine */
|
---|
253 | typedef enum {
|
---|
254 | ssl_connect_1,
|
---|
255 | ssl_connect_2,
|
---|
256 | ssl_connect_2_reading,
|
---|
257 | ssl_connect_2_writing,
|
---|
258 | ssl_connect_3,
|
---|
259 | ssl_connect_done
|
---|
260 | } ssl_connect_state;
|
---|
261 |
|
---|
262 | typedef enum {
|
---|
263 | ssl_connection_none,
|
---|
264 | ssl_connection_negotiating,
|
---|
265 | ssl_connection_complete
|
---|
266 | } ssl_connection_state;
|
---|
267 |
|
---|
268 | /* SSL backend-specific data; declared differently by each SSL backend */
|
---|
269 | struct ssl_backend_data;
|
---|
270 |
|
---|
271 | typedef enum {
|
---|
272 | CURL_SSL_PEER_DNS,
|
---|
273 | CURL_SSL_PEER_IPV4,
|
---|
274 | CURL_SSL_PEER_IPV6
|
---|
275 | } ssl_peer_type;
|
---|
276 |
|
---|
277 | struct ssl_peer {
|
---|
278 | char *hostname; /* hostname for verification */
|
---|
279 | char *dispname; /* display version of hostname */
|
---|
280 | char *sni; /* SNI version of hostname or NULL if not usable */
|
---|
281 | ssl_peer_type type; /* type of the peer information */
|
---|
282 | };
|
---|
283 |
|
---|
284 | struct ssl_primary_config {
|
---|
285 | char *CApath; /* certificate dir (doesn't work on windows) */
|
---|
286 | char *CAfile; /* certificate to verify peer against */
|
---|
287 | char *issuercert; /* optional issuer certificate filename */
|
---|
288 | char *clientcert;
|
---|
289 | char *cipher_list; /* list of ciphers to use */
|
---|
290 | char *cipher_list13; /* list of TLS 1.3 cipher suites to use */
|
---|
291 | char *pinned_key;
|
---|
292 | char *CRLfile; /* CRL to check certificate revocation */
|
---|
293 | struct curl_blob *cert_blob;
|
---|
294 | struct curl_blob *ca_info_blob;
|
---|
295 | struct curl_blob *issuercert_blob;
|
---|
296 | #ifdef USE_TLS_SRP
|
---|
297 | char *username; /* TLS username (for, e.g., SRP) */
|
---|
298 | char *password; /* TLS password (for, e.g., SRP) */
|
---|
299 | #endif
|
---|
300 | char *curves; /* list of curves to use */
|
---|
301 | unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */
|
---|
302 | unsigned int version_max; /* max supported version the client wants to use */
|
---|
303 | unsigned char version; /* what version the client wants to use */
|
---|
304 | BIT(verifypeer); /* set TRUE if this is desired */
|
---|
305 | BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */
|
---|
306 | BIT(verifystatus); /* set TRUE if certificate status must be checked */
|
---|
307 | BIT(sessionid); /* cache session IDs or not */
|
---|
308 | };
|
---|
309 |
|
---|
310 | struct ssl_config_data {
|
---|
311 | struct ssl_primary_config primary;
|
---|
312 | long certverifyresult; /* result from the certificate verification */
|
---|
313 | curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
|
---|
314 | void *fsslctxp; /* parameter for call back */
|
---|
315 | char *cert_type; /* format for certificate (default: PEM)*/
|
---|
316 | char *key; /* private key file name */
|
---|
317 | struct curl_blob *key_blob;
|
---|
318 | char *key_type; /* format for private key (default: PEM) */
|
---|
319 | char *key_passwd; /* plain text private key password */
|
---|
320 | BIT(certinfo); /* gather lots of certificate info */
|
---|
321 | BIT(falsestart);
|
---|
322 | BIT(enable_beast); /* allow this flaw for interoperability's sake */
|
---|
323 | BIT(no_revoke); /* disable SSL certificate revocation checks */
|
---|
324 | BIT(no_partialchain); /* don't accept partial certificate chains */
|
---|
325 | BIT(revoke_best_effort); /* ignore SSL revocation offline/missing revocation
|
---|
326 | list errors */
|
---|
327 | BIT(native_ca_store); /* use the native ca store of operating system */
|
---|
328 | BIT(auto_client_cert); /* automatically locate and use a client
|
---|
329 | certificate for authentication (Schannel) */
|
---|
330 | };
|
---|
331 |
|
---|
332 | struct ssl_general_config {
|
---|
333 | size_t max_ssl_sessions; /* SSL session id cache size */
|
---|
334 | int ca_cache_timeout; /* Certificate store cache timeout (seconds) */
|
---|
335 | };
|
---|
336 |
|
---|
337 | /* information stored about one single SSL session */
|
---|
338 | struct Curl_ssl_session {
|
---|
339 | char *name; /* host name for which this ID was used */
|
---|
340 | char *conn_to_host; /* host name for the connection (may be NULL) */
|
---|
341 | const char *scheme; /* protocol scheme used */
|
---|
342 | void *sessionid; /* as returned from the SSL layer */
|
---|
343 | size_t idsize; /* if known, otherwise 0 */
|
---|
344 | long age; /* just a number, the higher the more recent */
|
---|
345 | int remote_port; /* remote port */
|
---|
346 | int conn_to_port; /* remote port for the connection (may be -1) */
|
---|
347 | struct ssl_primary_config ssl_config; /* setup for this session */
|
---|
348 | };
|
---|
349 |
|
---|
350 | #ifdef USE_WINDOWS_SSPI
|
---|
351 | #include "curl_sspi.h"
|
---|
352 | #endif
|
---|
353 |
|
---|
354 | #ifndef CURL_DISABLE_DIGEST_AUTH
|
---|
355 | /* Struct used for Digest challenge-response authentication */
|
---|
356 | struct digestdata {
|
---|
357 | #if defined(USE_WINDOWS_SSPI)
|
---|
358 | BYTE *input_token;
|
---|
359 | size_t input_token_len;
|
---|
360 | CtxtHandle *http_context;
|
---|
361 | /* copy of user/passwd used to make the identity for http_context.
|
---|
362 | either may be NULL. */
|
---|
363 | char *user;
|
---|
364 | char *passwd;
|
---|
365 | #else
|
---|
366 | char *nonce;
|
---|
367 | char *cnonce;
|
---|
368 | char *realm;
|
---|
369 | char *opaque;
|
---|
370 | char *qop;
|
---|
371 | char *algorithm;
|
---|
372 | int nc; /* nonce count */
|
---|
373 | unsigned char algo;
|
---|
374 | BIT(stale); /* set true for re-negotiation */
|
---|
375 | BIT(userhash);
|
---|
376 | #endif
|
---|
377 | };
|
---|
378 | #endif
|
---|
379 |
|
---|
380 | typedef enum {
|
---|
381 | NTLMSTATE_NONE,
|
---|
382 | NTLMSTATE_TYPE1,
|
---|
383 | NTLMSTATE_TYPE2,
|
---|
384 | NTLMSTATE_TYPE3,
|
---|
385 | NTLMSTATE_LAST
|
---|
386 | } curlntlm;
|
---|
387 |
|
---|
388 | typedef enum {
|
---|
389 | GSS_AUTHNONE,
|
---|
390 | GSS_AUTHRECV,
|
---|
391 | GSS_AUTHSENT,
|
---|
392 | GSS_AUTHDONE,
|
---|
393 | GSS_AUTHSUCC
|
---|
394 | } curlnegotiate;
|
---|
395 |
|
---|
396 | /* Struct used for GSSAPI (Kerberos V5) authentication */
|
---|
397 | #if defined(USE_KERBEROS5)
|
---|
398 | struct kerberos5data {
|
---|
399 | #if defined(USE_WINDOWS_SSPI)
|
---|
400 | CredHandle *credentials;
|
---|
401 | CtxtHandle *context;
|
---|
402 | TCHAR *spn;
|
---|
403 | SEC_WINNT_AUTH_IDENTITY identity;
|
---|
404 | SEC_WINNT_AUTH_IDENTITY *p_identity;
|
---|
405 | size_t token_max;
|
---|
406 | BYTE *output_token;
|
---|
407 | #else
|
---|
408 | gss_ctx_id_t context;
|
---|
409 | gss_name_t spn;
|
---|
410 | #endif
|
---|
411 | };
|
---|
412 | #endif
|
---|
413 |
|
---|
414 | /* Struct used for SCRAM-SHA-1 authentication */
|
---|
415 | #ifdef USE_GSASL
|
---|
416 | #include <gsasl.h>
|
---|
417 | struct gsasldata {
|
---|
418 | Gsasl *ctx;
|
---|
419 | Gsasl_session *client;
|
---|
420 | };
|
---|
421 | #endif
|
---|
422 |
|
---|
423 | /* Struct used for NTLM challenge-response authentication */
|
---|
424 | #if defined(USE_NTLM)
|
---|
425 | struct ntlmdata {
|
---|
426 | #ifdef USE_WINDOWS_SSPI
|
---|
427 | /* The sslContext is used for the Schannel bindings. The
|
---|
428 | * api is available on the Windows 7 SDK and later.
|
---|
429 | */
|
---|
430 | #ifdef SECPKG_ATTR_ENDPOINT_BINDINGS
|
---|
431 | CtxtHandle *sslContext;
|
---|
432 | #endif
|
---|
433 | CredHandle *credentials;
|
---|
434 | CtxtHandle *context;
|
---|
435 | SEC_WINNT_AUTH_IDENTITY identity;
|
---|
436 | SEC_WINNT_AUTH_IDENTITY *p_identity;
|
---|
437 | size_t token_max;
|
---|
438 | BYTE *output_token;
|
---|
439 | BYTE *input_token;
|
---|
440 | size_t input_token_len;
|
---|
441 | TCHAR *spn;
|
---|
442 | #else
|
---|
443 | unsigned int flags;
|
---|
444 | unsigned char nonce[8];
|
---|
445 | unsigned int target_info_len;
|
---|
446 | void *target_info; /* TargetInfo received in the ntlm type-2 message */
|
---|
447 |
|
---|
448 | #if defined(NTLM_WB_ENABLED)
|
---|
449 | /* used for communication with Samba's winbind daemon helper ntlm_auth */
|
---|
450 | curl_socket_t ntlm_auth_hlpr_socket;
|
---|
451 | pid_t ntlm_auth_hlpr_pid;
|
---|
452 | char *challenge; /* The received base64 encoded ntlm type-2 message */
|
---|
453 | char *response; /* The generated base64 ntlm type-1/type-3 message */
|
---|
454 | #endif
|
---|
455 | #endif
|
---|
456 | };
|
---|
457 | #endif
|
---|
458 |
|
---|
459 | /* Struct used for Negotiate (SPNEGO) authentication */
|
---|
460 | #ifdef USE_SPNEGO
|
---|
461 | struct negotiatedata {
|
---|
462 | #ifdef HAVE_GSSAPI
|
---|
463 | OM_uint32 status;
|
---|
464 | gss_ctx_id_t context;
|
---|
465 | gss_name_t spn;
|
---|
466 | gss_buffer_desc output_token;
|
---|
467 | #else
|
---|
468 | #ifdef USE_WINDOWS_SSPI
|
---|
469 | #ifdef SECPKG_ATTR_ENDPOINT_BINDINGS
|
---|
470 | CtxtHandle *sslContext;
|
---|
471 | #endif
|
---|
472 | DWORD status;
|
---|
473 | CredHandle *credentials;
|
---|
474 | CtxtHandle *context;
|
---|
475 | SEC_WINNT_AUTH_IDENTITY identity;
|
---|
476 | SEC_WINNT_AUTH_IDENTITY *p_identity;
|
---|
477 | TCHAR *spn;
|
---|
478 | size_t token_max;
|
---|
479 | BYTE *output_token;
|
---|
480 | size_t output_token_length;
|
---|
481 | #endif
|
---|
482 | #endif
|
---|
483 | BIT(noauthpersist);
|
---|
484 | BIT(havenoauthpersist);
|
---|
485 | BIT(havenegdata);
|
---|
486 | BIT(havemultiplerequests);
|
---|
487 | };
|
---|
488 | #endif
|
---|
489 |
|
---|
490 | #ifdef CURL_DISABLE_PROXY
|
---|
491 | #define CONN_IS_PROXIED(x) 0
|
---|
492 | #else
|
---|
493 | #define CONN_IS_PROXIED(x) x->bits.proxy
|
---|
494 | #endif
|
---|
495 |
|
---|
496 | /*
|
---|
497 | * Boolean values that concerns this connection.
|
---|
498 | */
|
---|
499 | struct ConnectBits {
|
---|
500 | #ifndef CURL_DISABLE_PROXY
|
---|
501 | BIT(httpproxy); /* if set, this transfer is done through an HTTP proxy */
|
---|
502 | BIT(socksproxy); /* if set, this transfer is done through a socks proxy */
|
---|
503 | BIT(proxy_user_passwd); /* user+password for the proxy? */
|
---|
504 | BIT(tunnel_proxy); /* if CONNECT is used to "tunnel" through the proxy.
|
---|
505 | This is implicit when SSL-protocols are used through
|
---|
506 | proxies, but can also be enabled explicitly by
|
---|
507 | apps */
|
---|
508 | BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection
|
---|
509 | in a CONNECT request with auth, so that
|
---|
510 | libcurl should reconnect and continue. */
|
---|
511 | BIT(proxy); /* if set, this transfer is done through a proxy - any type */
|
---|
512 | #endif
|
---|
513 | /* always modify bits.close with the connclose() and connkeep() macros! */
|
---|
514 | BIT(close); /* if set, we close the connection after this request */
|
---|
515 | BIT(reuse); /* if set, this is a reused connection */
|
---|
516 | BIT(altused); /* this is an alt-svc "redirect" */
|
---|
517 | BIT(conn_to_host); /* if set, this connection has a "connect to host"
|
---|
518 | that overrides the host in the URL */
|
---|
519 | BIT(conn_to_port); /* if set, this connection has a "connect to port"
|
---|
520 | that overrides the port in the URL (remote port) */
|
---|
521 | BIT(ipv6_ip); /* we communicate with a remote site specified with pure IPv6
|
---|
522 | IP address */
|
---|
523 | BIT(ipv6); /* we communicate with a site using an IPv6 address */
|
---|
524 | BIT(do_more); /* this is set TRUE if the ->curl_do_more() function is
|
---|
525 | supposed to be called, after ->curl_do() */
|
---|
526 | BIT(protoconnstart);/* the protocol layer has STARTED its operation after
|
---|
527 | the TCP layer connect */
|
---|
528 | BIT(retry); /* this connection is about to get closed and then
|
---|
529 | re-attempted at another connection. */
|
---|
530 | #ifndef CURL_DISABLE_FTP
|
---|
531 | BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
|
---|
532 | EPSV doesn't work we disable it for the forthcoming
|
---|
533 | requests */
|
---|
534 | BIT(ftp_use_eprt); /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
|
---|
535 | EPRT doesn't work we disable it for the forthcoming
|
---|
536 | requests */
|
---|
537 | BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
|
---|
538 | BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */
|
---|
539 | #endif
|
---|
540 | #ifndef CURL_DISABLE_NETRC
|
---|
541 | BIT(netrc); /* name+password provided by netrc */
|
---|
542 | #endif
|
---|
543 | BIT(bound); /* set true if bind() has already been done on this socket/
|
---|
544 | connection */
|
---|
545 | BIT(multiplex); /* connection is multiplexed */
|
---|
546 | BIT(tcp_fastopen); /* use TCP Fast Open */
|
---|
547 | BIT(tls_enable_alpn); /* TLS ALPN extension? */
|
---|
548 | #ifndef CURL_DISABLE_DOH
|
---|
549 | BIT(doh);
|
---|
550 | #endif
|
---|
551 | #ifdef USE_UNIX_SOCKETS
|
---|
552 | BIT(abstract_unix_socket);
|
---|
553 | #endif
|
---|
554 | BIT(tls_upgraded);
|
---|
555 | BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
|
---|
556 | accept() */
|
---|
557 | BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
|
---|
558 | started (happy eyeballs) */
|
---|
559 | };
|
---|
560 |
|
---|
561 | struct hostname {
|
---|
562 | char *rawalloc; /* allocated "raw" version of the name */
|
---|
563 | char *encalloc; /* allocated IDN-encoded version of the name */
|
---|
564 | char *name; /* name to use internally, might be encoded, might be raw */
|
---|
565 | const char *dispname; /* name to display, as 'name' might be encoded */
|
---|
566 | };
|
---|
567 |
|
---|
568 | /*
|
---|
569 | * Flags on the keepon member of the Curl_transfer_keeper
|
---|
570 | */
|
---|
571 |
|
---|
572 | #define KEEP_NONE 0
|
---|
573 | #define KEEP_RECV (1<<0) /* there is or may be data to read */
|
---|
574 | #define KEEP_SEND (1<<1) /* there is or may be data to write */
|
---|
575 | #define KEEP_RECV_HOLD (1<<2) /* when set, no reading should be done but there
|
---|
576 | might still be data to read */
|
---|
577 | #define KEEP_SEND_HOLD (1<<3) /* when set, no writing should be done but there
|
---|
578 | might still be data to write */
|
---|
579 | #define KEEP_RECV_PAUSE (1<<4) /* reading is paused */
|
---|
580 | #define KEEP_SEND_PAUSE (1<<5) /* writing is paused */
|
---|
581 |
|
---|
582 | /* KEEP_SEND_TIMED is set when the transfer should attempt sending
|
---|
583 | * at timer (or other) events. A transfer waiting on a timer will
|
---|
584 | * remove KEEP_SEND to suppress POLLOUTs of the connection.
|
---|
585 | * Adding KEEP_SEND_TIMED will then attempt to send whenever the transfer
|
---|
586 | * enters the "readwrite" loop, e.g. when a timer fires.
|
---|
587 | * This is used in HTTP for 'Expect: 100-continue' waiting. */
|
---|
588 | #define KEEP_SEND_TIMED (1<<6)
|
---|
589 |
|
---|
590 | #define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE)
|
---|
591 | #define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE)
|
---|
592 |
|
---|
593 | /* transfer wants to send is not PAUSE or HOLD */
|
---|
594 | #define CURL_WANT_SEND(data) \
|
---|
595 | (((data)->req.keepon & KEEP_SENDBITS) == KEEP_SEND)
|
---|
596 | /* transfer receive is not on PAUSE or HOLD */
|
---|
597 | #define CURL_WANT_RECV(data) \
|
---|
598 | (((data)->req.keepon & KEEP_RECVBITS) == KEEP_RECV)
|
---|
599 |
|
---|
600 | #if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
|
---|
601 | #define USE_CURL_ASYNC
|
---|
602 | struct Curl_async {
|
---|
603 | char *hostname;
|
---|
604 | struct Curl_dns_entry *dns;
|
---|
605 | struct thread_data *tdata;
|
---|
606 | void *resolver; /* resolver state, if it is used in the URL state -
|
---|
607 | ares_channel e.g. */
|
---|
608 | int port;
|
---|
609 | int status; /* if done is TRUE, this is the status from the callback */
|
---|
610 | BIT(done); /* set TRUE when the lookup is complete */
|
---|
611 | };
|
---|
612 |
|
---|
613 | #endif
|
---|
614 |
|
---|
615 | #define FIRSTSOCKET 0
|
---|
616 | #define SECONDARYSOCKET 1
|
---|
617 |
|
---|
618 | /* Polling requested by an easy handle.
|
---|
619 | * `action` is CURL_POLL_IN, CURL_POLL_OUT or CURL_POLL_INOUT.
|
---|
620 | */
|
---|
621 | struct easy_pollset {
|
---|
622 | curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE];
|
---|
623 | unsigned int num;
|
---|
624 | unsigned char actions[MAX_SOCKSPEREASYHANDLE];
|
---|
625 | };
|
---|
626 |
|
---|
627 | enum doh_slots {
|
---|
628 | /* Explicit values for first two symbols so as to match hard-coded
|
---|
629 | * constants in existing code
|
---|
630 | */
|
---|
631 | DOH_PROBE_SLOT_IPADDR_V4 = 0, /* make 'V4' stand out for readability */
|
---|
632 | DOH_PROBE_SLOT_IPADDR_V6 = 1, /* 'V6' likewise */
|
---|
633 |
|
---|
634 | /* Space here for (possibly build-specific) additional slot definitions */
|
---|
635 |
|
---|
636 | /* for example */
|
---|
637 | /* #ifdef WANT_DOH_FOOBAR_TXT */
|
---|
638 | /* DOH_PROBE_SLOT_FOOBAR_TXT, */
|
---|
639 | /* #endif */
|
---|
640 |
|
---|
641 | /* AFTER all slot definitions, establish how many we have */
|
---|
642 | DOH_PROBE_SLOTS
|
---|
643 | };
|
---|
644 |
|
---|
645 | /*
|
---|
646 | * Specific protocol handler.
|
---|
647 | */
|
---|
648 |
|
---|
649 | struct Curl_handler {
|
---|
650 | const char *scheme; /* URL scheme name. */
|
---|
651 |
|
---|
652 | /* Complement to setup_connection_internals(). This is done before the
|
---|
653 | transfer "owns" the connection. */
|
---|
654 | CURLcode (*setup_connection)(struct Curl_easy *data,
|
---|
655 | struct connectdata *conn);
|
---|
656 |
|
---|
657 | /* These two functions MUST be set to be protocol dependent */
|
---|
658 | CURLcode (*do_it)(struct Curl_easy *data, bool *done);
|
---|
659 | CURLcode (*done)(struct Curl_easy *, CURLcode, bool);
|
---|
660 |
|
---|
661 | /* If the curl_do() function is better made in two halves, this
|
---|
662 | * curl_do_more() function will be called afterwards, if set. For example
|
---|
663 | * for doing the FTP stuff after the PASV/PORT command.
|
---|
664 | */
|
---|
665 | CURLcode (*do_more)(struct Curl_easy *, int *);
|
---|
666 |
|
---|
667 | /* This function *MAY* be set to a protocol-dependent function that is run
|
---|
668 | * after the connect() and everything is done, as a step in the connection.
|
---|
669 | * The 'done' pointer points to a bool that should be set to TRUE if the
|
---|
670 | * function completes before return. If it doesn't complete, the caller
|
---|
671 | * should call the ->connecting() function until it is.
|
---|
672 | */
|
---|
673 | CURLcode (*connect_it)(struct Curl_easy *data, bool *done);
|
---|
674 |
|
---|
675 | /* See above. */
|
---|
676 | CURLcode (*connecting)(struct Curl_easy *data, bool *done);
|
---|
677 | CURLcode (*doing)(struct Curl_easy *data, bool *done);
|
---|
678 |
|
---|
679 | /* Called from the multi interface during the PROTOCONNECT phase, and it
|
---|
680 | should then return a proper fd set */
|
---|
681 | int (*proto_getsock)(struct Curl_easy *data,
|
---|
682 | struct connectdata *conn, curl_socket_t *socks);
|
---|
683 |
|
---|
684 | /* Called from the multi interface during the DOING phase, and it should
|
---|
685 | then return a proper fd set */
|
---|
686 | int (*doing_getsock)(struct Curl_easy *data,
|
---|
687 | struct connectdata *conn, curl_socket_t *socks);
|
---|
688 |
|
---|
689 | /* Called from the multi interface during the DO_MORE phase, and it should
|
---|
690 | then return a proper fd set */
|
---|
691 | int (*domore_getsock)(struct Curl_easy *data,
|
---|
692 | struct connectdata *conn, curl_socket_t *socks);
|
---|
693 |
|
---|
694 | /* Called from the multi interface during the DO_DONE, PERFORM and
|
---|
695 | WAITPERFORM phases, and it should then return a proper fd set. Not setting
|
---|
696 | this will make libcurl use the generic default one. */
|
---|
697 | int (*perform_getsock)(struct Curl_easy *data,
|
---|
698 | struct connectdata *conn, curl_socket_t *socks);
|
---|
699 |
|
---|
700 | /* This function *MAY* be set to a protocol-dependent function that is run
|
---|
701 | * by the curl_disconnect(), as a step in the disconnection. If the handler
|
---|
702 | * is called because the connection has been considered dead,
|
---|
703 | * dead_connection is set to TRUE. The connection is (again) associated with
|
---|
704 | * the transfer here.
|
---|
705 | */
|
---|
706 | CURLcode (*disconnect)(struct Curl_easy *, struct connectdata *,
|
---|
707 | bool dead_connection);
|
---|
708 |
|
---|
709 | /* If used, this function gets called from transfer.c:readwrite_data() to
|
---|
710 | allow the protocol to do extra handling in writing response to
|
---|
711 | the client. */
|
---|
712 | CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t blen,
|
---|
713 | bool is_eos);
|
---|
714 |
|
---|
715 | /* This function can perform various checks on the connection. See
|
---|
716 | CONNCHECK_* for more information about the checks that can be performed,
|
---|
717 | and CONNRESULT_* for the results that can be returned. */
|
---|
718 | unsigned int (*connection_check)(struct Curl_easy *data,
|
---|
719 | struct connectdata *conn,
|
---|
720 | unsigned int checks_to_perform);
|
---|
721 |
|
---|
722 | /* attach() attaches this transfer to this connection */
|
---|
723 | void (*attach)(struct Curl_easy *data, struct connectdata *conn);
|
---|
724 |
|
---|
725 | int defport; /* Default port. */
|
---|
726 | curl_prot_t protocol; /* See CURLPROTO_* - this needs to be the single
|
---|
727 | specific protocol bit */
|
---|
728 | curl_prot_t family; /* single bit for protocol family; basically the
|
---|
729 | non-TLS name of the protocol this is */
|
---|
730 | unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */
|
---|
731 |
|
---|
732 | };
|
---|
733 |
|
---|
734 | #define PROTOPT_NONE 0 /* nothing extra */
|
---|
735 | #define PROTOPT_SSL (1<<0) /* uses SSL */
|
---|
736 | #define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */
|
---|
737 | #define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */
|
---|
738 | /* some protocols will have to call the underlying functions without regard to
|
---|
739 | what exact state the socket signals. IE even if the socket says "readable",
|
---|
740 | the send function might need to be called while uploading, or vice versa.
|
---|
741 | */
|
---|
742 | #define PROTOPT_DIRLOCK (1<<3)
|
---|
743 | #define PROTOPT_NONETWORK (1<<4) /* protocol doesn't use the network! */
|
---|
744 | #define PROTOPT_NEEDSPWD (1<<5) /* needs a password, and if none is set it
|
---|
745 | gets a default */
|
---|
746 | #define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle
|
---|
747 | url query strings (?foo=bar) ! */
|
---|
748 | #define PROTOPT_CREDSPERREQUEST (1<<7) /* requires login credentials per
|
---|
749 | request instead of per connection */
|
---|
750 | #define PROTOPT_ALPN (1<<8) /* set ALPN for this */
|
---|
751 | /* (1<<9) was PROTOPT_STREAM, now free */
|
---|
752 | #define PROTOPT_URLOPTIONS (1<<10) /* allow options part in the userinfo field
|
---|
753 | of the URL */
|
---|
754 | #define PROTOPT_PROXY_AS_HTTP (1<<11) /* allow this non-HTTP scheme over a
|
---|
755 | HTTP proxy as HTTP proxies may know
|
---|
756 | this protocol and act as a gateway */
|
---|
757 | #define PROTOPT_WILDCARD (1<<12) /* protocol supports wildcard matching */
|
---|
758 | #define PROTOPT_USERPWDCTRL (1<<13) /* Allow "control bytes" (< 32 ascii) in
|
---|
759 | user name and password */
|
---|
760 | #define PROTOPT_NOTCPPROXY (1<<14) /* this protocol can't proxy over TCP */
|
---|
761 |
|
---|
762 | #define CONNCHECK_NONE 0 /* No checks */
|
---|
763 | #define CONNCHECK_ISDEAD (1<<0) /* Check if the connection is dead. */
|
---|
764 | #define CONNCHECK_KEEPALIVE (1<<1) /* Perform any keepalive function. */
|
---|
765 |
|
---|
766 | #define CONNRESULT_NONE 0 /* No extra information. */
|
---|
767 | #define CONNRESULT_DEAD (1<<0) /* The connection is dead. */
|
---|
768 |
|
---|
769 | struct ip_quadruple {
|
---|
770 | char remote_ip[MAX_IPADR_LEN];
|
---|
771 | char local_ip[MAX_IPADR_LEN];
|
---|
772 | int remote_port;
|
---|
773 | int local_port;
|
---|
774 | };
|
---|
775 |
|
---|
776 | struct proxy_info {
|
---|
777 | struct hostname host;
|
---|
778 | int port;
|
---|
779 | unsigned char proxytype; /* curl_proxytype: what kind of proxy that is in
|
---|
780 | use */
|
---|
781 | char *user; /* proxy user name string, allocated */
|
---|
782 | char *passwd; /* proxy password string, allocated */
|
---|
783 | };
|
---|
784 |
|
---|
785 | struct ldapconninfo;
|
---|
786 |
|
---|
787 | #define TRNSPRT_TCP 3
|
---|
788 | #define TRNSPRT_UDP 4
|
---|
789 | #define TRNSPRT_QUIC 5
|
---|
790 | #define TRNSPRT_UNIX 6
|
---|
791 |
|
---|
792 | /*
|
---|
793 | * The connectdata struct contains all fields and variables that should be
|
---|
794 | * unique for an entire connection.
|
---|
795 | */
|
---|
796 | struct connectdata {
|
---|
797 | struct Curl_llist_element bundle_node; /* conncache */
|
---|
798 |
|
---|
799 | curl_closesocket_callback fclosesocket; /* function closing the socket(s) */
|
---|
800 | void *closesocket_client;
|
---|
801 |
|
---|
802 | /* This is used by the connection cache logic. If this returns TRUE, this
|
---|
803 | handle is still used by one or more easy handles and can only used by any
|
---|
804 | other easy handle without careful consideration (== only for
|
---|
805 | multiplexing) and it cannot be used by another multi handle! */
|
---|
806 | #define CONN_INUSE(c) ((c)->easyq.size)
|
---|
807 |
|
---|
808 | /**** Fields set when inited and not modified again */
|
---|
809 | curl_off_t connection_id; /* Contains a unique number to make it easier to
|
---|
810 | track the connections in the log output */
|
---|
811 |
|
---|
812 | /* 'dns_entry' is the particular host we use. This points to an entry in the
|
---|
813 | DNS cache and it will not get pruned while locked. It gets unlocked in
|
---|
814 | multi_done(). This entry will be NULL if the connection is reused as then
|
---|
815 | there is no name resolve done. */
|
---|
816 | struct Curl_dns_entry *dns_entry;
|
---|
817 |
|
---|
818 | /* 'remote_addr' is the particular IP we connected to. it is owned, set
|
---|
819 | * and NULLed by the connected socket filter (if there is one). */
|
---|
820 | const struct Curl_sockaddr_ex *remote_addr;
|
---|
821 |
|
---|
822 | struct hostname host;
|
---|
823 | char *hostname_resolve; /* host name to resolve to address, allocated */
|
---|
824 | char *secondaryhostname; /* secondary socket host name (ftp) */
|
---|
825 | struct hostname conn_to_host; /* the host to connect to. valid only if
|
---|
826 | bits.conn_to_host is set */
|
---|
827 | #ifndef CURL_DISABLE_PROXY
|
---|
828 | struct proxy_info socks_proxy;
|
---|
829 | struct proxy_info http_proxy;
|
---|
830 | #endif
|
---|
831 | /* 'primary' and 'secondary' get filled with IP quadruple
|
---|
832 | (local/remote numerical ip address and port) whenever a is *attempted*.
|
---|
833 | When more than one address is tried for a connection these will hold data
|
---|
834 | for the last attempt. When the connection is actually established
|
---|
835 | these are updated with data which comes directly from the socket. */
|
---|
836 | struct ip_quadruple primary;
|
---|
837 | struct ip_quadruple secondary;
|
---|
838 | char *user; /* user name string, allocated */
|
---|
839 | char *passwd; /* password string, allocated */
|
---|
840 | char *options; /* options string, allocated */
|
---|
841 | char *sasl_authzid; /* authorization identity string, allocated */
|
---|
842 | char *oauth_bearer; /* OAUTH2 bearer, allocated */
|
---|
843 | struct curltime now; /* "current" time */
|
---|
844 | struct curltime created; /* creation time */
|
---|
845 | struct curltime lastused; /* when returned to the connection cache */
|
---|
846 | curl_socket_t sock[2]; /* two sockets, the second is used for the data
|
---|
847 | transfer when doing FTP */
|
---|
848 | Curl_recv *recv[2];
|
---|
849 | Curl_send *send[2];
|
---|
850 | struct Curl_cfilter *cfilter[2]; /* connection filters */
|
---|
851 |
|
---|
852 | struct ssl_primary_config ssl_config;
|
---|
853 | #ifndef CURL_DISABLE_PROXY
|
---|
854 | struct ssl_primary_config proxy_ssl_config;
|
---|
855 | #endif
|
---|
856 | struct ConnectBits bits; /* various state-flags for this connection */
|
---|
857 |
|
---|
858 | const struct Curl_handler *handler; /* Connection's protocol handler */
|
---|
859 | const struct Curl_handler *given; /* The protocol first given */
|
---|
860 |
|
---|
861 | /* Protocols can use a custom keepalive mechanism to keep connections alive.
|
---|
862 | This allows those protocols to track the last time the keepalive mechanism
|
---|
863 | was used on this connection. */
|
---|
864 | struct curltime keepalive;
|
---|
865 |
|
---|
866 | /**** curl_get() phase fields */
|
---|
867 |
|
---|
868 | curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
|
---|
869 | curl_socket_t writesockfd; /* socket to write to, it may very
|
---|
870 | well be the same we read from.
|
---|
871 | CURL_SOCKET_BAD disables */
|
---|
872 |
|
---|
873 | #ifdef HAVE_GSSAPI
|
---|
874 | BIT(sec_complete); /* if Kerberos is enabled for this connection */
|
---|
875 | unsigned char command_prot; /* enum protection_level */
|
---|
876 | unsigned char data_prot; /* enum protection_level */
|
---|
877 | unsigned char request_data_prot; /* enum protection_level */
|
---|
878 | size_t buffer_size;
|
---|
879 | struct krb5buffer in_buffer;
|
---|
880 | void *app_data;
|
---|
881 | const struct Curl_sec_client_mech *mech;
|
---|
882 | struct sockaddr_in local_addr;
|
---|
883 | #endif
|
---|
884 |
|
---|
885 | #if defined(USE_KERBEROS5) /* Consider moving some of the above GSS-API */
|
---|
886 | struct kerberos5data krb5; /* variables into the structure definition, */
|
---|
887 | #endif /* however, some of them are ftp specific. */
|
---|
888 |
|
---|
889 | struct Curl_llist easyq; /* List of easy handles using this connection */
|
---|
890 |
|
---|
891 | /*************** Request - specific items ************/
|
---|
892 | #if defined(USE_WINDOWS_SSPI) && defined(SECPKG_ATTR_ENDPOINT_BINDINGS)
|
---|
893 | CtxtHandle *sslContext;
|
---|
894 | #endif
|
---|
895 |
|
---|
896 | #if defined(_WIN32) && defined(USE_WINSOCK)
|
---|
897 | struct curltime last_sndbuf_update; /* last time readwrite_upload called
|
---|
898 | win_update_buffer_size */
|
---|
899 | #endif
|
---|
900 |
|
---|
901 | #ifdef USE_GSASL
|
---|
902 | struct gsasldata gsasl;
|
---|
903 | #endif
|
---|
904 |
|
---|
905 | #if defined(USE_NTLM)
|
---|
906 | curlntlm http_ntlm_state;
|
---|
907 | curlntlm proxy_ntlm_state;
|
---|
908 |
|
---|
909 | struct ntlmdata ntlm; /* NTLM differs from other authentication schemes
|
---|
910 | because it authenticates connections, not
|
---|
911 | single requests! */
|
---|
912 | struct ntlmdata proxyntlm; /* NTLM data for proxy */
|
---|
913 | #endif
|
---|
914 |
|
---|
915 | #ifdef USE_SPNEGO
|
---|
916 | curlnegotiate http_negotiate_state;
|
---|
917 | curlnegotiate proxy_negotiate_state;
|
---|
918 |
|
---|
919 | struct negotiatedata negotiate; /* state data for host Negotiate auth */
|
---|
920 | struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */
|
---|
921 | #endif
|
---|
922 |
|
---|
923 | union {
|
---|
924 | #ifndef CURL_DISABLE_FTP
|
---|
925 | struct ftp_conn ftpc;
|
---|
926 | #endif
|
---|
927 | #ifdef USE_SSH
|
---|
928 | struct ssh_conn sshc;
|
---|
929 | #endif
|
---|
930 | #ifndef CURL_DISABLE_TFTP
|
---|
931 | struct tftp_state_data *tftpc;
|
---|
932 | #endif
|
---|
933 | #ifndef CURL_DISABLE_IMAP
|
---|
934 | struct imap_conn imapc;
|
---|
935 | #endif
|
---|
936 | #ifndef CURL_DISABLE_POP3
|
---|
937 | struct pop3_conn pop3c;
|
---|
938 | #endif
|
---|
939 | #ifndef CURL_DISABLE_SMTP
|
---|
940 | struct smtp_conn smtpc;
|
---|
941 | #endif
|
---|
942 | #ifndef CURL_DISABLE_RTSP
|
---|
943 | struct rtsp_conn rtspc;
|
---|
944 | #endif
|
---|
945 | #ifndef CURL_DISABLE_SMB
|
---|
946 | struct smb_conn smbc;
|
---|
947 | #endif
|
---|
948 | #ifdef USE_LIBRTMP
|
---|
949 | void *rtmp;
|
---|
950 | #endif
|
---|
951 | #ifdef USE_OPENLDAP
|
---|
952 | struct ldapconninfo *ldapc;
|
---|
953 | #endif
|
---|
954 | #ifndef CURL_DISABLE_MQTT
|
---|
955 | struct mqtt_conn mqtt;
|
---|
956 | #endif
|
---|
957 | #ifdef USE_WEBSOCKETS
|
---|
958 | struct websocket *ws;
|
---|
959 | #endif
|
---|
960 | unsigned int unused:1; /* avoids empty union */
|
---|
961 | } proto;
|
---|
962 |
|
---|
963 | struct connectbundle *bundle; /* The bundle we are member of */
|
---|
964 | #ifdef USE_UNIX_SOCKETS
|
---|
965 | char *unix_domain_socket;
|
---|
966 | #endif
|
---|
967 | #ifdef USE_HYPER
|
---|
968 | /* if set, an alternative data transfer function */
|
---|
969 | Curl_datastream datastream;
|
---|
970 | #endif
|
---|
971 | /* When this connection is created, store the conditions for the local end
|
---|
972 | bind. This is stored before the actual bind and before any connection is
|
---|
973 | made and will serve the purpose of being used for comparison reasons so
|
---|
974 | that subsequent bound-requested connections aren't accidentally reusing
|
---|
975 | wrong connections. */
|
---|
976 | char *localdev;
|
---|
977 | unsigned short localportrange;
|
---|
978 | int waitfor; /* current READ/WRITE bits to wait for */
|
---|
979 | #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
|
---|
980 | int socks5_gssapi_enctype;
|
---|
981 | #endif
|
---|
982 | /* The field below gets set in connect.c:connecthost() */
|
---|
983 | int remote_port; /* the remote port, not the proxy port! */
|
---|
984 | int conn_to_port; /* the remote port to connect to. valid only if
|
---|
985 | bits.conn_to_port is set */
|
---|
986 | #ifdef ENABLE_IPV6
|
---|
987 | unsigned int scope_id; /* Scope id for IPv6 */
|
---|
988 | #endif
|
---|
989 | unsigned short localport;
|
---|
990 | unsigned short secondary_port; /* secondary socket remote port to connect to
|
---|
991 | (ftp) */
|
---|
992 | unsigned char alpn; /* APLN TLS negotiated protocol, a CURL_HTTP_VERSION*
|
---|
993 | value */
|
---|
994 | #ifndef CURL_DISABLE_PROXY
|
---|
995 | unsigned char proxy_alpn; /* APLN of proxy tunnel, CURL_HTTP_VERSION* */
|
---|
996 | #endif
|
---|
997 | unsigned char transport; /* one of the TRNSPRT_* defines */
|
---|
998 | unsigned char ip_version; /* copied from the Curl_easy at creation time */
|
---|
999 | unsigned char httpversion; /* the HTTP version*10 reported by the server */
|
---|
1000 | unsigned char connect_only;
|
---|
1001 | unsigned char gssapi_delegation; /* inherited from set.gssapi_delegation */
|
---|
1002 | };
|
---|
1003 |
|
---|
1004 | #ifndef CURL_DISABLE_PROXY
|
---|
1005 | #define CURL_CONN_HOST_DISPNAME(c) \
|
---|
1006 | ((c)->bits.socksproxy ? (c)->socks_proxy.host.dispname : \
|
---|
1007 | (c)->bits.httpproxy ? (c)->http_proxy.host.dispname : \
|
---|
1008 | (c)->bits.conn_to_host ? (c)->conn_to_host.dispname : \
|
---|
1009 | (c)->host.dispname)
|
---|
1010 | #else
|
---|
1011 | #define CURL_CONN_HOST_DISPNAME(c) \
|
---|
1012 | (c)->bits.conn_to_host ? (c)->conn_to_host.dispname : \
|
---|
1013 | (c)->host.dispname
|
---|
1014 | #endif
|
---|
1015 |
|
---|
1016 | /* The end of connectdata. */
|
---|
1017 |
|
---|
1018 | /*
|
---|
1019 | * Struct to keep statistical and informational data.
|
---|
1020 | * All variables in this struct must be initialized/reset in Curl_initinfo().
|
---|
1021 | */
|
---|
1022 | struct PureInfo {
|
---|
1023 | int httpcode; /* Recent HTTP, FTP, RTSP or SMTP response code */
|
---|
1024 | int httpproxycode; /* response code from proxy when received separate */
|
---|
1025 | int httpversion; /* the http version number X.Y = X*10+Y */
|
---|
1026 | time_t filetime; /* If requested, this is might get set. Set to -1 if the
|
---|
1027 | time was unretrievable. */
|
---|
1028 | curl_off_t request_size; /* the amount of bytes sent in the request(s) */
|
---|
1029 | unsigned long proxyauthavail; /* what proxy auth types were announced */
|
---|
1030 | unsigned long httpauthavail; /* what host auth types were announced */
|
---|
1031 | long numconnects; /* how many new connection did libcurl created */
|
---|
1032 | char *contenttype; /* the content type of the object */
|
---|
1033 | char *wouldredirect; /* URL this would've been redirected to if asked to */
|
---|
1034 | curl_off_t retry_after; /* info from Retry-After: header */
|
---|
1035 | unsigned int header_size; /* size of read header(s) in bytes */
|
---|
1036 |
|
---|
1037 | /* PureInfo primary ip_quadruple is copied over from the connectdata
|
---|
1038 | struct in order to allow curl_easy_getinfo() to return this information
|
---|
1039 | even when the session handle is no longer associated with a connection,
|
---|
1040 | and also allow curl_easy_reset() to clear this information from the
|
---|
1041 | session handle without disturbing information which is still alive, and
|
---|
1042 | that might be reused, in the connection cache. */
|
---|
1043 | struct ip_quadruple primary;
|
---|
1044 | int conn_remote_port; /* this is the "remote port", which is the port
|
---|
1045 | number of the used URL, independent of proxy or
|
---|
1046 | not */
|
---|
1047 | const char *conn_scheme;
|
---|
1048 | unsigned int conn_protocol;
|
---|
1049 | struct curl_certinfo certs; /* info about the certs. Asked for with
|
---|
1050 | CURLOPT_CERTINFO / CURLINFO_CERTINFO */
|
---|
1051 | CURLproxycode pxcode;
|
---|
1052 | BIT(timecond); /* set to TRUE if the time condition didn't match, which
|
---|
1053 | thus made the document NOT get fetched */
|
---|
1054 | BIT(used_proxy); /* the transfer used a proxy */
|
---|
1055 | };
|
---|
1056 |
|
---|
1057 |
|
---|
1058 | struct Progress {
|
---|
1059 | time_t lastshow; /* time() of the last displayed progress meter or NULL to
|
---|
1060 | force redraw at next call */
|
---|
1061 | curl_off_t size_dl; /* total expected size */
|
---|
1062 | curl_off_t size_ul; /* total expected size */
|
---|
1063 | curl_off_t downloaded; /* transferred so far */
|
---|
1064 | curl_off_t uploaded; /* transferred so far */
|
---|
1065 |
|
---|
1066 | curl_off_t current_speed; /* uses the currently fastest transfer */
|
---|
1067 |
|
---|
1068 | int width; /* screen width at download start */
|
---|
1069 | int flags; /* see progress.h */
|
---|
1070 |
|
---|
1071 | timediff_t timespent;
|
---|
1072 |
|
---|
1073 | curl_off_t dlspeed;
|
---|
1074 | curl_off_t ulspeed;
|
---|
1075 |
|
---|
1076 | timediff_t t_postqueue;
|
---|
1077 | timediff_t t_nslookup;
|
---|
1078 | timediff_t t_connect;
|
---|
1079 | timediff_t t_appconnect;
|
---|
1080 | timediff_t t_pretransfer;
|
---|
1081 | timediff_t t_starttransfer;
|
---|
1082 | timediff_t t_redirect;
|
---|
1083 |
|
---|
1084 | struct curltime start;
|
---|
1085 | struct curltime t_startsingle;
|
---|
1086 | struct curltime t_startop;
|
---|
1087 | struct curltime t_acceptdata;
|
---|
1088 |
|
---|
1089 |
|
---|
1090 | /* upload speed limit */
|
---|
1091 | struct curltime ul_limit_start;
|
---|
1092 | curl_off_t ul_limit_size;
|
---|
1093 | /* download speed limit */
|
---|
1094 | struct curltime dl_limit_start;
|
---|
1095 | curl_off_t dl_limit_size;
|
---|
1096 |
|
---|
1097 | #define CURR_TIME (5 + 1) /* 6 entries for 5 seconds */
|
---|
1098 |
|
---|
1099 | curl_off_t speeder[ CURR_TIME ];
|
---|
1100 | struct curltime speeder_time[ CURR_TIME ];
|
---|
1101 | int speeder_c;
|
---|
1102 | BIT(callback); /* set when progress callback is used */
|
---|
1103 | BIT(is_t_startransfer_set);
|
---|
1104 | };
|
---|
1105 |
|
---|
1106 | typedef enum {
|
---|
1107 | RTSPREQ_NONE, /* first in list */
|
---|
1108 | RTSPREQ_OPTIONS,
|
---|
1109 | RTSPREQ_DESCRIBE,
|
---|
1110 | RTSPREQ_ANNOUNCE,
|
---|
1111 | RTSPREQ_SETUP,
|
---|
1112 | RTSPREQ_PLAY,
|
---|
1113 | RTSPREQ_PAUSE,
|
---|
1114 | RTSPREQ_TEARDOWN,
|
---|
1115 | RTSPREQ_GET_PARAMETER,
|
---|
1116 | RTSPREQ_SET_PARAMETER,
|
---|
1117 | RTSPREQ_RECORD,
|
---|
1118 | RTSPREQ_RECEIVE,
|
---|
1119 | RTSPREQ_LAST /* last in list */
|
---|
1120 | } Curl_RtspReq;
|
---|
1121 |
|
---|
1122 | struct auth {
|
---|
1123 | unsigned long want; /* Bitmask set to the authentication methods wanted by
|
---|
1124 | app (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */
|
---|
1125 | unsigned long picked;
|
---|
1126 | unsigned long avail; /* Bitmask for what the server reports to support for
|
---|
1127 | this resource */
|
---|
1128 | BIT(done); /* TRUE when the auth phase is done and ready to do the
|
---|
1129 | actual request */
|
---|
1130 | BIT(multipass); /* TRUE if this is not yet authenticated but within the
|
---|
1131 | auth multipass negotiation */
|
---|
1132 | BIT(iestyle); /* TRUE if digest should be done IE-style or FALSE if it
|
---|
1133 | should be RFC compliant */
|
---|
1134 | };
|
---|
1135 |
|
---|
1136 | #ifdef USE_NGHTTP2
|
---|
1137 | struct Curl_data_prio_node {
|
---|
1138 | struct Curl_data_prio_node *next;
|
---|
1139 | struct Curl_easy *data;
|
---|
1140 | };
|
---|
1141 | #endif
|
---|
1142 |
|
---|
1143 | /**
|
---|
1144 | * Priority information for an easy handle in relation to others
|
---|
1145 | * on the same connection.
|
---|
1146 | * TODO: we need to adapt it to the new priority scheme as defined in RFC 9218
|
---|
1147 | */
|
---|
1148 | struct Curl_data_priority {
|
---|
1149 | #ifdef USE_NGHTTP2
|
---|
1150 | /* tree like dependencies only implemented in nghttp2 */
|
---|
1151 | struct Curl_easy *parent;
|
---|
1152 | struct Curl_data_prio_node *children;
|
---|
1153 | #endif
|
---|
1154 | int weight;
|
---|
1155 | #ifdef USE_NGHTTP2
|
---|
1156 | BIT(exclusive);
|
---|
1157 | #endif
|
---|
1158 | };
|
---|
1159 |
|
---|
1160 | /* Timers */
|
---|
1161 | typedef enum {
|
---|
1162 | EXPIRE_100_TIMEOUT,
|
---|
1163 | EXPIRE_ASYNC_NAME,
|
---|
1164 | EXPIRE_CONNECTTIMEOUT,
|
---|
1165 | EXPIRE_DNS_PER_NAME, /* family1 */
|
---|
1166 | EXPIRE_DNS_PER_NAME2, /* family2 */
|
---|
1167 | EXPIRE_HAPPY_EYEBALLS_DNS, /* See asyn-ares.c */
|
---|
1168 | EXPIRE_HAPPY_EYEBALLS,
|
---|
1169 | EXPIRE_MULTI_PENDING,
|
---|
1170 | EXPIRE_RUN_NOW,
|
---|
1171 | EXPIRE_SPEEDCHECK,
|
---|
1172 | EXPIRE_TIMEOUT,
|
---|
1173 | EXPIRE_TOOFAST,
|
---|
1174 | EXPIRE_QUIC,
|
---|
1175 | EXPIRE_FTP_ACCEPT,
|
---|
1176 | EXPIRE_ALPN_EYEBALLS,
|
---|
1177 | EXPIRE_LAST /* not an actual timer, used as a marker only */
|
---|
1178 | } expire_id;
|
---|
1179 |
|
---|
1180 |
|
---|
1181 | typedef enum {
|
---|
1182 | TRAILERS_NONE,
|
---|
1183 | TRAILERS_INITIALIZED,
|
---|
1184 | TRAILERS_SENDING,
|
---|
1185 | TRAILERS_DONE
|
---|
1186 | } trailers_state;
|
---|
1187 |
|
---|
1188 |
|
---|
1189 | /*
|
---|
1190 | * One instance for each timeout an easy handle can set.
|
---|
1191 | */
|
---|
1192 | struct time_node {
|
---|
1193 | struct Curl_llist_element list;
|
---|
1194 | struct curltime time;
|
---|
1195 | expire_id eid;
|
---|
1196 | };
|
---|
1197 |
|
---|
1198 | /* individual pieces of the URL */
|
---|
1199 | struct urlpieces {
|
---|
1200 | char *scheme;
|
---|
1201 | char *hostname;
|
---|
1202 | char *port;
|
---|
1203 | char *user;
|
---|
1204 | char *password;
|
---|
1205 | char *options;
|
---|
1206 | char *path;
|
---|
1207 | char *query;
|
---|
1208 | };
|
---|
1209 |
|
---|
1210 | struct UrlState {
|
---|
1211 | /* Points to the connection cache */
|
---|
1212 | struct conncache *conn_cache;
|
---|
1213 | /* buffers to store authentication data in, as parsed from input options */
|
---|
1214 | struct curltime keeps_speed; /* for the progress meter really */
|
---|
1215 |
|
---|
1216 | curl_off_t lastconnect_id; /* The last connection, -1 if undefined */
|
---|
1217 | curl_off_t recent_conn_id; /* The most recent connection used, might no
|
---|
1218 | * longer exist */
|
---|
1219 | struct dynbuf headerb; /* buffer to store headers in */
|
---|
1220 | struct curl_slist *hstslist; /* list of HSTS files set by
|
---|
1221 | curl_easy_setopt(HSTS) calls */
|
---|
1222 | curl_off_t current_speed; /* the ProgressShow() function sets this,
|
---|
1223 | bytes / second */
|
---|
1224 |
|
---|
1225 | /* host name, port number and protocol of the first (not followed) request.
|
---|
1226 | if set, this should be the host name that we will sent authorization to,
|
---|
1227 | no else. Used to make Location: following not keep sending user+password.
|
---|
1228 | This is strdup()ed data. */
|
---|
1229 | char *first_host;
|
---|
1230 | int first_remote_port;
|
---|
1231 | curl_prot_t first_remote_protocol;
|
---|
1232 |
|
---|
1233 | int retrycount; /* number of retries on a new connection */
|
---|
1234 | struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
|
---|
1235 | long sessionage; /* number of the most recent session */
|
---|
1236 | int os_errno; /* filled in with errno whenever an error occurs */
|
---|
1237 | char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
|
---|
1238 | long followlocation; /* redirect counter */
|
---|
1239 | int requests; /* request counter: redirects + authentication retakes */
|
---|
1240 | #ifdef HAVE_SIGNAL
|
---|
1241 | /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
|
---|
1242 | void (*prev_signal)(int sig);
|
---|
1243 | #endif
|
---|
1244 | #ifndef CURL_DISABLE_DIGEST_AUTH
|
---|
1245 | struct digestdata digest; /* state data for host Digest auth */
|
---|
1246 | struct digestdata proxydigest; /* state data for proxy Digest auth */
|
---|
1247 | #endif
|
---|
1248 | struct auth authhost; /* auth details for host */
|
---|
1249 | struct auth authproxy; /* auth details for proxy */
|
---|
1250 | #ifdef USE_CURL_ASYNC
|
---|
1251 | struct Curl_async async; /* asynchronous name resolver data */
|
---|
1252 | #endif
|
---|
1253 |
|
---|
1254 | #if defined(USE_OPENSSL)
|
---|
1255 | /* void instead of ENGINE to avoid bleeding OpenSSL into this header */
|
---|
1256 | void *engine;
|
---|
1257 | #endif /* USE_OPENSSL */
|
---|
1258 | struct curltime expiretime; /* set this with Curl_expire() only */
|
---|
1259 | struct Curl_tree timenode; /* for the splay stuff */
|
---|
1260 | struct Curl_llist timeoutlist; /* list of pending timeouts */
|
---|
1261 | struct time_node expires[EXPIRE_LAST]; /* nodes for each expire type */
|
---|
1262 |
|
---|
1263 | /* a place to store the most recently set (S)FTP entrypath */
|
---|
1264 | char *most_recent_ftp_entrypath;
|
---|
1265 | #if !defined(_WIN32) && !defined(MSDOS) && !defined(__EMX__)
|
---|
1266 | /* do FTP line-end conversions on most platforms */
|
---|
1267 | #define CURL_DO_LINEEND_CONV
|
---|
1268 | /* for FTP downloads: how many CRLFs did we converted to LFs? */
|
---|
1269 | curl_off_t crlf_conversions;
|
---|
1270 | #endif
|
---|
1271 | char *range; /* range, if used. See README for detailed specification on
|
---|
1272 | this syntax. */
|
---|
1273 | curl_off_t resume_from; /* continue [ftp] transfer from here */
|
---|
1274 |
|
---|
1275 | #ifndef CURL_DISABLE_RTSP
|
---|
1276 | /* This RTSP state information survives requests and connections */
|
---|
1277 | long rtsp_next_client_CSeq; /* the session's next client CSeq */
|
---|
1278 | long rtsp_next_server_CSeq; /* the session's next server CSeq */
|
---|
1279 | long rtsp_CSeq_recv; /* most recent CSeq received */
|
---|
1280 |
|
---|
1281 | unsigned char rtp_channel_mask[32]; /* for the correctness checking of the
|
---|
1282 | interleaved data */
|
---|
1283 | #endif
|
---|
1284 |
|
---|
1285 | curl_off_t infilesize; /* size of file to upload, -1 means unknown.
|
---|
1286 | Copied from set.filesize at start of operation */
|
---|
1287 | #if defined(USE_HTTP2) || defined(USE_HTTP3)
|
---|
1288 | struct Curl_data_priority priority; /* shallow copy of data->set */
|
---|
1289 | #endif
|
---|
1290 |
|
---|
1291 | curl_read_callback fread_func; /* read callback/function */
|
---|
1292 | void *in; /* CURLOPT_READDATA */
|
---|
1293 | CURLU *uh; /* URL handle for the current parsed URL */
|
---|
1294 | struct urlpieces up;
|
---|
1295 | char *url; /* work URL, copied from UserDefined */
|
---|
1296 | char *referer; /* referer string */
|
---|
1297 | struct curl_slist *resolve; /* set to point to the set.resolve list when
|
---|
1298 | this should be dealt with in pretransfer */
|
---|
1299 | #ifndef CURL_DISABLE_HTTP
|
---|
1300 | curl_mimepart *mimepost;
|
---|
1301 | #ifndef CURL_DISABLE_FORM_API
|
---|
1302 | curl_mimepart *formp; /* storage for old API form-posting, allocated on
|
---|
1303 | demand */
|
---|
1304 | #endif
|
---|
1305 | size_t trailers_bytes_sent;
|
---|
1306 | struct dynbuf trailers_buf; /* a buffer containing the compiled trailing
|
---|
1307 | headers */
|
---|
1308 | struct Curl_llist httphdrs; /* received headers */
|
---|
1309 | struct curl_header headerout[2]; /* for external purposes */
|
---|
1310 | struct Curl_header_store *prevhead; /* the latest added header */
|
---|
1311 | trailers_state trailers_state; /* whether we are sending trailers
|
---|
1312 | and what stage are we at */
|
---|
1313 | #endif
|
---|
1314 | #ifndef CURL_DISABLE_COOKIES
|
---|
1315 | struct curl_slist *cookielist; /* list of cookie files set by
|
---|
1316 | curl_easy_setopt(COOKIEFILE) calls */
|
---|
1317 | #endif
|
---|
1318 | #ifdef USE_HYPER
|
---|
1319 | bool hconnect; /* set if a CONNECT request */
|
---|
1320 | CURLcode hresult; /* used to pass return codes back from hyper callbacks */
|
---|
1321 | #endif
|
---|
1322 |
|
---|
1323 | #ifndef CURL_DISABLE_VERBOSE_STRINGS
|
---|
1324 | struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */
|
---|
1325 | #endif
|
---|
1326 |
|
---|
1327 | /* Dynamically allocated strings, MUST be freed before this struct is
|
---|
1328 | killed. */
|
---|
1329 | struct dynamically_allocated_data {
|
---|
1330 | char *proxyuserpwd;
|
---|
1331 | char *uagent;
|
---|
1332 | char *accept_encoding;
|
---|
1333 | char *userpwd;
|
---|
1334 | char *rangeline;
|
---|
1335 | char *ref;
|
---|
1336 | char *host;
|
---|
1337 | char *cookiehost;
|
---|
1338 | char *rtsp_transport;
|
---|
1339 | char *te; /* TE: request header */
|
---|
1340 |
|
---|
1341 | /* transfer credentials */
|
---|
1342 | char *user;
|
---|
1343 | char *passwd;
|
---|
1344 | char *proxyuser;
|
---|
1345 | char *proxypasswd;
|
---|
1346 | } aptr;
|
---|
1347 |
|
---|
1348 | unsigned char httpwant; /* when non-zero, a specific HTTP version requested
|
---|
1349 | to be used in the library's request(s) */
|
---|
1350 | unsigned char httpversion; /* the lowest HTTP version*10 reported by any
|
---|
1351 | server involved in this request */
|
---|
1352 | unsigned char httpreq; /* Curl_HttpReq; what kind of HTTP request (if any)
|
---|
1353 | is this */
|
---|
1354 | unsigned char select_bits; /* != 0 -> bitmask of socket events for this
|
---|
1355 | transfer overriding anything the socket may
|
---|
1356 | report */
|
---|
1357 | #ifdef CURLDEBUG
|
---|
1358 | BIT(conncache_lock);
|
---|
1359 | #endif
|
---|
1360 | /* when curl_easy_perform() is called, the multi handle is "owned" by
|
---|
1361 | the easy handle so curl_easy_cleanup() on such an easy handle will
|
---|
1362 | also close the multi handle! */
|
---|
1363 | BIT(multi_owned_by_easy);
|
---|
1364 |
|
---|
1365 | BIT(this_is_a_follow); /* this is a followed Location: request */
|
---|
1366 | BIT(refused_stream); /* this was refused, try again */
|
---|
1367 | BIT(errorbuf); /* Set to TRUE if the error buffer is already filled in.
|
---|
1368 | This must be set to FALSE every time _easy_perform() is
|
---|
1369 | called. */
|
---|
1370 | BIT(allow_port); /* Is set.use_port allowed to take effect or not. This
|
---|
1371 | is always set TRUE when curl_easy_perform() is called. */
|
---|
1372 | BIT(authproblem); /* TRUE if there's some problem authenticating */
|
---|
1373 | /* set after initial USER failure, to prevent an authentication loop */
|
---|
1374 | BIT(wildcardmatch); /* enable wildcard matching */
|
---|
1375 | BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous
|
---|
1376 | 417 response */
|
---|
1377 | BIT(use_range);
|
---|
1378 | BIT(rangestringalloc); /* the range string is malloc()'ed */
|
---|
1379 | BIT(done); /* set to FALSE when Curl_init_do() is called and set to TRUE
|
---|
1380 | when multi_done() is called, to prevent multi_done() to get
|
---|
1381 | invoked twice when the multi interface is used. */
|
---|
1382 | BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
|
---|
1383 | #ifndef CURL_DISABLE_COOKIES
|
---|
1384 | BIT(cookie_engine);
|
---|
1385 | #endif
|
---|
1386 | BIT(prefer_ascii); /* ASCII rather than binary */
|
---|
1387 | #ifdef CURL_LIST_ONLY_PROTOCOL
|
---|
1388 | BIT(list_only); /* list directory contents */
|
---|
1389 | #endif
|
---|
1390 | BIT(url_alloc); /* URL string is malloc()'ed */
|
---|
1391 | BIT(referer_alloc); /* referer string is malloc()ed */
|
---|
1392 | BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */
|
---|
1393 | BIT(upload); /* upload request */
|
---|
1394 | BIT(internal); /* internal: true if this easy handle was created for
|
---|
1395 | internal use and the user does not have ownership of the
|
---|
1396 | handle. */
|
---|
1397 | };
|
---|
1398 |
|
---|
1399 | /*
|
---|
1400 | * This 'UserDefined' struct must only contain data that is set once to go
|
---|
1401 | * for many (perhaps) independent connections. Values that are generated or
|
---|
1402 | * calculated internally for the "session handle" MUST be defined within the
|
---|
1403 | * 'struct UrlState' instead. The only exceptions MUST note the changes in
|
---|
1404 | * the 'DynamicStatic' struct.
|
---|
1405 | * Character pointer fields point to dynamic storage, unless otherwise stated.
|
---|
1406 | */
|
---|
1407 |
|
---|
1408 | struct Curl_multi; /* declared in multihandle.c */
|
---|
1409 |
|
---|
1410 | /*
|
---|
1411 | * This enumeration MUST not use conditional directives (#ifdefs), new
|
---|
1412 | * null terminated strings MUST be added to the enumeration immediately
|
---|
1413 | * before STRING_LASTZEROTERMINATED, binary fields immediately before
|
---|
1414 | * STRING_LAST. When doing so, ensure that the packages/OS400/chkstring.c
|
---|
1415 | * test is updated and applicable changes for EBCDIC to ASCII conversion
|
---|
1416 | * are catered for in curl_easy_setopt_ccsid()
|
---|
1417 | */
|
---|
1418 | enum dupstring {
|
---|
1419 | STRING_CERT, /* client certificate file name */
|
---|
1420 | STRING_CERT_PROXY, /* client certificate file name */
|
---|
1421 | STRING_CERT_TYPE, /* format for certificate (default: PEM)*/
|
---|
1422 | STRING_CERT_TYPE_PROXY, /* format for certificate (default: PEM)*/
|
---|
1423 | STRING_COOKIE, /* HTTP cookie string to send */
|
---|
1424 | STRING_COOKIEJAR, /* dump all cookies to this file */
|
---|
1425 | STRING_CUSTOMREQUEST, /* HTTP/FTP/RTSP request/method to use */
|
---|
1426 | STRING_DEFAULT_PROTOCOL, /* Protocol to use when the URL doesn't specify */
|
---|
1427 | STRING_DEVICE, /* local network interface/address to use */
|
---|
1428 | STRING_ENCODING, /* Accept-Encoding string */
|
---|
1429 | STRING_FTP_ACCOUNT, /* ftp account data */
|
---|
1430 | STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */
|
---|
1431 | STRING_FTPPORT, /* port to send with the FTP PORT command */
|
---|
1432 | STRING_KEY, /* private key file name */
|
---|
1433 | STRING_KEY_PROXY, /* private key file name */
|
---|
1434 | STRING_KEY_PASSWD, /* plain text private key password */
|
---|
1435 | STRING_KEY_PASSWD_PROXY, /* plain text private key password */
|
---|
1436 | STRING_KEY_TYPE, /* format for private key (default: PEM) */
|
---|
1437 | STRING_KEY_TYPE_PROXY, /* format for private key (default: PEM) */
|
---|
1438 | STRING_KRB_LEVEL, /* krb security level */
|
---|
1439 | STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find
|
---|
1440 | $HOME/.netrc */
|
---|
1441 | STRING_PROXY, /* proxy to use */
|
---|
1442 | STRING_PRE_PROXY, /* pre socks proxy to use */
|
---|
1443 | STRING_SET_RANGE, /* range, if used */
|
---|
1444 | STRING_SET_REFERER, /* custom string for the HTTP referer field */
|
---|
1445 | STRING_SET_URL, /* what original URL to work on */
|
---|
1446 | STRING_SSL_CAPATH, /* CA directory name (doesn't work on windows) */
|
---|
1447 | STRING_SSL_CAPATH_PROXY, /* CA directory name (doesn't work on windows) */
|
---|
1448 | STRING_SSL_CAFILE, /* certificate file to verify peer against */
|
---|
1449 | STRING_SSL_CAFILE_PROXY, /* certificate file to verify peer against */
|
---|
1450 | STRING_SSL_PINNEDPUBLICKEY, /* public key file to verify peer against */
|
---|
1451 | STRING_SSL_PINNEDPUBLICKEY_PROXY, /* public key file to verify proxy */
|
---|
1452 | STRING_SSL_CIPHER_LIST, /* list of ciphers to use */
|
---|
1453 | STRING_SSL_CIPHER_LIST_PROXY, /* list of ciphers to use */
|
---|
1454 | STRING_SSL_CIPHER13_LIST, /* list of TLS 1.3 ciphers to use */
|
---|
1455 | STRING_SSL_CIPHER13_LIST_PROXY, /* list of TLS 1.3 ciphers to use */
|
---|
1456 | STRING_USERAGENT, /* User-Agent string */
|
---|
1457 | STRING_SSL_CRLFILE, /* crl file to check certificate */
|
---|
1458 | STRING_SSL_CRLFILE_PROXY, /* crl file to check certificate */
|
---|
1459 | STRING_SSL_ISSUERCERT, /* issuer cert file to check certificate */
|
---|
1460 | STRING_SSL_ISSUERCERT_PROXY, /* issuer cert file to check certificate */
|
---|
1461 | STRING_SSL_ENGINE, /* name of ssl engine */
|
---|
1462 | STRING_USERNAME, /* <username>, if used */
|
---|
1463 | STRING_PASSWORD, /* <password>, if used */
|
---|
1464 | STRING_OPTIONS, /* <options>, if used */
|
---|
1465 | STRING_PROXYUSERNAME, /* Proxy <username>, if used */
|
---|
1466 | STRING_PROXYPASSWORD, /* Proxy <password>, if used */
|
---|
1467 | STRING_NOPROXY, /* List of hosts which should not use the proxy, if
|
---|
1468 | used */
|
---|
1469 | STRING_RTSP_SESSION_ID, /* Session ID to use */
|
---|
1470 | STRING_RTSP_STREAM_URI, /* Stream URI for this request */
|
---|
1471 | STRING_RTSP_TRANSPORT, /* Transport for this session */
|
---|
1472 | STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */
|
---|
1473 | STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */
|
---|
1474 | STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ascii hex */
|
---|
1475 | STRING_SSH_HOST_PUBLIC_KEY_SHA256, /* sha256 of host public key in base64 */
|
---|
1476 | STRING_SSH_KNOWNHOSTS, /* file name of knownhosts file */
|
---|
1477 | STRING_PROXY_SERVICE_NAME, /* Proxy service name */
|
---|
1478 | STRING_SERVICE_NAME, /* Service name */
|
---|
1479 | STRING_MAIL_FROM,
|
---|
1480 | STRING_MAIL_AUTH,
|
---|
1481 | STRING_TLSAUTH_USERNAME, /* TLS auth <username> */
|
---|
1482 | STRING_TLSAUTH_USERNAME_PROXY, /* TLS auth <username> */
|
---|
1483 | STRING_TLSAUTH_PASSWORD, /* TLS auth <password> */
|
---|
1484 | STRING_TLSAUTH_PASSWORD_PROXY, /* TLS auth <password> */
|
---|
1485 | STRING_BEARER, /* <bearer>, if used */
|
---|
1486 | STRING_UNIX_SOCKET_PATH, /* path to Unix socket, if used */
|
---|
1487 | STRING_TARGET, /* CURLOPT_REQUEST_TARGET */
|
---|
1488 | STRING_DOH, /* CURLOPT_DOH_URL */
|
---|
1489 | STRING_ALTSVC, /* CURLOPT_ALTSVC */
|
---|
1490 | STRING_HSTS, /* CURLOPT_HSTS */
|
---|
1491 | STRING_SASL_AUTHZID, /* CURLOPT_SASL_AUTHZID */
|
---|
1492 | STRING_DNS_SERVERS,
|
---|
1493 | STRING_DNS_INTERFACE,
|
---|
1494 | STRING_DNS_LOCAL_IP4,
|
---|
1495 | STRING_DNS_LOCAL_IP6,
|
---|
1496 | STRING_SSL_EC_CURVES,
|
---|
1497 | STRING_AWS_SIGV4, /* Parameters for V4 signature */
|
---|
1498 | STRING_HAPROXY_CLIENT_IP, /* CURLOPT_HAPROXY_CLIENT_IP */
|
---|
1499 |
|
---|
1500 | /* -- end of null-terminated strings -- */
|
---|
1501 |
|
---|
1502 | STRING_LASTZEROTERMINATED,
|
---|
1503 |
|
---|
1504 | /* -- below this are pointers to binary data that cannot be strdup'ed. --- */
|
---|
1505 |
|
---|
1506 | STRING_COPYPOSTFIELDS, /* if POST, set the fields' values here */
|
---|
1507 |
|
---|
1508 | STRING_LAST /* not used, just an end-of-list marker */
|
---|
1509 | };
|
---|
1510 |
|
---|
1511 | enum dupblob {
|
---|
1512 | BLOB_CERT,
|
---|
1513 | BLOB_CERT_PROXY,
|
---|
1514 | BLOB_KEY,
|
---|
1515 | BLOB_KEY_PROXY,
|
---|
1516 | BLOB_SSL_ISSUERCERT,
|
---|
1517 | BLOB_SSL_ISSUERCERT_PROXY,
|
---|
1518 | BLOB_CAINFO,
|
---|
1519 | BLOB_CAINFO_PROXY,
|
---|
1520 | BLOB_LAST
|
---|
1521 | };
|
---|
1522 |
|
---|
1523 | /* callback that gets called when this easy handle is completed within a multi
|
---|
1524 | handle. Only used for internally created transfers, like for example
|
---|
1525 | DoH. */
|
---|
1526 | typedef int (*multidone_func)(struct Curl_easy *easy, CURLcode result);
|
---|
1527 |
|
---|
1528 | struct UserDefined {
|
---|
1529 | FILE *err; /* the stderr user data goes here */
|
---|
1530 | void *debugdata; /* the data that will be passed to fdebug */
|
---|
1531 | char *errorbuffer; /* (Static) store failure messages in here */
|
---|
1532 | void *out; /* CURLOPT_WRITEDATA */
|
---|
1533 | void *in_set; /* CURLOPT_READDATA */
|
---|
1534 | void *writeheader; /* write the header to this if non-NULL */
|
---|
1535 | unsigned short use_port; /* which port to use (when not using default) */
|
---|
1536 | unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */
|
---|
1537 | unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */
|
---|
1538 | long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
|
---|
1539 | for infinity */
|
---|
1540 |
|
---|
1541 | void *postfields; /* if POST, set the fields' values here */
|
---|
1542 | curl_seek_callback seek_func; /* function that seeks the input */
|
---|
1543 | curl_off_t postfieldsize; /* if POST, this might have a size to use instead
|
---|
1544 | of strlen(), and then the data *may* be binary
|
---|
1545 | (contain zero bytes) */
|
---|
1546 | #ifndef CURL_DISABLE_BINDLOCAL
|
---|
1547 | unsigned short localport; /* local port number to bind to */
|
---|
1548 | unsigned short localportrange; /* number of additional port numbers to test
|
---|
1549 | in case the 'localport' one can't be
|
---|
1550 | bind()ed */
|
---|
1551 | #endif
|
---|
1552 | curl_write_callback fwrite_func; /* function that stores the output */
|
---|
1553 | curl_write_callback fwrite_header; /* function that stores headers */
|
---|
1554 | curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */
|
---|
1555 | curl_read_callback fread_func_set; /* function that reads the input */
|
---|
1556 | curl_progress_callback fprogress; /* OLD and deprecated progress callback */
|
---|
1557 | curl_xferinfo_callback fxferinfo; /* progress callback */
|
---|
1558 | curl_debug_callback fdebug; /* function that write informational data */
|
---|
1559 | curl_ioctl_callback ioctl_func; /* function for I/O control */
|
---|
1560 | curl_sockopt_callback fsockopt; /* function for setting socket options */
|
---|
1561 | void *sockopt_client; /* pointer to pass to the socket options callback */
|
---|
1562 | curl_opensocket_callback fopensocket; /* function for checking/translating
|
---|
1563 | the address and opening the
|
---|
1564 | socket */
|
---|
1565 | void *opensocket_client;
|
---|
1566 | curl_closesocket_callback fclosesocket; /* function for closing the
|
---|
1567 | socket */
|
---|
1568 | void *closesocket_client;
|
---|
1569 | curl_prereq_callback fprereq; /* pre-initial request callback */
|
---|
1570 | void *prereq_userp; /* pre-initial request user data */
|
---|
1571 |
|
---|
1572 | void *seek_client; /* pointer to pass to the seek callback */
|
---|
1573 | #ifndef CURL_DISABLE_HSTS
|
---|
1574 | curl_hstsread_callback hsts_read;
|
---|
1575 | void *hsts_read_userp;
|
---|
1576 | curl_hstswrite_callback hsts_write;
|
---|
1577 | void *hsts_write_userp;
|
---|
1578 | #endif
|
---|
1579 | void *progress_client; /* pointer to pass to the progress callback */
|
---|
1580 | void *ioctl_client; /* pointer to pass to the ioctl callback */
|
---|
1581 | unsigned int timeout; /* ms, 0 means no timeout */
|
---|
1582 | unsigned int connecttimeout; /* ms, 0 means no timeout */
|
---|
1583 | unsigned int happy_eyeballs_timeout; /* ms, 0 is a valid value */
|
---|
1584 | unsigned int server_response_timeout; /* ms, 0 means no timeout */
|
---|
1585 | long maxage_conn; /* in seconds, max idle time to allow a connection that
|
---|
1586 | is to be reused */
|
---|
1587 | long maxlifetime_conn; /* in seconds, max time since creation to allow a
|
---|
1588 | connection that is to be reused */
|
---|
1589 | #ifndef CURL_DISABLE_TFTP
|
---|
1590 | long tftp_blksize; /* in bytes, 0 means use default */
|
---|
1591 | #endif
|
---|
1592 | curl_off_t filesize; /* size of file to upload, -1 means unknown */
|
---|
1593 | long low_speed_limit; /* bytes/second */
|
---|
1594 | long low_speed_time; /* number of seconds */
|
---|
1595 | curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */
|
---|
1596 | curl_off_t max_recv_speed; /* high speed limit in bytes/second for
|
---|
1597 | download */
|
---|
1598 | curl_off_t set_resume_from; /* continue [ftp] transfer from here */
|
---|
1599 | struct curl_slist *headers; /* linked list of extra headers */
|
---|
1600 | struct curl_httppost *httppost; /* linked list of old POST data */
|
---|
1601 | #if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
|
---|
1602 | curl_mimepart mimepost; /* MIME/POST data. */
|
---|
1603 | #endif
|
---|
1604 | #ifndef CURL_DISABLE_TELNET
|
---|
1605 | struct curl_slist *telnet_options; /* linked list of telnet options */
|
---|
1606 | #endif
|
---|
1607 | struct curl_slist *resolve; /* list of names to add/remove from
|
---|
1608 | DNS cache */
|
---|
1609 | struct curl_slist *connect_to; /* list of host:port mappings to override
|
---|
1610 | the hostname and port to connect to */
|
---|
1611 | time_t timevalue; /* what time to compare with */
|
---|
1612 | unsigned char timecondition; /* kind of time comparison: curl_TimeCond */
|
---|
1613 | unsigned char method; /* what kind of HTTP request: Curl_HttpReq */
|
---|
1614 | unsigned char httpwant; /* when non-zero, a specific HTTP version requested
|
---|
1615 | to be used in the library's request(s) */
|
---|
1616 | struct ssl_config_data ssl; /* user defined SSL stuff */
|
---|
1617 | #ifndef CURL_DISABLE_PROXY
|
---|
1618 | struct ssl_config_data proxy_ssl; /* user defined SSL stuff for proxy */
|
---|
1619 | struct curl_slist *proxyheaders; /* linked list of extra CONNECT headers */
|
---|
1620 | unsigned short proxyport; /* If non-zero, use this port number by
|
---|
1621 | default. If the proxy string features a
|
---|
1622 | ":[port]" that one will override this. */
|
---|
1623 | unsigned char proxytype; /* what kind of proxy: curl_proxytype */
|
---|
1624 | unsigned char socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */
|
---|
1625 | #endif
|
---|
1626 | struct ssl_general_config general_ssl; /* general user defined SSL stuff */
|
---|
1627 | int dns_cache_timeout; /* DNS cache timeout (seconds) */
|
---|
1628 | unsigned int buffer_size; /* size of receive buffer to use */
|
---|
1629 | unsigned int upload_buffer_size; /* size of upload buffer to use,
|
---|
1630 | keep it >= CURL_MAX_WRITE_SIZE */
|
---|
1631 | void *private_data; /* application-private data */
|
---|
1632 | #ifndef CURL_DISABLE_HTTP
|
---|
1633 | struct curl_slist *http200aliases; /* linked list of aliases for http200 */
|
---|
1634 | #endif
|
---|
1635 | unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header
|
---|
1636 | file 0 - whatever, 1 - v2, 2 - v6 */
|
---|
1637 | curl_off_t max_filesize; /* Maximum file size to download */
|
---|
1638 | #ifndef CURL_DISABLE_FTP
|
---|
1639 | unsigned char ftp_filemethod; /* how to get to a file: curl_ftpfile */
|
---|
1640 | unsigned char ftpsslauth; /* what AUTH XXX to try: curl_ftpauth */
|
---|
1641 | unsigned char ftp_ccc; /* FTP CCC options: curl_ftpccc */
|
---|
1642 | unsigned int accepttimeout; /* in milliseconds, 0 means no timeout */
|
---|
1643 | #endif
|
---|
1644 | #if !defined(CURL_DISABLE_FTP) || defined(USE_SSH)
|
---|
1645 | struct curl_slist *quote; /* after connection is established */
|
---|
1646 | struct curl_slist *postquote; /* after the transfer */
|
---|
1647 | struct curl_slist *prequote; /* before the transfer, after type */
|
---|
1648 | /* Despite the name, ftp_create_missing_dirs is for FTP(S) and SFTP
|
---|
1649 | 1 - create directories that don't exist
|
---|
1650 | 2 - the same but also allow MKD to fail once
|
---|
1651 | */
|
---|
1652 | unsigned char ftp_create_missing_dirs;
|
---|
1653 | #endif
|
---|
1654 | #ifdef USE_LIBSSH2
|
---|
1655 | curl_sshhostkeycallback ssh_hostkeyfunc; /* hostkey check callback */
|
---|
1656 | void *ssh_hostkeyfunc_userp; /* custom pointer to callback */
|
---|
1657 | #endif
|
---|
1658 | #ifdef USE_SSH
|
---|
1659 | curl_sshkeycallback ssh_keyfunc; /* key matching callback */
|
---|
1660 | void *ssh_keyfunc_userp; /* custom pointer to callback */
|
---|
1661 | int ssh_auth_types; /* allowed SSH auth types */
|
---|
1662 | unsigned int new_directory_perms; /* when creating remote dirs */
|
---|
1663 | #endif
|
---|
1664 | #ifndef CURL_DISABLE_NETRC
|
---|
1665 | unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */
|
---|
1666 | #endif
|
---|
1667 | unsigned int new_file_perms; /* when creating remote files */
|
---|
1668 | char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
|
---|
1669 | struct curl_blob *blobs[BLOB_LAST];
|
---|
1670 | #ifdef ENABLE_IPV6
|
---|
1671 | unsigned int scope_id; /* Scope id for IPv6 */
|
---|
1672 | #endif
|
---|
1673 | curl_prot_t allowed_protocols;
|
---|
1674 | curl_prot_t redir_protocols;
|
---|
1675 | #ifndef CURL_DISABLE_RTSP
|
---|
1676 | void *rtp_out; /* write RTP to this if non-NULL */
|
---|
1677 | /* Common RTSP header options */
|
---|
1678 | Curl_RtspReq rtspreq; /* RTSP request type */
|
---|
1679 | #endif
|
---|
1680 | #ifndef CURL_DISABLE_FTP
|
---|
1681 | curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer
|
---|
1682 | starts */
|
---|
1683 | curl_chunk_end_callback chunk_end; /* called after part transferring
|
---|
1684 | stopped */
|
---|
1685 | curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds
|
---|
1686 | to pattern (e.g. if WILDCARDMATCH is on) */
|
---|
1687 | void *fnmatch_data;
|
---|
1688 | void *wildcardptr;
|
---|
1689 | #endif
|
---|
1690 | /* GSS-API credential delegation, see the documentation of
|
---|
1691 | CURLOPT_GSSAPI_DELEGATION */
|
---|
1692 | unsigned char gssapi_delegation;
|
---|
1693 |
|
---|
1694 | int tcp_keepidle; /* seconds in idle before sending keepalive probe */
|
---|
1695 | int tcp_keepintvl; /* seconds between TCP keepalive probes */
|
---|
1696 |
|
---|
1697 | long expect_100_timeout; /* in milliseconds */
|
---|
1698 | #if defined(USE_HTTP2) || defined(USE_HTTP3)
|
---|
1699 | struct Curl_data_priority priority;
|
---|
1700 | #endif
|
---|
1701 | curl_resolver_start_callback resolver_start; /* optional callback called
|
---|
1702 | before resolver start */
|
---|
1703 | void *resolver_start_client; /* pointer to pass to resolver start callback */
|
---|
1704 | long upkeep_interval_ms; /* Time between calls for connection upkeep. */
|
---|
1705 | multidone_func fmultidone;
|
---|
1706 | #ifndef CURL_DISABLE_DOH
|
---|
1707 | struct Curl_easy *dohfor; /* this is a DoH request for that transfer */
|
---|
1708 | #endif
|
---|
1709 | CURLU *uh; /* URL handle for the current parsed URL */
|
---|
1710 | #ifndef CURL_DISABLE_HTTP
|
---|
1711 | void *trailer_data; /* pointer to pass to trailer data callback */
|
---|
1712 | curl_trailer_callback trailer_callback; /* trailing data callback */
|
---|
1713 | #endif
|
---|
1714 | char keep_post; /* keep POSTs as POSTs after a 30x request; each
|
---|
1715 | bit represents a request, from 301 to 303 */
|
---|
1716 | #ifndef CURL_DISABLE_SMTP
|
---|
1717 | struct curl_slist *mail_rcpt; /* linked list of mail recipients */
|
---|
1718 | BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
|
---|
1719 | recipients */
|
---|
1720 | #endif
|
---|
1721 | unsigned int maxconnects; /* Max idle connections in the connection cache */
|
---|
1722 | unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
|
---|
1723 | IMAP or POP3 or others! (type: curl_usessl)*/
|
---|
1724 | unsigned char connect_only; /* make connection/request, then let
|
---|
1725 | application use the socket */
|
---|
1726 | #ifndef CURL_DISABLE_MIME
|
---|
1727 | BIT(mime_formescape);
|
---|
1728 | #endif
|
---|
1729 | BIT(is_fread_set); /* has read callback been set to non-NULL? */
|
---|
1730 | #ifndef CURL_DISABLE_TFTP
|
---|
1731 | BIT(tftp_no_options); /* do not send TFTP options requests */
|
---|
1732 | #endif
|
---|
1733 | BIT(sep_headers); /* handle host and proxy headers separately */
|
---|
1734 | #ifndef CURL_DISABLE_COOKIES
|
---|
1735 | BIT(cookiesession); /* new cookie session? */
|
---|
1736 | #endif
|
---|
1737 | BIT(crlf); /* convert crlf on ftp upload(?) */
|
---|
1738 | BIT(ssh_compression); /* enable SSH compression */
|
---|
1739 |
|
---|
1740 | /* Here follows boolean settings that define how to behave during
|
---|
1741 | this session. They are STATIC, set by libcurl users or at least initially
|
---|
1742 | and they don't change during operations. */
|
---|
1743 | BIT(quick_exit); /* set 1L when it is okay to leak things (like
|
---|
1744 | threads), as we're about to exit() anyway and
|
---|
1745 | don't want lengthy cleanups to delay termination,
|
---|
1746 | e.g. after a DNS timeout */
|
---|
1747 | BIT(get_filetime); /* get the time and get of the remote file */
|
---|
1748 | BIT(tunnel_thru_httpproxy); /* use CONNECT through an HTTP proxy */
|
---|
1749 | BIT(prefer_ascii); /* ASCII rather than binary */
|
---|
1750 | BIT(remote_append); /* append, not overwrite, on upload */
|
---|
1751 | #ifdef CURL_LIST_ONLY_PROTOCOL
|
---|
1752 | BIT(list_only); /* list directory */
|
---|
1753 | #endif
|
---|
1754 | #ifndef CURL_DISABLE_FTP
|
---|
1755 | BIT(ftp_use_port); /* use the FTP PORT command */
|
---|
1756 | BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
|
---|
1757 | BIT(ftp_use_eprt); /* if EPRT is to be attempted or not */
|
---|
1758 | BIT(ftp_use_pret); /* if PRET is to be used before PASV or not */
|
---|
1759 | BIT(ftp_skip_ip); /* skip the IP address the FTP server passes on to
|
---|
1760 | us */
|
---|
1761 | BIT(wildcard_enabled); /* enable wildcard matching */
|
---|
1762 | #endif
|
---|
1763 | BIT(hide_progress); /* don't use the progress meter */
|
---|
1764 | BIT(http_fail_on_error); /* fail on HTTP error codes >= 400 */
|
---|
1765 | BIT(http_keep_sending_on_error); /* for HTTP status codes >= 300 */
|
---|
1766 | BIT(http_follow_location); /* follow HTTP redirects */
|
---|
1767 | BIT(http_transfer_encoding); /* request compressed HTTP transfer-encoding */
|
---|
1768 | BIT(allow_auth_to_other_hosts);
|
---|
1769 | BIT(include_header); /* include received protocol headers in data output */
|
---|
1770 | BIT(http_set_referer); /* is a custom referer used */
|
---|
1771 | BIT(http_auto_referer); /* set "correct" referer when following
|
---|
1772 | location: */
|
---|
1773 | BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
|
---|
1774 | BIT(verbose); /* output verbosity */
|
---|
1775 | BIT(krb); /* Kerberos connection requested */
|
---|
1776 | BIT(reuse_forbid); /* forbidden to be reused, close after use */
|
---|
1777 | BIT(reuse_fresh); /* do not reuse an existing connection */
|
---|
1778 | BIT(no_signal); /* do not use any signal/alarm handler */
|
---|
1779 | BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */
|
---|
1780 | BIT(ignorecl); /* ignore content length */
|
---|
1781 | BIT(http_te_skip); /* pass the raw body data to the user, even when
|
---|
1782 | transfer-encoded (chunked, compressed) */
|
---|
1783 | BIT(http_ce_skip); /* pass the raw body data to the user, even when
|
---|
1784 | content-encoded (chunked, compressed) */
|
---|
1785 | BIT(proxy_transfer_mode); /* set transfer mode (;type=<a|i>) when doing
|
---|
1786 | FTP via an HTTP proxy */
|
---|
1787 | #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
|
---|
1788 | BIT(socks5_gssapi_nec); /* Flag to support NEC SOCKS5 server */
|
---|
1789 | #endif
|
---|
1790 | BIT(sasl_ir); /* Enable/disable SASL initial response */
|
---|
1791 | BIT(tcp_keepalive); /* use TCP keepalives */
|
---|
1792 | BIT(tcp_fastopen); /* use TCP Fast Open */
|
---|
1793 | BIT(ssl_enable_alpn);/* TLS ALPN extension? */
|
---|
1794 | BIT(path_as_is); /* allow dotdots? */
|
---|
1795 | BIT(pipewait); /* wait for multiplex status before starting a new
|
---|
1796 | connection */
|
---|
1797 | BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
|
---|
1798 | from user callbacks */
|
---|
1799 | BIT(dns_shuffle_addresses); /* whether to shuffle addresses before use */
|
---|
1800 | BIT(haproxyprotocol); /* whether to send HAProxy PROXY protocol v1
|
---|
1801 | header */
|
---|
1802 | BIT(abstract_unix_socket);
|
---|
1803 | BIT(disallow_username_in_url); /* disallow username in url */
|
---|
1804 | #ifndef CURL_DISABLE_DOH
|
---|
1805 | BIT(doh); /* DNS-over-HTTPS enabled */
|
---|
1806 | BIT(doh_verifypeer); /* DoH certificate peer verification */
|
---|
1807 | BIT(doh_verifyhost); /* DoH certificate hostname verification */
|
---|
1808 | BIT(doh_verifystatus); /* DoH certificate status verification */
|
---|
1809 | #endif
|
---|
1810 | BIT(http09_allowed); /* allow HTTP/0.9 responses */
|
---|
1811 | #ifdef USE_WEBSOCKETS
|
---|
1812 | BIT(ws_raw_mode);
|
---|
1813 | #endif
|
---|
1814 | };
|
---|
1815 |
|
---|
1816 | #ifndef CURL_DISABLE_MIME
|
---|
1817 | #define IS_MIME_POST(a) ((a)->set.mimepost.kind != MIMEKIND_NONE)
|
---|
1818 | #else
|
---|
1819 | #define IS_MIME_POST(a) FALSE
|
---|
1820 | #endif
|
---|
1821 |
|
---|
1822 | struct Names {
|
---|
1823 | struct Curl_hash *hostcache;
|
---|
1824 | enum {
|
---|
1825 | HCACHE_NONE, /* not pointing to anything */
|
---|
1826 | HCACHE_MULTI, /* points to a shared one in the multi handle */
|
---|
1827 | HCACHE_SHARED /* points to a shared one in a shared object */
|
---|
1828 | } hostcachetype;
|
---|
1829 | };
|
---|
1830 |
|
---|
1831 | /*
|
---|
1832 | * The 'connectdata' struct MUST have all the connection oriented stuff as we
|
---|
1833 | * may have several simultaneous connections and connection structs in memory.
|
---|
1834 | *
|
---|
1835 | * The 'struct UserDefined' must only contain data that is set once to go for
|
---|
1836 | * many (perhaps) independent connections. Values that are generated or
|
---|
1837 | * calculated internally for the "session handle" must be defined within the
|
---|
1838 | * 'struct UrlState' instead.
|
---|
1839 | */
|
---|
1840 |
|
---|
1841 | struct Curl_easy {
|
---|
1842 | /* First a simple identifier to easier detect if a user mix up this easy
|
---|
1843 | handle with a multi handle. Set this to CURLEASY_MAGIC_NUMBER */
|
---|
1844 | unsigned int magic;
|
---|
1845 | /* once an easy handle is tied to a connection cache
|
---|
1846 | a non-negative number to distinguish this transfer from
|
---|
1847 | other using the same cache. For easier tracking
|
---|
1848 | in log output.
|
---|
1849 | This may wrap around after LONG_MAX to 0 again, so it
|
---|
1850 | has no uniqueness guarantee for very large processings. */
|
---|
1851 | curl_off_t id;
|
---|
1852 |
|
---|
1853 | /* first, two fields for the linked list of these */
|
---|
1854 | struct Curl_easy *next;
|
---|
1855 | struct Curl_easy *prev;
|
---|
1856 |
|
---|
1857 | struct connectdata *conn;
|
---|
1858 | struct Curl_llist_element connect_queue; /* for the pending and msgsent
|
---|
1859 | lists */
|
---|
1860 | struct Curl_llist_element conn_queue; /* list per connectdata */
|
---|
1861 |
|
---|
1862 | CURLMstate mstate; /* the handle's state */
|
---|
1863 | CURLcode result; /* previous result */
|
---|
1864 |
|
---|
1865 | struct Curl_message msg; /* A single posted message. */
|
---|
1866 |
|
---|
1867 | /* Array with the plain socket numbers this handle takes care of, in no
|
---|
1868 | particular order. Note that all sockets are added to the sockhash, where
|
---|
1869 | the state etc are also kept. This array is mostly used to detect when a
|
---|
1870 | socket is to be removed from the hash. See singlesocket(). */
|
---|
1871 | struct easy_pollset last_poll;
|
---|
1872 |
|
---|
1873 | struct Names dns;
|
---|
1874 | struct Curl_multi *multi; /* if non-NULL, points to the multi handle
|
---|
1875 | struct to which this "belongs" when used by
|
---|
1876 | the multi interface */
|
---|
1877 | struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle
|
---|
1878 | struct to which this "belongs" when used
|
---|
1879 | by the easy interface */
|
---|
1880 | struct Curl_share *share; /* Share, handles global variable mutexing */
|
---|
1881 | #ifdef USE_LIBPSL
|
---|
1882 | struct PslCache *psl; /* The associated PSL cache. */
|
---|
1883 | #endif
|
---|
1884 | struct SingleRequest req; /* Request-specific data */
|
---|
1885 | struct UserDefined set; /* values set by the libcurl user */
|
---|
1886 | #ifndef CURL_DISABLE_COOKIES
|
---|
1887 | struct CookieInfo *cookies; /* the cookies, read from files and servers.
|
---|
1888 | NOTE that the 'cookie' field in the
|
---|
1889 | UserDefined struct defines if the "engine"
|
---|
1890 | is to be used or not. */
|
---|
1891 | #endif
|
---|
1892 | #ifndef CURL_DISABLE_HSTS
|
---|
1893 | struct hsts *hsts;
|
---|
1894 | #endif
|
---|
1895 | #ifndef CURL_DISABLE_ALTSVC
|
---|
1896 | struct altsvcinfo *asi; /* the alt-svc cache */
|
---|
1897 | #endif
|
---|
1898 | struct Progress progress; /* for all the progress meter data */
|
---|
1899 | struct UrlState state; /* struct for fields used for state info and
|
---|
1900 | other dynamic purposes */
|
---|
1901 | #ifndef CURL_DISABLE_FTP
|
---|
1902 | struct WildcardData *wildcard; /* wildcard download state info */
|
---|
1903 | #endif
|
---|
1904 | struct PureInfo info; /* stats, reports and info data */
|
---|
1905 | struct curl_tlssessioninfo tsi; /* Information about the TLS session, only
|
---|
1906 | valid after a client has asked for it */
|
---|
1907 | #ifdef USE_HYPER
|
---|
1908 | struct hyptransfer hyp;
|
---|
1909 | #endif
|
---|
1910 | };
|
---|
1911 |
|
---|
1912 | #define LIBCURL_NAME "libcurl"
|
---|
1913 |
|
---|
1914 | #endif /* HEADER_CURL_URLDATA_H */
|
---|