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