source: asp3_tinet_ecnl_rx/trunk/curl-7.57.0/lib/urldata.h@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 72.1 KB
Line 
1#ifndef HEADER_CURL_URLDATA_H
2#define HEADER_CURL_URLDATA_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.haxx.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24
25/* This file is for lib internal stuff */
26
27#include "curl_setup.h"
28
29#define PORT_FTP 21
30#define PORT_FTPS 990
31#define PORT_TELNET 23
32#define PORT_HTTP 80
33#define PORT_HTTPS 443
34#define PORT_DICT 2628
35#define PORT_LDAP 389
36#define PORT_LDAPS 636
37#define PORT_TFTP 69
38#define PORT_SSH 22
39#define PORT_IMAP 143
40#define PORT_IMAPS 993
41#define PORT_POP3 110
42#define PORT_POP3S 995
43#define PORT_SMB 445
44#define PORT_SMBS 445
45#define PORT_SMTP 25
46#define PORT_SMTPS 465 /* sometimes called SSMTP */
47#define PORT_RTSP 554
48#define PORT_RTMP 1935
49#define PORT_RTMPT PORT_HTTP
50#define PORT_RTMPS PORT_HTTPS
51#define PORT_GOPHER 70
52
53#define DICT_MATCH "/MATCH:"
54#define DICT_MATCH2 "/M:"
55#define DICT_MATCH3 "/FIND:"
56#define DICT_DEFINE "/DEFINE:"
57#define DICT_DEFINE2 "/D:"
58#define DICT_DEFINE3 "/LOOKUP:"
59
60#define CURL_DEFAULT_USER "anonymous"
61#define CURL_DEFAULT_PASSWORD "ftp@example.com"
62
63/* Convenience defines for checking protocols or their SSL based version. Each
64 protocol handler should only ever have a single CURLPROTO_ in its protocol
65 field. */
66#define PROTO_FAMILY_HTTP (CURLPROTO_HTTP|CURLPROTO_HTTPS)
67#define PROTO_FAMILY_FTP (CURLPROTO_FTP|CURLPROTO_FTPS)
68#define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S)
69#define PROTO_FAMILY_SMB (CURLPROTO_SMB|CURLPROTO_SMBS)
70#define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
71
72#define DEFAULT_CONNCACHE_SIZE 5
73
74/* length of longest IPv6 address string including the trailing null */
75#define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")
76
77/* Default FTP/IMAP etc response timeout in milliseconds.
78 Symbian OS panics when given a timeout much greater than 1/2 hour.
79*/
80#define RESP_TIMEOUT (1800*1000)
81
82#include "cookie.h"
83#include "formdata.h"
84
85#ifdef HAVE_NETINET_IN_H
86#include <netinet/in.h>
87#endif
88
89#include "timeval.h"
90
91#include <curl/curl.h>
92
93#include "http_chunks.h" /* for the structs and enum stuff */
94#include "hostip.h"
95#include "hash.h"
96#include "splay.h"
97
98#include "mime.h"
99#include "imap.h"
100#include "pop3.h"
101#include "smtp.h"
102#include "ftp.h"
103#include "file.h"
104#include "ssh.h"
105#include "http.h"
106#include "rtsp.h"
107#include "smb.h"
108#include "wildcard.h"
109#include "multihandle.h"
110
111#ifdef HAVE_GSSAPI
112# ifdef HAVE_GSSGNU
113# include <gss.h>
114# elif defined HAVE_GSSMIT
115# include <gssapi/gssapi.h>
116# include <gssapi/gssapi_generic.h>
117# else
118# include <gssapi.h>
119# endif
120#endif
121
122#ifdef HAVE_LIBSSH2_H
123#include <libssh2.h>
124#include <libssh2_sftp.h>
125#endif /* HAVE_LIBSSH2_H */
126
127/* The upload buffer size, should not be smaller than CURL_MAX_WRITE_SIZE, as
128 it needs to hold a full buffer as could be sent in a write callback */
129#define UPLOAD_BUFSIZE CURL_MAX_WRITE_SIZE
130
131/* The "master buffer" is for HTTP pipelining */
132#define MASTERBUF_SIZE 16384
133
134/* Initial size of the buffer to store headers in, it'll be enlarged in case
135 of need. */
136#define HEADERSIZE 256
137
138#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
139#define GOOD_EASY_HANDLE(x) \
140 ((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))
141
142/* Some convenience macros to get the larger/smaller value out of two given.
143 We prefix with CURL to prevent name collisions. */
144#define CURLMAX(x,y) ((x)>(y)?(x):(y))
145#define CURLMIN(x,y) ((x)<(y)?(x):(y))
146
147#ifdef HAVE_GSSAPI
148/* Types needed for krb5-ftp connections */
149struct krb5buffer {
150 void *data;
151 size_t size;
152 size_t index;
153 int eof_flag;
154};
155
156enum protection_level {
157 PROT_NONE, /* first in list */
158 PROT_CLEAR,
159 PROT_SAFE,
160 PROT_CONFIDENTIAL,
161 PROT_PRIVATE,
162 PROT_CMD,
163 PROT_LAST /* last in list */
164};
165#endif
166
167/* enum for the nonblocking SSL connection state machine */
168typedef enum {
169 ssl_connect_1,
170 ssl_connect_2,
171 ssl_connect_2_reading,
172 ssl_connect_2_writing,
173 ssl_connect_3,
174 ssl_connect_done
175} ssl_connect_state;
176
177typedef enum {
178 ssl_connection_none,
179 ssl_connection_negotiating,
180 ssl_connection_complete
181} ssl_connection_state;
182
183/* SSL backend-specific data; declared differently by each SSL backend */
184struct ssl_backend_data;
185
186/* struct for data related to each SSL connection */
187struct ssl_connect_data {
188 /* Use ssl encrypted communications TRUE/FALSE, not necessarily using it atm
189 but at least asked to or meaning to use it. See 'state' for the exact
190 current state of the connection. */
191 bool use;
192 ssl_connection_state state;
193 ssl_connect_state connecting_state;
194#if defined(USE_SSL)
195 struct ssl_backend_data *backend;
196#endif
197};
198
199struct ssl_primary_config {
200 long version; /* what version the client wants to use */
201 long version_max; /* max supported version the client wants to use*/
202 bool verifypeer; /* set TRUE if this is desired */
203 bool verifyhost; /* set TRUE if CN/SAN must match hostname */
204 bool verifystatus; /* set TRUE if certificate status must be checked */
205 bool sessionid; /* cache session IDs or not */
206 char *CApath; /* certificate dir (doesn't work on windows) */
207 char *CAfile; /* certificate to verify peer against */
208 char *clientcert;
209 char *random_file; /* path to file containing "random" data */
210 char *egdsocket; /* path to file containing the EGD daemon socket */
211 char *cipher_list; /* list of ciphers to use */
212};
213
214struct ssl_config_data {
215 struct ssl_primary_config primary;
216 bool enable_beast; /* especially allow this flaw for interoperability's
217 sake*/
218 bool no_revoke; /* disable SSL certificate revocation checks */
219 long certverifyresult; /* result from the certificate verification */
220 char *CRLfile; /* CRL to check certificate revocation */
221 char *issuercert;/* optional issuer certificate filename */
222 curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
223 void *fsslctxp; /* parameter for call back */
224 bool certinfo; /* gather lots of certificate info */
225 bool falsestart;
226
227 char *cert; /* client certificate file name */
228 char *cert_type; /* format for certificate (default: PEM)*/
229 char *key; /* private key file name */
230 char *key_type; /* format for private key (default: PEM) */
231 char *key_passwd; /* plain text private key password */
232
233#ifdef USE_TLS_SRP
234 char *username; /* TLS username (for, e.g., SRP) */
235 char *password; /* TLS password (for, e.g., SRP) */
236 enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
237#endif
238};
239
240struct ssl_general_config {
241 size_t max_ssl_sessions; /* SSL session id cache size */
242};
243
244/* information stored about one single SSL session */
245struct curl_ssl_session {
246 char *name; /* host name for which this ID was used */
247 char *conn_to_host; /* host name for the connection (may be NULL) */
248 const char *scheme; /* protocol scheme used */
249 void *sessionid; /* as returned from the SSL layer */
250 size_t idsize; /* if known, otherwise 0 */
251 long age; /* just a number, the higher the more recent */
252 int remote_port; /* remote port */
253 int conn_to_port; /* remote port for the connection (may be -1) */
254 struct ssl_primary_config ssl_config; /* setup for this session */
255};
256
257#ifdef USE_WINDOWS_SSPI
258#include "curl_sspi.h"
259#endif
260
261/* Struct used for Digest challenge-response authentication */
262struct digestdata {
263#if defined(USE_WINDOWS_SSPI)
264 BYTE *input_token;
265 size_t input_token_len;
266 CtxtHandle *http_context;
267 /* copy of user/passwd used to make the identity for http_context.
268 either may be NULL. */
269 char *user;
270 char *passwd;
271#else
272 char *nonce;
273 char *cnonce;
274 char *realm;
275 int algo;
276 bool stale; /* set true for re-negotiation */
277 char *opaque;
278 char *qop;
279 char *algorithm;
280 int nc; /* nounce count */
281 bool userhash;
282#endif
283};
284
285typedef enum {
286 NTLMSTATE_NONE,
287 NTLMSTATE_TYPE1,
288 NTLMSTATE_TYPE2,
289 NTLMSTATE_TYPE3,
290 NTLMSTATE_LAST
291} curlntlm;
292
293#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
294#include <iconv.h>
295#endif
296
297/* Struct used for GSSAPI (Kerberos V5) authentication */
298#if defined(USE_KERBEROS5)
299struct kerberos5data {
300#if defined(USE_WINDOWS_SSPI)
301 CredHandle *credentials;
302 CtxtHandle *context;
303 TCHAR *spn;
304 SEC_WINNT_AUTH_IDENTITY identity;
305 SEC_WINNT_AUTH_IDENTITY *p_identity;
306 size_t token_max;
307 BYTE *output_token;
308#else
309 gss_ctx_id_t context;
310 gss_name_t spn;
311#endif
312};
313#endif
314
315/* Struct used for NTLM challenge-response authentication */
316#if defined(USE_NTLM)
317struct ntlmdata {
318 curlntlm state;
319#ifdef USE_WINDOWS_SSPI
320 CredHandle *credentials;
321 CtxtHandle *context;
322 SEC_WINNT_AUTH_IDENTITY identity;
323 SEC_WINNT_AUTH_IDENTITY *p_identity;
324 size_t token_max;
325 BYTE *output_token;
326 BYTE *input_token;
327 size_t input_token_len;
328#else
329 unsigned int flags;
330 unsigned char nonce[8];
331 void *target_info; /* TargetInfo received in the ntlm type-2 message */
332 unsigned int target_info_len;
333#endif
334};
335#endif
336
337#ifdef USE_SPNEGO
338struct negotiatedata {
339 /* When doing Negotiate (SPNEGO) auth, we first need to send a token
340 and then validate the received one. */
341 enum { GSS_AUTHNONE, GSS_AUTHRECV, GSS_AUTHSENT } state;
342#ifdef HAVE_GSSAPI
343 OM_uint32 status;
344 gss_ctx_id_t context;
345 gss_name_t spn;
346 gss_buffer_desc output_token;
347#else
348#ifdef USE_WINDOWS_SSPI
349 DWORD status;
350 CredHandle *credentials;
351 CtxtHandle *context;
352 SEC_WINNT_AUTH_IDENTITY identity;
353 SEC_WINNT_AUTH_IDENTITY *p_identity;
354 TCHAR *spn;
355 size_t token_max;
356 BYTE *output_token;
357 size_t output_token_length;
358#endif
359#endif
360};
361#endif
362
363
364/*
365 * Boolean values that concerns this connection.
366 */
367struct ConnectBits {
368 /* always modify bits.close with the connclose() and connkeep() macros! */
369 bool close; /* if set, we close the connection after this request */
370 bool reuse; /* if set, this is a re-used connection */
371 bool conn_to_host; /* if set, this connection has a "connect to host"
372 that overrides the host in the URL */
373 bool conn_to_port; /* if set, this connection has a "connect to port"
374 that overrides the port in the URL (remote port) */
375 bool proxy; /* if set, this transfer is done through a proxy - any type */
376 bool httpproxy; /* if set, this transfer is done through a http proxy */
377 bool socksproxy; /* if set, this transfer is done through a socks proxy */
378 bool user_passwd; /* do we use user+password for this connection? */
379 bool proxy_user_passwd; /* user+password for the proxy? */
380 bool ipv6_ip; /* we communicate with a remote site specified with pure IPv6
381 IP address */
382 bool ipv6; /* we communicate with a site using an IPv6 address */
383
384 bool do_more; /* this is set TRUE if the ->curl_do_more() function is
385 supposed to be called, after ->curl_do() */
386 bool tcpconnect[2]; /* the TCP layer (or similar) is connected, this is set
387 the first time on the first connect function call */
388 bool protoconnstart;/* the protocol layer has STARTED its operation after
389 the TCP layer connect */
390
391 bool retry; /* this connection is about to get closed and then
392 re-attempted at another connection. */
393 bool tunnel_proxy; /* if CONNECT is used to "tunnel" through the proxy.
394 This is implicit when SSL-protocols are used through
395 proxies, but can also be enabled explicitly by
396 apps */
397 bool authneg; /* TRUE when the auth phase has started, which means
398 that we are creating a request with an auth header,
399 but it is not the final request in the auth
400 negotiation. */
401 bool rewindaftersend;/* TRUE when the sending couldn't be stopped even
402 though it will be discarded. When the whole send
403 operation is done, we must call the data rewind
404 callback. */
405 bool ftp_use_epsv; /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
406 EPSV doesn't work we disable it for the forthcoming
407 requests */
408
409 bool ftp_use_eprt; /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
410 EPRT doesn't work we disable it for the forthcoming
411 requests */
412 bool ftp_use_data_ssl; /* Enabled SSL for the data connection */
413 bool netrc; /* name+password provided by netrc */
414 bool userpwd_in_url; /* name+password found in url */
415 bool stream_was_rewound; /* Indicates that the stream was rewound after a
416 request read past the end of its response byte
417 boundary */
418 bool proxy_connect_closed; /* set true if a proxy disconnected the
419 connection in a CONNECT request with auth, so
420 that libcurl should reconnect and continue. */
421 bool bound; /* set true if bind() has already been done on this socket/
422 connection */
423 bool type_set; /* type= was used in the URL */
424 bool multiplex; /* connection is multiplexed */
425
426 bool tcp_fastopen; /* use TCP Fast Open */
427 bool tls_enable_npn; /* TLS NPN extension? */
428 bool tls_enable_alpn; /* TLS ALPN extension? */
429 bool proxy_ssl_connected[2]; /* TRUE when SSL initialization for HTTPS proxy
430 is complete */
431 bool socksproxy_connecting; /* connecting through a socks proxy */
432};
433
434struct hostname {
435 char *rawalloc; /* allocated "raw" version of the name */
436 char *encalloc; /* allocated IDN-encoded version of the name */
437 char *name; /* name to use internally, might be encoded, might be raw */
438 const char *dispname; /* name to display, as 'name' might be encoded */
439};
440
441/*
442 * Flags on the keepon member of the Curl_transfer_keeper
443 */
444
445#define KEEP_NONE 0
446#define KEEP_RECV (1<<0) /* there is or may be data to read */
447#define KEEP_SEND (1<<1) /* there is or may be data to write */
448#define KEEP_RECV_HOLD (1<<2) /* when set, no reading should be done but there
449 might still be data to read */
450#define KEEP_SEND_HOLD (1<<3) /* when set, no writing should be done but there
451 might still be data to write */
452#define KEEP_RECV_PAUSE (1<<4) /* reading is paused */
453#define KEEP_SEND_PAUSE (1<<5) /* writing is paused */
454
455#define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE)
456#define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE)
457
458
459#ifdef CURLRES_ASYNCH
460struct Curl_async {
461 char *hostname;
462 int port;
463 struct Curl_dns_entry *dns;
464 bool done; /* set TRUE when the lookup is complete */
465 int status; /* if done is TRUE, this is the status from the callback */
466 void *os_specific; /* 'struct thread_data' for Windows */
467};
468#endif
469
470#define FIRSTSOCKET 0
471#define SECONDARYSOCKET 1
472
473/* These function pointer types are here only to allow easier typecasting
474 within the source when we need to cast between data pointers (such as NULL)
475 and function pointers. */
476typedef CURLcode (*Curl_do_more_func)(struct connectdata *, int *);
477typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool);
478
479enum expect100 {
480 EXP100_SEND_DATA, /* enough waiting, just send the body now */
481 EXP100_AWAITING_CONTINUE, /* waiting for the 100 Continue header */
482 EXP100_SENDING_REQUEST, /* still sending the request but will wait for
483 the 100 header once done with the request */
484 EXP100_FAILED /* used on 417 Expectation Failed */
485};
486
487enum upgrade101 {
488 UPGR101_INIT, /* default state */
489 UPGR101_REQUESTED, /* upgrade requested */
490 UPGR101_RECEIVED, /* response received */
491 UPGR101_WORKING /* talking upgraded protocol */
492};
493
494/*
495 * Request specific data in the easy handle (Curl_easy). Previously,
496 * these members were on the connectdata struct but since a conn struct may
497 * now be shared between different Curl_easys, we store connection-specific
498 * data here. This struct only keeps stuff that's interesting for *this*
499 * request, as it will be cleared between multiple ones
500 */
501struct SingleRequest {
502 curl_off_t size; /* -1 if unknown at this point */
503 curl_off_t *bytecountp; /* return number of bytes read or NULL */
504
505 curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch,
506 -1 means unlimited */
507 curl_off_t *writebytecountp; /* return number of bytes written or NULL */
508
509 curl_off_t bytecount; /* total number of bytes read */
510 curl_off_t writebytecount; /* number of bytes written */
511
512 long headerbytecount; /* only count received headers */
513 long deductheadercount; /* this amount of bytes doesn't count when we check
514 if anything has been transferred at the end of a
515 connection. We use this counter to make only a
516 100 reply (without a following second response
517 code) result in a CURLE_GOT_NOTHING error code */
518
519 struct curltime start; /* transfer started at this time */
520 struct curltime now; /* current time */
521 bool header; /* incoming data has HTTP header */
522 enum {
523 HEADER_NORMAL, /* no bad header at all */
524 HEADER_PARTHEADER, /* part of the chunk is a bad header, the rest
525 is normal data */
526 HEADER_ALLBAD /* all was believed to be header */
527 } badheader; /* the header was deemed bad and will be
528 written as body */
529 int headerline; /* counts header lines to better track the
530 first one */
531 char *hbufp; /* points at *end* of header line */
532 size_t hbuflen;
533 char *str; /* within buf */
534 char *str_start; /* within buf */
535 char *end_ptr; /* within buf */
536 char *p; /* within headerbuff */
537 bool content_range; /* set TRUE if Content-Range: was found */
538 curl_off_t offset; /* possible resume offset read from the
539 Content-Range: header */
540 int httpcode; /* error code from the 'HTTP/1.? XXX' or
541 'RTSP/1.? XXX' line */
542 struct curltime start100; /* time stamp to wait for the 100 code from */
543 enum expect100 exp100; /* expect 100 continue state */
544 enum upgrade101 upgr101; /* 101 upgrade state */
545
546 struct contenc_writer_s *writer_stack; /* Content unencoding stack. */
547 /* See sec 3.5, RFC2616. */
548 time_t timeofdoc;
549 long bodywrites;
550
551 char *buf;
552 curl_socket_t maxfd;
553
554 int keepon;
555
556 bool upload_done; /* set to TRUE when doing chunked transfer-encoding upload
557 and we're uploading the last chunk */
558
559 bool ignorebody; /* we read a response-body but we ignore it! */
560 bool ignorecl; /* This HTTP response has no body so we ignore the Content-
561 Length: header */
562
563 char *location; /* This points to an allocated version of the Location:
564 header data */
565 char *newurl; /* Set to the new URL to use when a redirect or a retry is
566 wanted */
567
568 /* 'upload_present' is used to keep a byte counter of how much data there is
569 still left in the buffer, aimed for upload. */
570 ssize_t upload_present;
571
572 /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a
573 buffer, so the next read should read from where this pointer points to,
574 and the 'upload_present' contains the number of bytes available at this
575 position */
576 char *upload_fromhere;
577
578 bool chunk; /* if set, this is a chunked transfer-encoding */
579 bool upload_chunky; /* set TRUE if we are doing chunked transfer-encoding
580 on upload */
581 bool getheader; /* TRUE if header parsing is wanted */
582
583 bool forbidchunk; /* used only to explicitly forbid chunk-upload for
584 specific upload buffers. See readmoredata() in
585 http.c for details. */
586
587 void *protop; /* Allocated protocol-specific data. Each protocol
588 handler makes sure this points to data it needs. */
589};
590
591/*
592 * Specific protocol handler.
593 */
594
595struct Curl_handler {
596 const char *scheme; /* URL scheme name. */
597
598 /* Complement to setup_connection_internals(). */
599 CURLcode (*setup_connection)(struct connectdata *);
600
601 /* These two functions MUST be set to be protocol dependent */
602 CURLcode (*do_it)(struct connectdata *, bool *done);
603 Curl_done_func done;
604
605 /* If the curl_do() function is better made in two halves, this
606 * curl_do_more() function will be called afterwards, if set. For example
607 * for doing the FTP stuff after the PASV/PORT command.
608 */
609 Curl_do_more_func do_more;
610
611 /* This function *MAY* be set to a protocol-dependent function that is run
612 * after the connect() and everything is done, as a step in the connection.
613 * The 'done' pointer points to a bool that should be set to TRUE if the
614 * function completes before return. If it doesn't complete, the caller
615 * should call the curl_connecting() function until it is.
616 */
617 CURLcode (*connect_it)(struct connectdata *, bool *done);
618
619 /* See above. Currently only used for FTP. */
620 CURLcode (*connecting)(struct connectdata *, bool *done);
621 CURLcode (*doing)(struct connectdata *, bool *done);
622
623 /* Called from the multi interface during the PROTOCONNECT phase, and it
624 should then return a proper fd set */
625 int (*proto_getsock)(struct connectdata *conn,
626 curl_socket_t *socks,
627 int numsocks);
628
629 /* Called from the multi interface during the DOING phase, and it should
630 then return a proper fd set */
631 int (*doing_getsock)(struct connectdata *conn,
632 curl_socket_t *socks,
633 int numsocks);
634
635 /* Called from the multi interface during the DO_MORE phase, and it should
636 then return a proper fd set */
637 int (*domore_getsock)(struct connectdata *conn,
638 curl_socket_t *socks,
639 int numsocks);
640
641 /* Called from the multi interface during the DO_DONE, PERFORM and
642 WAITPERFORM phases, and it should then return a proper fd set. Not setting
643 this will make libcurl use the generic default one. */
644 int (*perform_getsock)(const struct connectdata *conn,
645 curl_socket_t *socks,
646 int numsocks);
647
648 /* This function *MAY* be set to a protocol-dependent function that is run
649 * by the curl_disconnect(), as a step in the disconnection. If the handler
650 * is called because the connection has been considered dead, dead_connection
651 * is set to TRUE.
652 */
653 CURLcode (*disconnect)(struct connectdata *, bool dead_connection);
654
655 /* If used, this function gets called from transfer.c:readwrite_data() to
656 allow the protocol to do extra reads/writes */
657 CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn,
658 ssize_t *nread, bool *readmore);
659
660 /* This function can perform various checks on the connection. See
661 CONNCHECK_* for more information about the checks that can be performed,
662 and CONNRESULT_* for the results that can be returned. */
663 unsigned int (*connection_check)(struct connectdata *conn,
664 unsigned int checks_to_perform);
665
666 long defport; /* Default port. */
667 unsigned int protocol; /* See CURLPROTO_* - this needs to be the single
668 specific protocol bit */
669 unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */
670};
671
672#define PROTOPT_NONE 0 /* nothing extra */
673#define PROTOPT_SSL (1<<0) /* uses SSL */
674#define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */
675#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */
676/* some protocols will have to call the underlying functions without regard to
677 what exact state the socket signals. IE even if the socket says "readable",
678 the send function might need to be called while uploading, or vice versa.
679*/
680#define PROTOPT_DIRLOCK (1<<3)
681#define PROTOPT_NONETWORK (1<<4) /* protocol doesn't use the network! */
682#define PROTOPT_NEEDSPWD (1<<5) /* needs a password, and if none is set it
683 gets a default */
684#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle
685 url query strings (?foo=bar) ! */
686#define PROTOPT_CREDSPERREQUEST (1<<7) /* requires login credentials per
687 request instead of per connection */
688#define PROTOPT_ALPN_NPN (1<<8) /* set ALPN and/or NPN for this */
689#define PROTOPT_STREAM (1<<9) /* a protocol with individual logical streams */
690#define PROTOPT_URLOPTIONS (1<<10) /* allow options part in the userinfo field
691 of the URL */
692#define PROTOPT_PROXY_AS_HTTP (1<<11) /* allow this non-HTTP scheme over a
693 HTTP proxy as HTTP proxies may know
694 this protocol and act as a gateway */
695#define PROTOPT_WILDCARD (1<<12) /* protocol supports wildcard matching */
696
697#define CONNCHECK_NONE 0 /* No checks */
698#define CONNCHECK_ISDEAD (1<<0) /* Check if the connection is dead. */
699
700#define CONNRESULT_NONE 0 /* No extra information. */
701#define CONNRESULT_DEAD (1<<0) /* The connection is dead. */
702
703/* return the count of bytes sent, or -1 on error */
704typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */
705 int sockindex, /* socketindex */
706 const void *buf, /* data to write */
707 size_t len, /* max amount to write */
708 CURLcode *err); /* error to return */
709
710/* return the count of bytes read, or -1 on error */
711typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */
712 int sockindex, /* socketindex */
713 char *buf, /* store data here */
714 size_t len, /* max amount to read */
715 CURLcode *err); /* error to return */
716
717#ifdef USE_RECV_BEFORE_SEND_WORKAROUND
718struct postponed_data {
719 char *buffer; /* Temporal store for received data during
720 sending, must be freed */
721 size_t allocated_size; /* Size of temporal store */
722 size_t recv_size; /* Size of received data during sending */
723 size_t recv_processed; /* Size of processed part of postponed data */
724#ifdef DEBUGBUILD
725 curl_socket_t bindsock;/* Structure must be bound to specific socket,
726 used only for DEBUGASSERT */
727#endif /* DEBUGBUILD */
728};
729#endif /* USE_RECV_BEFORE_SEND_WORKAROUND */
730
731struct proxy_info {
732 struct hostname host;
733 long port;
734 curl_proxytype proxytype; /* what kind of proxy that is in use */
735 char *user; /* proxy user name string, allocated */
736 char *passwd; /* proxy password string, allocated */
737};
738
739#define CONNECT_BUFFER_SIZE 1024/*16384*/
740
741/* struct for HTTP CONNECT state data */
742struct http_connect_state {
743 char connect_buffer[CONNECT_BUFFER_SIZE];
744 int perline; /* count bytes per line */
745 int keepon;
746 char *line_start;
747 char *ptr; /* where to store more data */
748 curl_off_t cl; /* size of content to read and ignore */
749 bool chunked_encoding;
750 enum {
751 TUNNEL_INIT, /* init/default/no tunnel state */
752 TUNNEL_CONNECT, /* CONNECT has been sent off */
753 TUNNEL_COMPLETE /* CONNECT response received completely */
754 } tunnel_state;
755};
756
757/*
758 * The connectdata struct contains all fields and variables that should be
759 * unique for an entire connection.
760 */
761struct connectdata {
762 /* 'data' is the CURRENT Curl_easy using this connection -- take great
763 caution that this might very well vary between different times this
764 connection is used! */
765 struct Curl_easy *data;
766
767 struct curl_llist_element bundle_node; /* conncache */
768
769 /* chunk is for HTTP chunked encoding, but is in the general connectdata
770 struct only because we can do just about any protocol through a HTTP proxy
771 and a HTTP proxy may in fact respond using chunked encoding */
772 struct Curl_chunker chunk;
773
774 curl_closesocket_callback fclosesocket; /* function closing the socket(s) */
775 void *closesocket_client;
776
777 bool inuse; /* This is a marker for the connection cache logic. If this is
778 TRUE this handle is being used by an easy handle and cannot
779 be used by any other easy handle without careful
780 consideration (== only for pipelining). */
781
782 /**** Fields set when inited and not modified again */
783 long connection_id; /* Contains a unique number to make it easier to
784 track the connections in the log output */
785
786 /* 'dns_entry' is the particular host we use. This points to an entry in the
787 DNS cache and it will not get pruned while locked. It gets unlocked in
788 Curl_done(). This entry will be NULL if the connection is re-used as then
789 there is no name resolve done. */
790 struct Curl_dns_entry *dns_entry;
791
792 /* 'ip_addr' is the particular IP we connected to. It points to a struct
793 within the DNS cache, so this pointer is only valid as long as the DNS
794 cache entry remains locked. It gets unlocked in Curl_done() */
795 Curl_addrinfo *ip_addr;
796 Curl_addrinfo *tempaddr[2]; /* for happy eyeballs */
797
798 /* 'ip_addr_str' is the ip_addr data as a human readable string.
799 It remains available as long as the connection does, which is longer than
800 the ip_addr itself. */
801 char ip_addr_str[MAX_IPADR_LEN];
802
803 unsigned int scope_id; /* Scope id for IPv6 */
804
805 int socktype; /* SOCK_STREAM or SOCK_DGRAM */
806
807 struct hostname host;
808 char *secondaryhostname; /* secondary socket host name (ftp) */
809 struct hostname conn_to_host; /* the host to connect to. valid only if
810 bits.conn_to_host is set */
811
812 struct proxy_info socks_proxy;
813 struct proxy_info http_proxy;
814
815 long port; /* which port to use locally */
816 int remote_port; /* the remote port, not the proxy port! */
817 int conn_to_port; /* the remote port to connect to. valid only if
818 bits.conn_to_port is set */
819 unsigned short secondary_port; /* secondary socket remote port to connect to
820 (ftp) */
821
822 /* 'primary_ip' and 'primary_port' get filled with peer's numerical
823 ip address and port number whenever an outgoing connection is
824 *attempted* from the primary socket to a remote address. When more
825 than one address is tried for a connection these will hold data
826 for the last attempt. When the connection is actually established
827 these are updated with data which comes directly from the socket. */
828
829 char primary_ip[MAX_IPADR_LEN];
830 long primary_port;
831
832 /* 'local_ip' and 'local_port' get filled with local's numerical
833 ip address and port number whenever an outgoing connection is
834 **established** from the primary socket to a remote address. */
835
836 char local_ip[MAX_IPADR_LEN];
837 long local_port;
838
839 char *user; /* user name string, allocated */
840 char *passwd; /* password string, allocated */
841 char *options; /* options string, allocated */
842
843 char *oauth_bearer; /* bearer token for OAuth 2.0, allocated */
844
845 int httpversion; /* the HTTP version*10 reported by the server */
846 int rtspversion; /* the RTSP version*10 reported by the server */
847
848 struct curltime now; /* "current" time */
849 struct curltime created; /* creation time */
850 curl_socket_t sock[2]; /* two sockets, the second is used for the data
851 transfer when doing FTP */
852 curl_socket_t tempsock[2]; /* temporary sockets for happy eyeballs */
853 bool sock_accepted[2]; /* TRUE if the socket on this index was created with
854 accept() */
855 Curl_recv *recv[2];
856 Curl_send *send[2];
857
858#ifdef USE_RECV_BEFORE_SEND_WORKAROUND
859 struct postponed_data postponed[2]; /* two buffers for two sockets */
860#endif /* USE_RECV_BEFORE_SEND_WORKAROUND */
861 struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */
862 struct ssl_connect_data proxy_ssl[2]; /* this is for proxy ssl-stuff */
863 struct ssl_primary_config ssl_config;
864 struct ssl_primary_config proxy_ssl_config;
865 bool tls_upgraded;
866
867 struct ConnectBits bits; /* various state-flags for this connection */
868
869 /* connecttime: when connect() is called on the current IP address. Used to
870 be able to track when to move on to try next IP - but only when the multi
871 interface is used. */
872 struct curltime connecttime;
873 /* The two fields below get set in Curl_connecthost */
874 int num_addr; /* number of addresses to try to connect to */
875 time_t timeoutms_per_addr; /* how long time in milliseconds to spend on
876 trying to connect to each IP address */
877
878 const struct Curl_handler *handler; /* Connection's protocol handler */
879 const struct Curl_handler *given; /* The protocol first given */
880
881 long ip_version; /* copied from the Curl_easy at creation time */
882
883 /**** curl_get() phase fields */
884
885 curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
886 curl_socket_t writesockfd; /* socket to write to, it may very
887 well be the same we read from.
888 CURL_SOCKET_BAD disables */
889
890 /** Dynamicly allocated strings, MUST be freed before this **/
891 /** struct is killed. **/
892 struct dynamically_allocated_data {
893 char *proxyuserpwd;
894 char *uagent;
895 char *accept_encoding;
896 char *userpwd;
897 char *rangeline;
898 char *ref;
899 char *host;
900 char *cookiehost;
901 char *rtsp_transport;
902 char *te; /* TE: request header */
903 } allocptr;
904
905#ifdef HAVE_GSSAPI
906 int sec_complete; /* if Kerberos is enabled for this connection */
907 enum protection_level command_prot;
908 enum protection_level data_prot;
909 enum protection_level request_data_prot;
910 size_t buffer_size;
911 struct krb5buffer in_buffer;
912 void *app_data;
913 const struct Curl_sec_client_mech *mech;
914 struct sockaddr_in local_addr;
915#endif
916
917#if defined(USE_KERBEROS5) /* Consider moving some of the above GSS-API */
918 struct kerberos5data krb5; /* variables into the structure definition, */
919#endif /* however, some of them are ftp specific. */
920
921 /* the two following *_inuse fields are only flags, not counters in any way.
922 If TRUE it means the channel is in use, and if FALSE it means the channel
923 is up for grabs by one. */
924
925 bool readchannel_inuse; /* whether the read channel is in use by an easy
926 handle */
927 bool writechannel_inuse; /* whether the write channel is in use by an easy
928 handle */
929 struct curl_llist send_pipe; /* List of handles waiting to send on this
930 pipeline */
931 struct curl_llist recv_pipe; /* List of handles waiting to read their
932 responses on this pipeline */
933 char *master_buffer; /* The master buffer allocated on-demand;
934 used for pipelining. */
935 size_t read_pos; /* Current read position in the master buffer */
936 size_t buf_len; /* Length of the buffer?? */
937
938
939 curl_seek_callback seek_func; /* function that seeks the input */
940 void *seek_client; /* pointer to pass to the seek() above */
941
942 /*************** Request - specific items ************/
943
944#if defined(USE_NTLM)
945 struct ntlmdata ntlm; /* NTLM differs from other authentication schemes
946 because it authenticates connections, not
947 single requests! */
948 struct ntlmdata proxyntlm; /* NTLM data for proxy */
949
950#if defined(NTLM_WB_ENABLED)
951 /* used for communication with Samba's winbind daemon helper ntlm_auth */
952 curl_socket_t ntlm_auth_hlpr_socket;
953 pid_t ntlm_auth_hlpr_pid;
954 char *challenge_header;
955 char *response_header;
956#endif
957#endif
958
959 char syserr_buf [256]; /* buffer for Curl_strerror() */
960
961#ifdef CURLRES_ASYNCH
962 /* data used for the asynch name resolve callback */
963 struct Curl_async async;
964#endif
965
966 /* These three are used for chunked-encoding trailer support */
967 char *trailer; /* allocated buffer to store trailer in */
968 int trlMax; /* allocated buffer size */
969 int trlPos; /* index of where to store data */
970
971 union {
972 struct ftp_conn ftpc;
973 struct http_conn httpc;
974 struct ssh_conn sshc;
975 struct tftp_state_data *tftpc;
976 struct imap_conn imapc;
977 struct pop3_conn pop3c;
978 struct smtp_conn smtpc;
979 struct rtsp_conn rtspc;
980 struct smb_conn smbc;
981 void *generic; /* RTMP and LDAP use this */
982 } proto;
983
984 int cselect_bits; /* bitmask of socket events */
985 int waitfor; /* current READ/WRITE bits to wait for */
986
987#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
988 int socks5_gssapi_enctype;
989#endif
990
991 /* When this connection is created, store the conditions for the local end
992 bind. This is stored before the actual bind and before any connection is
993 made and will serve the purpose of being used for comparison reasons so
994 that subsequent bound-requested connections aren't accidentally re-using
995 wrong connections. */
996 char *localdev;
997 unsigned short localport;
998 int localportrange;
999 struct http_connect_state *connect_state; /* for HTTP CONNECT */
1000 struct connectbundle *bundle; /* The bundle we are member of */
1001 int negnpn; /* APLN or NPN TLS negotiated protocol, CURL_HTTP_VERSION* */
1002
1003#ifdef USE_UNIX_SOCKETS
1004 char *unix_domain_socket;
1005 bool abstract_unix_socket;
1006#endif
1007};
1008
1009/* The end of connectdata. */
1010
1011/*
1012 * Struct to keep statistical and informational data.
1013 * All variables in this struct must be initialized/reset in Curl_initinfo().
1014 */
1015struct PureInfo {
1016 int httpcode; /* Recent HTTP, FTP, RTSP or SMTP response code */
1017 int httpproxycode; /* response code from proxy when received separate */
1018 int httpversion; /* the http version number X.Y = X*10+Y */
1019 long filetime; /* If requested, this is might get set. Set to -1 if the time
1020 was unretrievable. We cannot have this of type time_t,
1021 since time_t is unsigned on several platforms such as
1022 OpenVMS. */
1023 bool timecond; /* set to TRUE if the time condition didn't match, which
1024 thus made the document NOT get fetched */
1025 long header_size; /* size of read header(s) in bytes */
1026 long request_size; /* the amount of bytes sent in the request(s) */
1027 unsigned long proxyauthavail; /* what proxy auth types were announced */
1028 unsigned long httpauthavail; /* what host auth types were announced */
1029 long numconnects; /* how many new connection did libcurl created */
1030 char *contenttype; /* the content type of the object */
1031 char *wouldredirect; /* URL this would've been redirected to if asked to */
1032
1033 /* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip'
1034 and, 'conn_local_port' are copied over from the connectdata struct in
1035 order to allow curl_easy_getinfo() to return this information even when
1036 the session handle is no longer associated with a connection, and also
1037 allow curl_easy_reset() to clear this information from the session handle
1038 without disturbing information which is still alive, and that might be
1039 reused, in the connection cache. */
1040
1041 char conn_primary_ip[MAX_IPADR_LEN];
1042 long conn_primary_port;
1043
1044 char conn_local_ip[MAX_IPADR_LEN];
1045 long conn_local_port;
1046
1047 const char *conn_scheme;
1048 unsigned int conn_protocol;
1049
1050 struct curl_certinfo certs; /* info about the certs, only populated in
1051 OpenSSL builds. Asked for with
1052 CURLOPT_CERTINFO / CURLINFO_CERTINFO */
1053};
1054
1055
1056struct Progress {
1057 time_t lastshow; /* time() of the last displayed progress meter or NULL to
1058 force redraw at next call */
1059 curl_off_t size_dl; /* total expected size */
1060 curl_off_t size_ul; /* total expected size */
1061 curl_off_t downloaded; /* transferred so far */
1062 curl_off_t uploaded; /* transferred so far */
1063
1064 curl_off_t current_speed; /* uses the currently fastest transfer */
1065
1066 bool callback; /* set when progress callback is used */
1067 int width; /* screen width at download start */
1068 int flags; /* see progress.h */
1069
1070 time_t timespent;
1071
1072 curl_off_t dlspeed;
1073 curl_off_t ulspeed;
1074
1075 time_t t_nslookup;
1076 time_t t_connect;
1077 time_t t_appconnect;
1078 time_t t_pretransfer;
1079 time_t t_starttransfer;
1080 time_t t_redirect;
1081
1082 struct curltime start;
1083 struct curltime t_startsingle;
1084 struct curltime t_startop;
1085 struct curltime t_acceptdata;
1086
1087 bool is_t_startransfer_set;
1088
1089 /* upload speed limit */
1090 struct curltime ul_limit_start;
1091 curl_off_t ul_limit_size;
1092 /* download speed limit */
1093 struct curltime dl_limit_start;
1094 curl_off_t dl_limit_size;
1095
1096#define CURR_TIME (5 + 1) /* 6 entries for 5 seconds */
1097
1098 curl_off_t speeder[ CURR_TIME ];
1099 struct curltime speeder_time[ CURR_TIME ];
1100 int speeder_c;
1101};
1102
1103typedef enum {
1104 HTTPREQ_NONE, /* first in list */
1105 HTTPREQ_GET,
1106 HTTPREQ_POST,
1107 HTTPREQ_POST_FORM, /* we make a difference internally */
1108 HTTPREQ_POST_MIME, /* we make a difference internally */
1109 HTTPREQ_PUT,
1110 HTTPREQ_HEAD,
1111 HTTPREQ_OPTIONS,
1112 HTTPREQ_CUSTOM,
1113 HTTPREQ_LAST /* last in list */
1114} Curl_HttpReq;
1115
1116typedef enum {
1117 RTSPREQ_NONE, /* first in list */
1118 RTSPREQ_OPTIONS,
1119 RTSPREQ_DESCRIBE,
1120 RTSPREQ_ANNOUNCE,
1121 RTSPREQ_SETUP,
1122 RTSPREQ_PLAY,
1123 RTSPREQ_PAUSE,
1124 RTSPREQ_TEARDOWN,
1125 RTSPREQ_GET_PARAMETER,
1126 RTSPREQ_SET_PARAMETER,
1127 RTSPREQ_RECORD,
1128 RTSPREQ_RECEIVE,
1129 RTSPREQ_LAST /* last in list */
1130} Curl_RtspReq;
1131
1132/*
1133 * Values that are generated, temporary or calculated internally for a
1134 * "session handle" must be defined within the 'struct UrlState'. This struct
1135 * will be used within the Curl_easy struct. When the 'Curl_easy'
1136 * struct is cloned, this data MUST NOT be copied.
1137 *
1138 * Remember that any "state" information goes globally for the curl handle.
1139 * Session-data MUST be put in the connectdata struct and here. */
1140#define MAX_CURL_USER_LENGTH 256
1141#define MAX_CURL_PASSWORD_LENGTH 256
1142
1143struct auth {
1144 unsigned long want; /* Bitmask set to the authentication methods wanted by
1145 app (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */
1146 unsigned long picked;
1147 unsigned long avail; /* Bitmask for what the server reports to support for
1148 this resource */
1149 bool done; /* TRUE when the auth phase is done and ready to do the *actual*
1150 request */
1151 bool multipass; /* TRUE if this is not yet authenticated but within the
1152 auth multipass negotiation */
1153 bool iestyle; /* TRUE if digest should be done IE-style or FALSE if it should
1154 be RFC compliant */
1155};
1156
1157struct Curl_http2_dep {
1158 struct Curl_http2_dep *next;
1159 struct Curl_easy *data;
1160};
1161
1162/*
1163 * This struct is for holding data that was attemped to get sent to the user's
1164 * callback but is held due to pausing. One instance per type (BOTH, HEADER,
1165 * BODY).
1166 */
1167struct tempbuf {
1168 char *buf; /* allocated buffer to keep data in when a write callback
1169 returns to make the connection paused */
1170 size_t len; /* size of the 'tempwrite' allocated buffer */
1171 int type; /* type of the 'tempwrite' buffer as a bitmask that is used with
1172 Curl_client_write() */
1173};
1174
1175/* Timers */
1176typedef enum {
1177 EXPIRE_100_TIMEOUT,
1178 EXPIRE_ASYNC_NAME,
1179 EXPIRE_CONNECTTIMEOUT,
1180 EXPIRE_DNS_PER_NAME,
1181 EXPIRE_HAPPY_EYEBALLS,
1182 EXPIRE_MULTI_PENDING,
1183 EXPIRE_RUN_NOW,
1184 EXPIRE_SPEEDCHECK,
1185 EXPIRE_TIMEOUT,
1186 EXPIRE_TOOFAST,
1187 EXPIRE_LAST /* not an actual timer, used as a marker only */
1188} expire_id;
1189
1190/*
1191 * One instance for each timeout an easy handle can set.
1192 */
1193struct time_node {
1194 struct curl_llist_element list;
1195 struct curltime time;
1196 expire_id eid;
1197};
1198
1199struct UrlState {
1200
1201 /* Points to the connection cache */
1202 struct conncache *conn_cache;
1203
1204 /* when curl_easy_perform() is called, the multi handle is "owned" by
1205 the easy handle so curl_easy_cleanup() on such an easy handle will
1206 also close the multi handle! */
1207 bool multi_owned_by_easy;
1208
1209 /* buffers to store authentication data in, as parsed from input options */
1210 struct curltime keeps_speed; /* for the progress meter really */
1211
1212 struct connectdata *lastconnect; /* The last connection, NULL if undefined */
1213
1214 char *headerbuff; /* allocated buffer to store headers in */
1215 size_t headersize; /* size of the allocation */
1216
1217 char *buffer; /* download buffer */
1218 char uploadbuffer[UPLOAD_BUFSIZE + 1]; /* upload buffer */
1219 curl_off_t current_speed; /* the ProgressShow() function sets this,
1220 bytes / second */
1221 bool this_is_a_follow; /* this is a followed Location: request */
1222
1223 char *first_host; /* host name of the first (not followed) request.
1224 if set, this should be the host name that we will
1225 sent authorization to, no else. Used to make Location:
1226 following not keep sending user+password... This is
1227 strdup() data.
1228 */
1229 int first_remote_port; /* remote port of the first (not followed) request */
1230 struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
1231 long sessionage; /* number of the most recent session */
1232 unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
1233 struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */
1234 char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
1235 bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
1236 This must be set to FALSE every time _easy_perform() is
1237 called. */
1238 int os_errno; /* filled in with errno whenever an error occurs */
1239#ifdef HAVE_SIGNAL
1240 /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
1241 void (*prev_signal)(int sig);
1242#endif
1243 bool allow_port; /* Is set.use_port allowed to take effect or not. This
1244 is always set TRUE when curl_easy_perform() is called. */
1245 struct digestdata digest; /* state data for host Digest auth */
1246 struct digestdata proxydigest; /* state data for proxy Digest auth */
1247
1248#ifdef USE_SPNEGO
1249 struct negotiatedata negotiate; /* state data for host Negotiate auth */
1250 struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */
1251#endif
1252
1253 struct auth authhost; /* auth details for host */
1254 struct auth authproxy; /* auth details for proxy */
1255
1256 bool authproblem; /* TRUE if there's some problem authenticating */
1257
1258 void *resolver; /* resolver state, if it is used in the URL state -
1259 ares_channel f.e. */
1260
1261#if defined(USE_OPENSSL) && defined(HAVE_OPENSSL_ENGINE_H)
1262 /* void instead of ENGINE to avoid bleeding OpenSSL into this header */
1263 void *engine;
1264#endif /* USE_OPENSSL */
1265 struct curltime expiretime; /* set this with Curl_expire() only */
1266 struct Curl_tree timenode; /* for the splay stuff */
1267 struct curl_llist timeoutlist; /* list of pending timeouts */
1268 struct time_node expires[EXPIRE_LAST]; /* nodes for each expire type */
1269
1270 /* a place to store the most recently set FTP entrypath */
1271 char *most_recent_ftp_entrypath;
1272
1273 /* set after initial USER failure, to prevent an authentication loop */
1274 bool ftp_trying_alternative;
1275 bool wildcardmatch; /* enable wildcard matching */
1276 int httpversion; /* the lowest HTTP version*10 reported by any server
1277 involved in this request */
1278 bool expect100header; /* TRUE if we added Expect: 100-continue */
1279
1280 bool pipe_broke; /* TRUE if the connection we were pipelined on broke
1281 and we need to restart from the beginning */
1282
1283#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__) && \
1284 !defined(__SYMBIAN32__)
1285/* do FTP line-end conversions on most platforms */
1286#define CURL_DO_LINEEND_CONV
1287 /* for FTP downloads: track CRLF sequences that span blocks */
1288 bool prev_block_had_trailing_cr;
1289 /* for FTP downloads: how many CRLFs did we converted to LFs? */
1290 curl_off_t crlf_conversions;
1291#endif
1292 char *pathbuffer;/* allocated buffer to store the URL's path part in */
1293 char *path; /* path to use, points to somewhere within the pathbuffer
1294 area */
1295 bool slash_removed; /* set TRUE if the 'path' points to a path where the
1296 initial URL slash separator has been taken off */
1297 bool use_range;
1298 bool rangestringalloc; /* the range string is malloc()'ed */
1299
1300 char *range; /* range, if used. See README for detailed specification on
1301 this syntax. */
1302 curl_off_t resume_from; /* continue [ftp] transfer from here */
1303
1304 /* This RTSP state information survives requests and connections */
1305 long rtsp_next_client_CSeq; /* the session's next client CSeq */
1306 long rtsp_next_server_CSeq; /* the session's next server CSeq */
1307 long rtsp_CSeq_recv; /* most recent CSeq received */
1308
1309 curl_off_t infilesize; /* size of file to upload, -1 means unknown.
1310 Copied from set.filesize at start of operation */
1311
1312 size_t drain; /* Increased when this stream has data to read, even if its
1313 socket is not necessarily is readable. Decreased when
1314 checked. */
1315 bool done; /* set to FALSE when Curl_init_do() is called and set to TRUE
1316 when multi_done() is called, to prevent multi_done() to get
1317 invoked twice when the multi interface is used. */
1318
1319 curl_read_callback fread_func; /* read callback/function */
1320 void *in; /* CURLOPT_READDATA */
1321
1322 struct Curl_easy *stream_depends_on;
1323 bool stream_depends_e; /* set or don't set the Exclusive bit */
1324 int stream_weight;
1325};
1326
1327
1328/*
1329 * This 'DynamicStatic' struct defines dynamic states that actually change
1330 * values in the 'UserDefined' area, which MUST be taken into consideration
1331 * if the UserDefined struct is cloned or similar. You can probably just
1332 * copy these, but each one indicate a special action on other data.
1333 */
1334
1335struct DynamicStatic {
1336 char *url; /* work URL, copied from UserDefined */
1337 bool url_alloc; /* URL string is malloc()'ed */
1338 char *referer; /* referer string */
1339 bool referer_alloc; /* referer sting is malloc()ed */
1340 struct curl_slist *cookielist; /* list of cookie files set by
1341 curl_easy_setopt(COOKIEFILE) calls */
1342 struct curl_slist *resolve; /* set to point to the set.resolve list when
1343 this should be dealt with in pretransfer */
1344};
1345
1346/*
1347 * This 'UserDefined' struct must only contain data that is set once to go
1348 * for many (perhaps) independent connections. Values that are generated or
1349 * calculated internally for the "session handle" MUST be defined within the
1350 * 'struct UrlState' instead. The only exceptions MUST note the changes in
1351 * the 'DynamicStatic' struct.
1352 * Character pointer fields point to dynamic storage, unless otherwise stated.
1353 */
1354
1355struct Curl_multi; /* declared and used only in multi.c */
1356
1357enum dupstring {
1358 STRING_CERT_ORIG, /* client certificate file name */
1359 STRING_CERT_PROXY, /* client certificate file name */
1360 STRING_CERT_TYPE_ORIG, /* format for certificate (default: PEM)*/
1361 STRING_CERT_TYPE_PROXY, /* format for certificate (default: PEM)*/
1362 STRING_COOKIE, /* HTTP cookie string to send */
1363 STRING_COOKIEJAR, /* dump all cookies to this file */
1364 STRING_CUSTOMREQUEST, /* HTTP/FTP/RTSP request/method to use */
1365 STRING_DEFAULT_PROTOCOL, /* Protocol to use when the URL doesn't specify */
1366 STRING_DEVICE, /* local network interface/address to use */
1367 STRING_ENCODING, /* Accept-Encoding string */
1368 STRING_FTP_ACCOUNT, /* ftp account data */
1369 STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */
1370 STRING_FTPPORT, /* port to send with the FTP PORT command */
1371 STRING_KEY_ORIG, /* private key file name */
1372 STRING_KEY_PROXY, /* private key file name */
1373 STRING_KEY_PASSWD_ORIG, /* plain text private key password */
1374 STRING_KEY_PASSWD_PROXY, /* plain text private key password */
1375 STRING_KEY_TYPE_ORIG, /* format for private key (default: PEM) */
1376 STRING_KEY_TYPE_PROXY, /* format for private key (default: PEM) */
1377 STRING_KRB_LEVEL, /* krb security level */
1378 STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find
1379 $HOME/.netrc */
1380 STRING_PROXY, /* proxy to use */
1381 STRING_PRE_PROXY, /* pre socks proxy to use */
1382 STRING_SET_RANGE, /* range, if used */
1383 STRING_SET_REFERER, /* custom string for the HTTP referer field */
1384 STRING_SET_URL, /* what original URL to work on */
1385 STRING_SSL_CAPATH_ORIG, /* CA directory name (doesn't work on windows) */
1386 STRING_SSL_CAPATH_PROXY, /* CA directory name (doesn't work on windows) */
1387 STRING_SSL_CAFILE_ORIG, /* certificate file to verify peer against */
1388 STRING_SSL_CAFILE_PROXY, /* certificate file to verify peer against */
1389 STRING_SSL_PINNEDPUBLICKEY_ORIG, /* public key file to verify peer against */
1390 STRING_SSL_PINNEDPUBLICKEY_PROXY, /* public key file to verify proxy */
1391 STRING_SSL_CIPHER_LIST_ORIG, /* list of ciphers to use */
1392 STRING_SSL_CIPHER_LIST_PROXY, /* list of ciphers to use */
1393 STRING_SSL_EGDSOCKET, /* path to file containing the EGD daemon socket */
1394 STRING_SSL_RANDOM_FILE, /* path to file containing "random" data */
1395 STRING_USERAGENT, /* User-Agent string */
1396 STRING_SSL_CRLFILE_ORIG, /* crl file to check certificate */
1397 STRING_SSL_CRLFILE_PROXY, /* crl file to check certificate */
1398 STRING_SSL_ISSUERCERT_ORIG, /* issuer cert file to check certificate */
1399 STRING_SSL_ISSUERCERT_PROXY, /* issuer cert file to check certificate */
1400 STRING_USERNAME, /* <username>, if used */
1401 STRING_PASSWORD, /* <password>, if used */
1402 STRING_OPTIONS, /* <options>, if used */
1403 STRING_PROXYUSERNAME, /* Proxy <username>, if used */
1404 STRING_PROXYPASSWORD, /* Proxy <password>, if used */
1405 STRING_NOPROXY, /* List of hosts which should not use the proxy, if
1406 used */
1407 STRING_RTSP_SESSION_ID, /* Session ID to use */
1408 STRING_RTSP_STREAM_URI, /* Stream URI for this request */
1409 STRING_RTSP_TRANSPORT, /* Transport for this session */
1410#ifdef USE_LIBSSH2
1411 STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */
1412 STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */
1413 STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ascii hex */
1414 STRING_SSH_KNOWNHOSTS, /* file name of knownhosts file */
1415#endif
1416#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
1417 STRING_PROXY_SERVICE_NAME, /* Proxy service name */
1418#endif
1419#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_KERBEROS5) || \
1420 defined(USE_SPNEGO) || defined(HAVE_GSSAPI)
1421 STRING_SERVICE_NAME, /* Service name */
1422#endif
1423 STRING_MAIL_FROM,
1424 STRING_MAIL_AUTH,
1425
1426#ifdef USE_TLS_SRP
1427 STRING_TLSAUTH_USERNAME_ORIG, /* TLS auth <username> */
1428 STRING_TLSAUTH_USERNAME_PROXY, /* TLS auth <username> */
1429 STRING_TLSAUTH_PASSWORD_ORIG, /* TLS auth <password> */
1430 STRING_TLSAUTH_PASSWORD_PROXY, /* TLS auth <password> */
1431#endif
1432 STRING_BEARER, /* <bearer>, if used */
1433#ifdef USE_UNIX_SOCKETS
1434 STRING_UNIX_SOCKET_PATH, /* path to Unix socket, if used */
1435#endif
1436 STRING_TARGET, /* CURLOPT_REQUEST_TARGET */
1437 /* -- end of zero-terminated strings -- */
1438
1439 STRING_LASTZEROTERMINATED,
1440
1441 /* -- below this are pointers to binary data that cannot be strdup'ed.
1442 Each such pointer must be added manually to Curl_dupset() --- */
1443
1444 STRING_COPYPOSTFIELDS, /* if POST, set the fields' values here */
1445
1446 STRING_LAST /* not used, just an end-of-list marker */
1447};
1448
1449struct UserDefined {
1450 FILE *err; /* the stderr user data goes here */
1451 void *debugdata; /* the data that will be passed to fdebug */
1452 char *errorbuffer; /* (Static) store failure messages in here */
1453 long proxyport; /* If non-zero, use this port number by default. If the
1454 proxy string features a ":[port]" that one will override
1455 this. */
1456 void *out; /* CURLOPT_WRITEDATA */
1457 void *in_set; /* CURLOPT_READDATA */
1458 void *writeheader; /* write the header to this if non-NULL */
1459 void *rtp_out; /* write RTP to this if non-NULL */
1460 long use_port; /* which port to use (when not using default) */
1461 unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */
1462 unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */
1463 unsigned long socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */
1464 long followlocation; /* as in HTTP Location: */
1465 long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
1466 for infinity */
1467
1468 int keep_post; /* keep POSTs as POSTs after a 30x request; each
1469 bit represents a request, from 301 to 303 */
1470 bool free_referer; /* set TRUE if 'referer' points to a string we
1471 allocated */
1472 void *postfields; /* if POST, set the fields' values here */
1473 curl_seek_callback seek_func; /* function that seeks the input */
1474 curl_off_t postfieldsize; /* if POST, this might have a size to use instead
1475 of strlen(), and then the data *may* be binary
1476 (contain zero bytes) */
1477 unsigned short localport; /* local port number to bind to */
1478 int localportrange; /* number of additional port numbers to test in case the
1479 'localport' one can't be bind()ed */
1480 curl_write_callback fwrite_func; /* function that stores the output */
1481 curl_write_callback fwrite_header; /* function that stores headers */
1482 curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */
1483 curl_read_callback fread_func_set; /* function that reads the input */
1484 int is_fread_set; /* boolean, has read callback been set to non-NULL? */
1485 int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */
1486 curl_progress_callback fprogress; /* OLD and deprecated progress callback */
1487 curl_xferinfo_callback fxferinfo; /* progress callback */
1488 curl_debug_callback fdebug; /* function that write informational data */
1489 curl_ioctl_callback ioctl_func; /* function for I/O control */
1490 curl_sockopt_callback fsockopt; /* function for setting socket options */
1491 void *sockopt_client; /* pointer to pass to the socket options callback */
1492 curl_opensocket_callback fopensocket; /* function for checking/translating
1493 the address and opening the
1494 socket */
1495 void *opensocket_client;
1496 curl_closesocket_callback fclosesocket; /* function for closing the
1497 socket */
1498 void *closesocket_client;
1499
1500 void *seek_client; /* pointer to pass to the seek callback */
1501 /* the 3 curl_conv_callback functions below are used on non-ASCII hosts */
1502 /* function to convert from the network encoding: */
1503 curl_conv_callback convfromnetwork;
1504 /* function to convert to the network encoding: */
1505 curl_conv_callback convtonetwork;
1506 /* function to convert from UTF-8 encoding: */
1507 curl_conv_callback convfromutf8;
1508
1509 void *progress_client; /* pointer to pass to the progress callback */
1510 void *ioctl_client; /* pointer to pass to the ioctl callback */
1511 long timeout; /* in milliseconds, 0 means no timeout */
1512 long connecttimeout; /* in milliseconds, 0 means no timeout */
1513 long accepttimeout; /* in milliseconds, 0 means no timeout */
1514 long server_response_timeout; /* in milliseconds, 0 means no timeout */
1515 long tftp_blksize; /* in bytes, 0 means use default */
1516 bool tftp_no_options; /* do not send TFTP options requests */
1517 curl_off_t filesize; /* size of file to upload, -1 means unknown */
1518 long low_speed_limit; /* bytes/second */
1519 long low_speed_time; /* number of seconds */
1520 curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */
1521 curl_off_t max_recv_speed; /* high speed limit in bytes/second for
1522 download */
1523 curl_off_t set_resume_from; /* continue [ftp] transfer from here */
1524 struct curl_slist *headers; /* linked list of extra headers */
1525 struct curl_slist *proxyheaders; /* linked list of extra CONNECT headers */
1526 struct curl_httppost *httppost; /* linked list of old POST data */
1527 curl_mimepart mimepost; /* MIME/POST data. */
1528 bool sep_headers; /* handle host and proxy headers separately */
1529 bool cookiesession; /* new cookie session? */
1530 bool crlf; /* convert crlf on ftp upload(?) */
1531 struct curl_slist *quote; /* after connection is established */
1532 struct curl_slist *postquote; /* after the transfer */
1533 struct curl_slist *prequote; /* before the transfer, after type */
1534 struct curl_slist *source_quote; /* 3rd party quote */
1535 struct curl_slist *source_prequote; /* in 3rd party transfer mode - before
1536 the transfer on source host */
1537 struct curl_slist *source_postquote; /* in 3rd party transfer mode - after
1538 the transfer on source host */
1539 struct curl_slist *telnet_options; /* linked list of telnet options */
1540 struct curl_slist *resolve; /* list of names to add/remove from
1541 DNS cache */
1542 struct curl_slist *connect_to; /* list of host:port mappings to override
1543 the hostname and port to connect to */
1544 curl_TimeCond timecondition; /* kind of time/date comparison */
1545 time_t timevalue; /* what time to compare with */
1546 Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
1547 long httpversion; /* when non-zero, a specific HTTP version requested to
1548 be used in the library's request(s) */
1549 bool strip_path_slash; /* strip off initial slash from path */
1550 struct ssl_config_data ssl; /* user defined SSL stuff */
1551 struct ssl_config_data proxy_ssl; /* user defined SSL stuff for proxy */
1552 struct ssl_general_config general_ssl; /* general user defined SSL stuff */
1553 curl_proxytype proxytype; /* what kind of proxy that is in use */
1554 long dns_cache_timeout; /* DNS cache timeout */
1555 long buffer_size; /* size of receive buffer to use */
1556 void *private_data; /* application-private data */
1557
1558 struct curl_slist *http200aliases; /* linked list of aliases for http200 */
1559
1560 long ipver; /* the CURL_IPRESOLVE_* defines in the public header file
1561 0 - whatever, 1 - v2, 2 - v6 */
1562
1563 curl_off_t max_filesize; /* Maximum file size to download */
1564
1565 curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used */
1566
1567 int ftp_create_missing_dirs; /* 1 - create directories that don't exist
1568 2 - the same but also allow MKD to fail once
1569 */
1570
1571 curl_sshkeycallback ssh_keyfunc; /* key matching callback */
1572 void *ssh_keyfunc_userp; /* custom pointer to callback */
1573 bool ssh_compression; /* enable SSH compression */
1574
1575/* Here follows boolean settings that define how to behave during
1576 this session. They are STATIC, set by libcurl users or at least initially
1577 and they don't change during operations. */
1578
1579 bool printhost; /* printing host name in debug info */
1580 bool get_filetime; /* get the time and get of the remote file */
1581 bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */
1582 bool prefer_ascii; /* ASCII rather than binary */
1583 bool ftp_append; /* append, not overwrite, on upload */
1584 bool ftp_list_only; /* switch FTP command for listing directories */
1585 bool ftp_use_port; /* use the FTP PORT command */
1586 bool hide_progress; /* don't use the progress meter */
1587 bool http_fail_on_error; /* fail on HTTP error codes >= 400 */
1588 bool http_keep_sending_on_error; /* for HTTP status codes >= 300 */
1589 bool http_follow_location; /* follow HTTP redirects */
1590 bool http_transfer_encoding; /* request compressed HTTP transfer-encoding */
1591 bool http_disable_hostname_check_before_authentication;
1592 bool include_header; /* include received protocol headers in data output */
1593 bool http_set_referer; /* is a custom referer used */
1594 bool http_auto_referer; /* set "correct" referer when following location: */
1595 bool opt_no_body; /* as set with CURLOPT_NOBODY */
1596 bool upload; /* upload request */
1597 enum CURL_NETRC_OPTION
1598 use_netrc; /* defined in include/curl.h */
1599 bool verbose; /* output verbosity */
1600 bool krb; /* Kerberos connection requested */
1601 bool reuse_forbid; /* forbidden to be reused, close after use */
1602 bool reuse_fresh; /* do not re-use an existing connection */
1603 bool ftp_use_epsv; /* if EPSV is to be attempted or not */
1604 bool ftp_use_eprt; /* if EPRT is to be attempted or not */
1605 bool ftp_use_pret; /* if PRET is to be used before PASV or not */
1606
1607 curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
1608 IMAP or POP3 or others! */
1609 curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
1610 curl_ftpccc ftp_ccc; /* FTP CCC options */
1611 bool no_signal; /* do not use any signal/alarm handler */
1612 bool global_dns_cache; /* subject for future removal */
1613 bool tcp_nodelay; /* whether to enable TCP_NODELAY or not */
1614 bool ignorecl; /* ignore content length */
1615 bool ftp_skip_ip; /* skip the IP address the FTP server passes on to
1616 us */
1617 bool connect_only; /* make connection, let application use the socket */
1618 long ssh_auth_types; /* allowed SSH auth types */
1619 bool http_te_skip; /* pass the raw body data to the user, even when
1620 transfer-encoded (chunked, compressed) */
1621 bool http_ce_skip; /* pass the raw body data to the user, even when
1622 content-encoded (chunked, compressed) */
1623 long new_file_perms; /* Permissions to use when creating remote files */
1624 long new_directory_perms; /* Permissions to use when creating remote dirs */
1625 bool proxy_transfer_mode; /* set transfer mode (;type=<a|i>) when doing FTP
1626 via an HTTP proxy */
1627 char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
1628 unsigned int scope_id; /* Scope id for IPv6 */
1629 long allowed_protocols;
1630 long redir_protocols;
1631#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
1632 bool socks5_gssapi_nec; /* Flag to support NEC SOCKS5 server */
1633#endif
1634 struct curl_slist *mail_rcpt; /* linked list of mail recipients */
1635 bool sasl_ir; /* Enable/disable SASL initial response */
1636 /* Common RTSP header options */
1637 Curl_RtspReq rtspreq; /* RTSP request type */
1638 long rtspversion; /* like httpversion, for RTSP */
1639 bool wildcard_enabled; /* enable wildcard matching */
1640 curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer
1641 starts */
1642 curl_chunk_end_callback chunk_end; /* called after part transferring
1643 stopped */
1644 curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds
1645 to pattern (e.g. if WILDCARDMATCH is on) */
1646 void *fnmatch_data;
1647
1648 long gssapi_delegation; /* GSS-API credential delegation, see the
1649 documentation of CURLOPT_GSSAPI_DELEGATION */
1650
1651 bool tcp_keepalive; /* use TCP keepalives */
1652 long tcp_keepidle; /* seconds in idle before sending keepalive probe */
1653 long tcp_keepintvl; /* seconds between TCP keepalive probes */
1654 bool tcp_fastopen; /* use TCP Fast Open */
1655
1656 size_t maxconnects; /* Max idle connections in the connection cache */
1657
1658 bool ssl_enable_npn; /* TLS NPN extension? */
1659 bool ssl_enable_alpn; /* TLS ALPN extension? */
1660 bool path_as_is; /* allow dotdots? */
1661 bool pipewait; /* wait for pipe/multiplex status before starting a
1662 new connection */
1663 long expect_100_timeout; /* in milliseconds */
1664 bool suppress_connect_headers; /* suppress proxy CONNECT response headers
1665 from user callbacks */
1666
1667 struct Curl_easy *stream_depends_on;
1668 bool stream_depends_e; /* set or don't set the Exclusive bit */
1669 int stream_weight;
1670
1671 struct Curl_http2_dep *stream_dependents;
1672
1673 bool abstract_unix_socket;
1674};
1675
1676struct Names {
1677 struct curl_hash *hostcache;
1678 enum {
1679 HCACHE_NONE, /* not pointing to anything */
1680 HCACHE_GLOBAL, /* points to the (shrug) global one */
1681 HCACHE_MULTI, /* points to a shared one in the multi handle */
1682 HCACHE_SHARED /* points to a shared one in a shared object */
1683 } hostcachetype;
1684};
1685
1686/*
1687 * The 'connectdata' struct MUST have all the connection oriented stuff as we
1688 * may have several simultaneous connections and connection structs in memory.
1689 *
1690 * The 'struct UserDefined' must only contain data that is set once to go for
1691 * many (perhaps) independent connections. Values that are generated or
1692 * calculated internally for the "session handle" must be defined within the
1693 * 'struct UrlState' instead.
1694 */
1695
1696struct Curl_easy {
1697 /* first, two fields for the linked list of these */
1698 struct Curl_easy *next;
1699 struct Curl_easy *prev;
1700
1701 struct connectdata *easy_conn; /* the "unit's" connection */
1702 struct curl_llist_element connect_queue;
1703 struct curl_llist_element pipeline_queue;
1704
1705 CURLMstate mstate; /* the handle's state */
1706 CURLcode result; /* previous result */
1707
1708 struct Curl_message msg; /* A single posted message. */
1709
1710 /* Array with the plain socket numbers this handle takes care of, in no
1711 particular order. Note that all sockets are added to the sockhash, where
1712 the state etc are also kept. This array is mostly used to detect when a
1713 socket is to be removed from the hash. See singlesocket(). */
1714 curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE];
1715 int numsocks;
1716
1717 struct Names dns;
1718 struct Curl_multi *multi; /* if non-NULL, points to the multi handle
1719 struct to which this "belongs" when used by
1720 the multi interface */
1721 struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle
1722 struct to which this "belongs" when used
1723 by the easy interface */
1724 struct Curl_share *share; /* Share, handles global variable mutexing */
1725 struct SingleRequest req; /* Request-specific data */
1726 struct UserDefined set; /* values set by the libcurl user */
1727 struct DynamicStatic change; /* possibly modified userdefined data */
1728 struct CookieInfo *cookies; /* the cookies, read from files and servers.
1729 NOTE that the 'cookie' field in the
1730 UserDefined struct defines if the "engine"
1731 is to be used or not. */
1732 struct Progress progress; /* for all the progress meter data */
1733 struct UrlState state; /* struct for fields used for state info and
1734 other dynamic purposes */
1735 struct WildcardData wildcard; /* wildcard download state info */
1736 struct PureInfo info; /* stats, reports and info data */
1737 struct curl_tlssessioninfo tsi; /* Information about the TLS session, only
1738 valid after a client has asked for it */
1739#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
1740 iconv_t outbound_cd; /* for translating to the network encoding */
1741 iconv_t inbound_cd; /* for translating from the network encoding */
1742 iconv_t utf8_cd; /* for translating to UTF8 */
1743#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
1744 unsigned int magic; /* set to a CURLEASY_MAGIC_NUMBER */
1745};
1746
1747#define LIBCURL_NAME "libcurl"
1748
1749#endif /* HEADER_CURL_URLDATA_H */
Note: See TracBrowser for help on using the repository browser.