Artifactspublic-v0

curl

master
ply4 git calls39 ms305 KiB3 cachedprotocol v2
1224 lines51 KiBRaw
1#ifndef HEADER_CURL_URLDATA_H
2#define HEADER_CURL_URLDATA_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26/* This file is for lib internal stuff */
27#include "curl_setup.h"
29#define CURL_DEFAULT_USER "anonymous"
30#define CURL_DEFAULT_PASSWORD "ftp@example.com"
32#if !defined(_WIN32) && !defined(MSDOS)
33/* do FTP line-end CRLF => LF conversions on platforms that prefer LF-only. It
34 also means: keep CRLF line endings on the CRLF platforms */
35#define CURL_PREFER_LF_LINEENDS
36#endif
38#define DEFAULT_CONNCACHE_SIZE 5
40/* length of longest IPv6 address string including the null-terminator */
41#define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")
43/* Max string input length is a precaution against abuse and to detect junk
44 input easier and better. */
45#define CURL_MAX_INPUT_LENGTH 8000000
47#ifdef HAVE_NETINET_IN_H
48#include <netinet/in.h>
49#endif
50#ifdef HAVE_NETINET_IN6_H
51#include <netinet/in6.h>
52#endif
54#include "curlx/timeval.h"
56#include "api.h"
57#include "cookie.h"
58#include "creds.h"
59#include "psl.h"
60#include "formdata.h"
61#include "http_chunks.h" /* for the structs and enum stuff */
62#include "hash.h"
63#include "peer.h"
64#include "proxy.h"
65#include "splay.h"
66#include "curlx/dynbuf.h"
67#include "bufref.h"
68#include "dynhds.h"
69#include "request.h"
70#include "ratelimit.h"
71#include "netrc.h"
72#include "u8_strset.h"
73#include "vdns/asyn.h"
74#include "vdns/hostip.h"
75#include "vtls/vtls_config.h"
77/* On error return, the value of `pnwritten` has no meaning */
78typedef CURLcode (Curl_send)(struct Curl_easy *data, /* transfer */
79 int8_t sockindex, /* socketindex */
80 const uint8_t *buf, /* data to write */
81 size_t len, /* amount to send */
82 bool eos, /* last chunk */
83 size_t *pnwritten); /* how much sent */
85/* On error return, the value of `pnread` has no meaning */
86typedef CURLcode (Curl_recv)(struct Curl_easy *data, /* transfer */
87 int8_t sockindex, /* socketindex */
88 char *buf, /* store data here */
89 size_t len, /* max amount to read */
90 size_t *pnread); /* how much received */
92#include "mime.h"
93#include "protocol.h"
94#include "ftp.h"
95#include "http.h"
96#include "mqtt.h"
97#include "ftplistparser.h"
98#include "multihandle.h"
99#include "cf-socket.h"
101#ifdef HAVE_GSSAPI
102# ifdef HAVE_GSSAPPLE
103# include <GSS/gssapi.h>
104# include <GSS/gssapi_oid.h>
105# elif defined(HAVE_GSSGNU)
106# include <gss.h>
107# elif defined(HAVE_GSSAPI_H)
108# include <gssapi.h>
109# else /* MIT Kerberos */
110# include <gssapi/gssapi.h>
111# include <gssapi/gssapi_krb5.h> /* for GSS_C_CHANNEL_BOUND_FLAG in 1.19+ */
112# endif
113#endif
115#ifdef USE_LIBSSH2
116#include <libssh2.h>
117#include <libssh2_sftp.h>
118#endif /* USE_LIBSSH2 */
120#define READBUFFER_SIZE CURL_MAX_WRITE_SIZE
121#define READBUFFER_MAX CURL_MAX_READ_SIZE
122#define READBUFFER_MIN 1024
124/* The default upload buffer size, should not be smaller than
125 CURL_MAX_WRITE_SIZE, as it needs to hold a full buffer as could be sent in
126 a write callback.
128 The size was 16KB for many years but was bumped to 64KB because it makes
129 libcurl able to do significantly faster uploads in some circumstances. Even
130 larger buffers can help further, but this is deemed a fair memory/speed
131 compromise. */
132#define UPLOADBUFFER_DEFAULT 65536
133#define UPLOADBUFFER_MAX (2 * 1024 * 1024)
134#define UPLOADBUFFER_MIN CURL_MAX_WRITE_SIZE
136#ifdef USE_WINDOWS_SSPI
137#include "curl_sspi.h"
138#endif
140#ifndef CURL_DISABLE_DIGEST_AUTH
141/* Struct used for Digest challenge-response authentication */
142struct digestdata {
143 struct Curl_creds *creds;
144 struct Curl_peer *origin;
145#ifdef USE_WINDOWS_SSPI
146 BYTE *input_token;
147 size_t input_token_len;
148 CtxtHandle *http_context;
149#else
150 char *nonce;
151 char *cnonce;
152 char *realm;
153 char *opaque;
154 char *qop;
155 char *algorithm;
156 int nc; /* nonce count */
157 uint8_t algo;
158 BIT(stale); /* set true for re-negotiation */
159 BIT(userhash);
160#endif
161};
162#endif
164#define CURL_NEGO_AUTH_NONE 0U
165#define CURL_NEGO_AUTH_RECV 1U
166#define CURL_NEGO_AUTH_SENT 2U
167#define CURL_NEGO_AUTH_DONE 3U
168#define CURL_NEGO_AUTH_SUCC 4U
170/*
171 * Boolean values that concerns this connection.
172 */
173struct ConnectBits {
174 BIT(connect_only);
175#ifndef CURL_DISABLE_PROXY
176 BIT(origin_is_proxy); /* if set, the connection's origin is a proxy */
177 BIT(socks5_authenticated); /* SOCKS5 authenticated on FIRSTSOCKET */
178#endif
179 /* always modify bits.close with the connclose() and connkeep() macros! */
180 BIT(close); /* if set, we close the connection after this request */
181 BIT(reuse); /* if set, this is a reused connection */
182 BIT(altused); /* this is an alt-svc "redirect" */
183 BIT(ipv6); /* we communicate with a site using an IPv6 address */
184 BIT(do_more); /* this is set TRUE if the ->curl_do_more() function is
185 supposed to be called, after ->curl_do() */
186 BIT(protoconnstart);/* the protocol layer has STARTED its operation after
187 the TCP layer connect */
188 BIT(retry); /* this connection is about to get closed and then
189 re-attempted at another connection. */
190#ifndef CURL_DISABLE_FTP
191 BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
192 EPSV does not work we disable it for the forthcoming
193 requests */
194 BIT(ftp_use_eprt); /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
195 EPRT does not work we disable it for the forthcoming
196 requests */
197 BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
198#endif
199 BIT(bound); /* set true if bind() has already been done on this socket/
200 connection */
201 BIT(upgrade_in_progress); /* protocol upgrade is in progress */
202 BIT(multiplex); /* connection is multiplexed */
203 BIT(tcp_fastopen); /* use TCP Fast Open */
204 BIT(tls_enable_alpn); /* TLS ALPN extension? */
205 BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
206 accept() */
207 BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
208 started (happy eyeballs) */
209 BIT(aborted); /* connection was aborted, e.g. in unclean state */
210 BIT(no_reuse); /* connection should not be reused */
211 BIT(shutdown_handler); /* connection shutdown: handler shut down */
212 BIT(shutdown_filters); /* connection shutdown: filters shut down */
213 BIT(dns_resolved); /* DNS records for connection were resolved */
214};
216struct hostname {
217 char *rawalloc; /* allocated "raw" version of the name */
218 char *encalloc; /* allocated IDN-encoded version of the name */
219 char *name; /* name to use internally, might be encoded, might be raw */
220 const char *dispname; /* name to display, as 'name' might be encoded */
221};
223#define FIRSTSOCKET 0
224#define SECONDARYSOCKET 1
226#define TRNSPRT_NONE 0
227#define TRNSPRT_TCP 3
228#define TRNSPRT_UDP 4
229#define TRNSPRT_QUIC 5
230#define TRNSPRT_UNIX 6
232#define TRNSPRT_IS_DGRAM(x) (((x) == TRNSPRT_UDP) || ((x) == TRNSPRT_QUIC))
234struct ip_quadruple {
235 char remote_ip[MAX_IPADR_LEN];
236 char local_ip[MAX_IPADR_LEN];
237 uint16_t remote_port;
238 uint16_t local_port;
239 uint8_t transport;
240};
242#define CUR_IP_QUAD_HAS_PORTS(x) \
243 (((x)->transport == TRNSPRT_TCP) || \
244 ((x)->transport == TRNSPRT_UDP) || \
245 ((x)->transport == TRNSPRT_QUIC))
247/*
248 * The connectdata struct contains all fields and variables that should be
249 * unique for an entire connection.
250 */
251struct connectdata {
252 curl_off_t connection_id; /* Contains a unique number to make it easier to
253 track the connections in the log output */
255 /* A connection cache from a SHARE might be used in several multi handles.
256 * We MUST not reuse connections that are running in another multi,
257 * for concurrency reasons. That multi might run in another thread.
258 * `attached_multi` is set by the first transfer attached and cleared
259 * when the last one is detached.
260 * NEVER call anything on this multi, check for equality. */
261 struct Curl_multi *attached_multi;
263 /* Who the connection is talking to, ultimately */
264 struct Curl_peer *origin; /* connection ultimately talks to this */
265 struct Curl_peer *via_peer; /* if set, connection really talks to this */
266 struct Curl_peer *origin2; /* origin of SECONDARYSOCKET */
267 struct Curl_peer *via_peer2; /* peer of SECONDARYSOCKET */
268 struct Curl_creds *creds; /* When connection itself is tied to credentials */
269 struct Curl_peer *creds_origin; /* origin tied credentials are for */
270 const struct Curl_scheme *scheme; /* Connection's real protocol handler */
272 /* `meta_hash` is a general key-value store for implementations
273 * with the lifetime of the connection.
274 * Elements need to be added with their own destructor to be invoked when
275 * the connection is cleaned up (see Curl_hash_add2()).*/
276 struct Curl_hash meta_hash;
278 char *destination; /* hostname+port, used in conncache */
280 struct curltime created; /* creation time */
281 /* timediff_t are deltas from `created`*/
282 timediff_t lastused_ms; /* when returned to the connection pool as idle */
283 timediff_t lastchecked_ms; /* when last checked alive status */
284 timediff_t lastupkeep_ms; /* when last done conn_upkeep */
285 timediff_t connect_start_ms; /* when ongoing connect attempt started */
287#ifndef CURL_DISABLE_PROXY
288 struct proxy_info socks_proxy;
289 struct proxy_info http_proxy;
290#endif
292 /* A connection can have one or two sockets and connection filters.
293 * The protocol using the 2nd one is FTP for CONTROL+DATA sockets */
294 struct Curl_cfilter *cfilter[2]; /* connection filters */
295 Curl_recv *recv[2];
296 Curl_send *send[2];
297 curl_socket_t sock[2];
299#define CONN_SOCK_IDX_VALID(i) (((i) >= 0) && ((i) < 2))
301 struct {
302 timediff_t start_ms[2]; /* when filter shutdown started */
303 timediff_t timeout_ms; /* 0 means no timeout */
304 } shutdown;
306 curl_closesocket_callback fclosesocket; /* function closing the socket(s) */
307 void *closesocket_client;
309 struct ssl_filter_config ssl_config;
310#ifndef CURL_DISABLE_PROXY
311 struct ssl_filter_config proxy_ssl_config;
312#endif
313 char *options; /* options string, allocated */
315 /*************** Request - specific items ************/
316#ifdef USE_WINDOWS_SSPI
317 CtxtHandle *sslContext;
318#endif
320 /* When this connection is created, store the conditions for the local end
321 bind. This is stored before the actual bind and before any connection is
322 made and will serve the purpose of being used for comparison reasons so
323 that subsequent bound-requested connections are not accidentally reusing
324 wrong connections. */
325 char *interface_opts;
326 struct ConnectBits bits; /* various state-flags for this connection */
327#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
328 int socks5_gssapi_enctype;
329#endif
331 /* This is used by the connection pool logic. If this returns TRUE, this
332 handle is still used by one or more easy handles and can only used by any
333 other easy handle without careful consideration (== only for
334 multiplexing) and it cannot be used by another multi handle! */
335#define CONN_INUSE(c) (!!(c)->attached_xfers)
336 uint32_t attached_xfers; /* # of attached easy handles */
338 uint32_t cpid; /* connection pool id */
340#ifdef USE_IPV6
341 uint32_t scope_id; /* Scope id for IPv6 */
342#endif
343 uint16_t localportrange;
344 uint16_t localport;
345 int8_t recv_idx; /* on which socket index to receive, default 0 */
346 int8_t send_idx; /* on which socket index to send, default 0 */
347 uint8_t transport_wanted; /* one of the TRNSPRT_* defines. Not necessarily
348 the transport the connection ends using due to Alt-Svc and happy
349 eyeballing. Use Curl_conn_get_transport() for actual value once the
350 connection is set up. */
351 uint8_t ip_version; /* copied from the Curl_easy at creation time */
352 /* HTTP version last responded with by the server or negotiated via ALPN.
353 * 0 at start, then one of 09, 10, 11, etc. */
354 uint8_t httpversion_seen;
355 uint8_t gssapi_delegation; /* inherited from set.gssapi_delegation */
356#ifdef USE_SPNEGO
357 uint8_t http_negotiate_state;
358 uint8_t proxy_negotiate_state;
359#endif
360};
362#ifndef CURL_DISABLE_PROXY
363#define CURL_CONN_HOST_DISPNAME(c) \
364 ((c)->socks_proxy.peer ? (c)->socks_proxy.peer->user_hostname : \
365 (c)->http_proxy.peer ? (c)->http_proxy.peer->user_hostname : \
366 (c)->via_peer ? (c)->via_peer->user_hostname : \
367 (c)->origin->user_hostname)
368#else
369#define CURL_CONN_HOST_DISPNAME(c) \
370 ((c)->via_peer ? (c)->via_peer->user_hostname : (c)->origin->user_hostname)
371#endif
373/* The end of connectdata. */
375/*
376 * Struct to keep statistical and informational data.
377 * All variables in this struct must be initialized/reset in Curl_initinfo().
378 */
379struct PureInfo {
380 /* PureInfo primary ip_quadruple is copied over from the connectdata
381 struct in order to allow curl_easy_getinfo() to return this information
382 even when the session handle is no longer associated with a connection,
383 and also allow curl_easy_reset() to clear this information from the
384 session handle without disturbing information which is still alive, and
385 that might be reused, in the connection pool. */
386 struct ip_quadruple primary;
387 struct curl_certinfo certs; /* info about the certs. Asked for with
388 CURLOPT_CERTINFO / CURLINFO_CERTINFO */
389 time_t filetime; /* If requested, this is might get set. Set to -1 if the
390 time was unretrievable. */
391 curl_off_t request_size; /* the amount of bytes sent in the request(s) */
392 curl_off_t numconnects; /* how many new connections libcurl created */
393 char *contenttype; /* the content type of the object */
394 char *wouldredirect; /* URL this would have been redirected to if asked to */
395 char *effective_url; /* when needed */
396 curl_off_t retry_after; /* info from Retry-After: header */
397 const char *conn_scheme;
398 int httpcode; /* Recent HTTP, FTP, RTSP or SMTP response code */
399 int httpproxycode; /* response code from proxy when received separate */
400 int httpversion; /* the http version number X.Y = X*10+Y */
401 uint32_t conn_protocol;
402 uint32_t proxyauthavail; /* what proxy auth types were announced */
403 uint32_t httpauthavail; /* what host auth types were announced */
404 uint32_t proxyauthpicked; /* selected proxy auth type */
405 uint32_t httpauthpicked; /* selected host auth type */
406 uint32_t header_size; /* size of read header(s) in bytes */
407 uint8_t pxcode; /* holds a CURLproxycode */
408 BIT(timecond); /* set to TRUE if the time condition did not match, which
409 thus made the document NOT get fetched */
410 BIT(used_proxy); /* the transfer used a proxy */
411};
413struct pgrs_dir {
414 curl_off_t total_size; /* total expected bytes */
415 curl_off_t cur_size; /* transferred bytes so far */
416 curl_off_t speed; /* bytes per second transferred */
417 struct Curl_rlimit rlimit; /* speed limiting / pausing */
418};
420struct Progress {
421 struct curltime now; /* current time of processing */
422 struct curltime start; /* when transfer was initialized, set once */
424 struct pgrs_dir ul;
425 struct pgrs_dir dl;
426 curl_off_t deliver; /* amount of data delivered to application */
427 curl_off_t current_speed; /* uses the currently fastest transfer */
428 curl_off_t earlydata_sent;
430 struct {
431 timediff_t startop_us; /* since start when operations started */
432 timediff_t startsingle_us; /* since start when last request started */
433 timediff_t startqueue_us; /* since start when last entered queueing */
434 timediff_t startredirect_us; /* since start when last redirected */
435 timediff_t lastshow_us; /* since start when last progress shown */
436 } delta;
437 struct {
438 timediff_t spent_us; /* all time spent since start */
439 timediff_t queued_us; /* time spent since startsingle's for queueing */
440 timediff_t nslookup_us; /* same for name resolves */
441 timediff_t connect_us; /* same for connects */
442 timediff_t appconnect_us; /* same for application connects, e.g. TLS */
443 timediff_t pretransfer_us; /* same until requests were sent */
444 timediff_t starttransfer_us; /* same until responses started */
445 timediff_t posttransfer_us; /* same until responses ended */
446 } total;
448#define CURL_SPEED_RECORDS (5 + 1) /* 6 entries for 5 seconds */
450 curl_off_t speed_amount[CURL_SPEED_RECORDS];
451 timediff_t speed_time[CURL_SPEED_RECORDS];
452 uint32_t speeder_c;
453 BIT(hide);
454 BIT(ul_size_known);
455 BIT(dl_size_known);
456 BIT(headers_out); /* when the headers have been written */
457 BIT(callback); /* set when progress callback is used */
458 BIT(startransfer_added);
459};
461struct auth {
462 uint32_t want; /* Bitmask set to the authentication methods wanted by app
463 (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */
464 uint32_t picked;
465 uint32_t avail; /* Bitmask for what the server reports to support for this
466 resource */
467 BIT(done); /* TRUE when the auth phase is done and ready to do the
468 actual request */
469 BIT(multipass); /* TRUE if this is not yet authenticated but within the
470 auth multipass negotiation */
471};
473#ifdef USE_NGHTTP2
474struct Curl_data_prio_node {
475 struct Curl_data_prio_node *next;
476 struct Curl_easy *data;
477};
478#endif
480/* Timers */
481typedef enum {
482 EXPIRE_100_TIMEOUT,
483 EXPIRE_ASYNC_NAME,
484 EXPIRE_CONNECTTIMEOUT,
485 EXPIRE_HAPPY_EYEBALLS,
486 EXPIRE_MULTI_PENDING,
487 EXPIRE_SPEEDCHECK,
488 EXPIRE_TIMEOUT,
489 EXPIRE_TOOFAST,
490 EXPIRE_QUIC,
491 EXPIRE_FTP_ACCEPT,
492 EXPIRE_ALPN_EYEBALLS,
493 EXPIRE_SHUTDOWN,
494 EXPIRE_SERVER_RESPONSE,
495 EXPIRE_LAST /* not an actual timer, used as a marker only */
496} expire_id;
498struct expire_timers {
499 struct Curl_tree splaynode; /* for the splay stuff */
500 /* microsecond offset from Curl_timeouts base timestamp */
501 timediff_t offset_us[EXPIRE_LAST];
502 uint8_t next[EXPIRE_LAST];
503 uint8_t first;
504};
506/* individual pieces of the URL */
507struct urlpieces {
508 char *options;
509 char *path;
510 char *query;
511};
513struct UrlState {
514 /* Origin of the initial (e.g. not followed) request of a transfer.
515 Credentials from CURLOPT_* are only valid for this origin.
516 Always set once a transfer starts searching for connections. */
517 struct Curl_peer *initial_origin;
518 /* Current origin of the transfer, changes to origin of follow
519 * requests. */
520 struct Curl_peer *origin;
522 struct curltime keeps_speed; /* for the progress meter really */
523 struct dynbuf headerb; /* buffer to store headers in */
524#ifndef CURL_DISABLE_HSTS
525 struct curl_slist *hstslist; /* list of HSTS files set by
526 curl_easy_setopt(HSTS) calls */
527#endif
529 int os_errno; /* filled in with errno whenever an error occurs */
530 int requests; /* request counter: redirects + authentication retakes */
531#ifdef HAVE_SIGNAL
532 /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
533 void (*prev_signal)(int sig);
534#endif
535#ifndef CURL_DISABLE_DIGEST_AUTH
536 char *envproxy; /* last proxy string used for proxy-related state */
537 struct digestdata digest; /* state data for host Digest auth */
538 struct digestdata proxydigest; /* state data for proxy Digest auth */
539#endif
540 struct auth authhost; /* auth details for host */
541 struct auth authproxy; /* auth details for proxy */
543#ifdef USE_CURL_ASYNC
544 struct Curl_resolv_async *async; /* asynchronous name resolver data */
545#endif
547 struct expire_timers timeouts; /* expire timeouts */
549 /* a place to store the most recently set (S)FTP entrypath */
550 char *most_recent_ftp_entrypath;
551 char *range; /* range, if used. See README for detailed specification on
552 this syntax. */
553 curl_off_t resume_from; /* continue [ftp] transfer from here */
554 curl_off_t infilesize; /* size of file to upload, -1 means unknown.
555 Copied from set.filesize at start of operation */
556 curl_read_callback fread_func; /* read callback/function */
557 void *in; /* CURLOPT_READDATA */
558 CURLU *uh; /* URL handle for the current parsed URL */
559 struct urlpieces up;
560 struct bufref url; /* work URL, initially copied from UserDefined */
561 struct bufref referer; /* referer string */
562 struct curl_slist *resolve; /* set to point to the set.resolve list when
563 this should be dealt with in pretransfer */
564#ifndef CURL_DISABLE_HTTP
565 curl_mimepart *mimepost;
566#ifndef CURL_DISABLE_FORM_API
567 curl_mimepart *formp; /* storage for old API form-posting, allocated on
568 demand */
569#endif
570 struct Curl_llist httphdrs; /* received headers */
571 struct curl_header headerout[2]; /* for external purposes */
572 /* curl_easy_nextheader() cache parameters */
573 unsigned int nh_origin;
574 int nh_request;
575 size_t nh_count; /* httphdrs count when the cache was filled */
576#endif
577#ifndef CURL_DISABLE_COOKIES
578 struct curl_slist *cookielist; /* list of cookie files set by
579 curl_easy_setopt(COOKIEFILE) calls */
580#endif
582#ifdef CURLVERBOSE
583 struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */
584#endif
586#ifndef CURL_DISABLE_NETRC
587 struct store_netrc netrc;
588#endif
590 struct Curl_creds *creds; /* Credentials for the origin only */
592#ifndef CURL_DISABLE_HTTP
593 char *rangeline; /* allocated */
594 char *http_host; /* allocated */
595 struct http_negotiation http_neg;
596#endif
597#ifndef CURL_DISABLE_RTSP
598 /* This RTSP state information survives requests and connections */
599 struct Curl_peer *rtsp_session_origin; /* origin that issued the session id,
600 NULL when set by the application */
601 uint8_t rtp_channel_mask[32]; /* for the correctness checking of the
602 interleaved data */
603 uint32_t rtsp_next_client_CSeq; /* the session's next client CSeq */
604 uint32_t rtsp_next_server_CSeq; /* the session's next server CSeq */
605 uint32_t rtsp_CSeq_recv; /* most recent CSeq received */
606#endif
608 curl_off_t last_conn_id; /* The last assigned connection or -1 */
609 uint32_t last_cpid; /* last connection pool id used */
611#if defined(USE_HTTP2) || defined(USE_HTTP3)
612 int weight; /* shallow copy of data->set */
613#endif
614 uint16_t followlocation; /* redirect counter */
615 uint8_t retrycount; /* number of retries on a new connection, up to
616 CONN_MAX_RETRIES */
617 uint8_t httpreq; /* Curl_HttpReq; what kind of HTTP request (if any)
618 is this */
620 BIT(really_alive); /* transfer is really alive in multi, passed INIT */
621 BIT(this_is_a_follow); /* this is a followed Location: request */
622 BIT(refused_stream); /* this was refused, try again */
623 BIT(errorbuf); /* Set to TRUE if the error buffer is already filled in.
624 This must be set to FALSE every time _easy_perform() is
625 called. */
626 BIT(allow_port); /* Is set.use_port allowed to take effect or not. This
627 is always set TRUE when curl_easy_perform() is called. */
628 BIT(authproblem); /* TRUE if there is some problem authenticating */
629 /* set after initial USER failure, to prevent an authentication loop */
630 BIT(wildcardmatch); /* enable wildcard matching */
631 BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous
632 417 response */
633 BIT(use_range);
634 BIT(rangestringalloc); /* the range string is malloc()'ed */
635 BIT(done); /* set to FALSE when Curl_init_transfer() is called and set to
636 TRUE when multi_done() is called, to prevent multi_done() from
637 being invoked twice. */
638#ifndef CURL_DISABLE_COOKIES
639 BIT(cookie_engine);
640#endif
641 BIT(prefer_ascii); /* ASCII rather than binary */
642#ifdef CURL_LIST_ONLY_PROTOCOL
643 BIT(list_only); /* list directory contents */
644#endif
645 BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */
646 BIT(upload); /* upload request */
647 BIT(internal); /* internal: true if this easy handle was created for
648 internal use and the user does not have ownership of the
649 handle. */
650 BIT(http_ignorecustom); /* ignore custom method from now */
651#ifndef CURL_DISABLE_HTTP
652 BIT(http_hd_te); /* Added HTTP header TE: */
653 BIT(http_hd_upgrade); /* Added HTTP header Upgrade: */
654 BIT(http_hd_h2_settings); /* Added HTTP header H2Settings: */
655 BIT(maybe_folded);
656 BIT(leading_unfold); /* unfold started, this is the leading bytes */
657#endif
658};
660/*
661 * This 'UserDefined' struct must only contain data that is set once to go
662 * for many (perhaps) independent connections. Values that are generated or
663 * calculated internally for the "session handle" MUST be defined within the
664 * 'struct UrlState' instead. The only exceptions MUST note the changes in
665 * the 'DynamicStatic' struct.
666 * Character pointer fields point to dynamic storage, unless otherwise stated.
667 */
669struct Curl_multi; /* declared in multihandle.c */
671enum dupstring {
672 STRING_CERT, /* client certificate filename */
673 STRING_CERT_TYPE, /* format for certificate (default: PEM)*/
674 STRING_KEY, /* private key filename */
675 STRING_KEY_PASSWD, /* plain text private key password */
676 STRING_KEY_TYPE, /* format for private key (default: PEM) */
677 STRING_SSL_CAPATH, /* CA directory name (does not work on Windows) */
678 STRING_SSL_CAFILE, /* certificate file to verify peer against */
679 STRING_SSL_PINNEDPUBLICKEY, /* public key file to verify peer against */
680 STRING_SSL_CIPHER_LIST, /* list of ciphers to use */
681 STRING_SSL_CIPHER13_LIST, /* list of TLS 1.3 ciphers to use */
682 STRING_SSL_CRLFILE, /* CRL file to check certificate */
683 STRING_SSL_ISSUERCERT, /* issuer cert file to check certificate */
684 STRING_SERVICE_NAME, /* Service name */
685#ifndef CURL_DISABLE_PROXY
686 STRING_CERT_PROXY, /* client certificate filename */
687 STRING_CERT_TYPE_PROXY, /* format for certificate (default: PEM)*/
688 STRING_KEY_PROXY, /* private key filename */
689 STRING_KEY_PASSWD_PROXY, /* plain text private key password */
690 STRING_KEY_TYPE_PROXY, /* format for private key (default: PEM) */
691 STRING_SSL_CAPATH_PROXY, /* CA directory name (does not work on Windows) */
692 STRING_SSL_CAFILE_PROXY, /* certificate file to verify peer against */
693 STRING_SSL_PINNEDPUBLICKEY_PROXY, /* public key file to verify proxy */
694 STRING_SSL_CIPHER_LIST_PROXY, /* list of ciphers to use */
695 STRING_SSL_CIPHER13_LIST_PROXY, /* list of TLS 1.3 ciphers to use */
696 STRING_SSL_CRLFILE_PROXY, /* CRL file to check certificate */
697 STRING_SSL_ISSUERCERT_PROXY, /* issuer cert file to check certificate */
698 STRING_PROXY_SERVICE_NAME, /* Proxy service name */
699#endif
700#ifndef CURL_DISABLE_COOKIES
701 STRING_COOKIE, /* HTTP cookie string to send */
702 STRING_COOKIEJAR, /* dump all cookies to this file */
703#endif
704 STRING_CUSTOMREQUEST, /* HTTP/FTP/RTSP request/method to use */
705 STRING_DEFAULT_PROTOCOL, /* Protocol to use when the URL does not specify */
706 STRING_INTERFACE_OPT, /* CURLOPT_INTERFACE config */
707 STRING_ENCODING, /* Accept-Encoding string */
708#ifndef CURL_DISABLE_FTP
709 STRING_FTP_ACCOUNT, /* ftp account data */
710 STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */
711 STRING_FTPPORT, /* port to send with the FTP PORT command */
712#endif
713#ifndef CURL_DISABLE_NETRC
714 STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find
715 $HOME/.netrc */
716#endif
717#ifndef CURL_DISABLE_PROXY
718 STRING_PROXY, /* proxy to use */
719 STRING_PRE_PROXY, /* pre socks proxy to use */
720#endif
721 STRING_SET_RANGE, /* range, if used */
722 STRING_SET_REFERER, /* custom string for the HTTP referer field */
723 STRING_SET_URL, /* what original URL to work on */
724 STRING_USERAGENT, /* User-Agent string */
725 STRING_SSL_ENGINE, /* name of SSL engine */
726 STRING_USERNAME, /* <username>, if used */
727 STRING_PASSWORD, /* <password>, if used */
728 STRING_OPTIONS, /* <options>, if used */
729#ifndef CURL_DISABLE_PROXY
730 STRING_PROXYUSERNAME, /* Proxy <username>, if used */
731 STRING_PROXYPASSWORD, /* Proxy <password>, if used */
732 STRING_NOPROXY, /* List of hosts which should not use the proxy, if
733 used */
734#endif
735#ifndef CURL_DISABLE_RTSP
736 STRING_RTSP_SESSION_ID, /* Session ID to use */
737 STRING_RTSP_STREAM_URI, /* Stream URI for this request */
738 STRING_RTSP_TRANSPORT, /* Transport for this session */
739#endif
740#ifdef USE_SSH
741 STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */
742 STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */
743 STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ASCII hex */
744 STRING_SSH_HOST_PUBLIC_KEY_SHA256, /* sha256 of host public key in base64 */
745 STRING_SSH_KNOWNHOSTS, /* filename of knownhosts file */
746#endif
747#ifndef CURL_DISABLE_SMTP
748 STRING_MAIL_FROM,
749 STRING_MAIL_AUTH,
750#endif
751 STRING_BEARER, /* <bearer>, if used */
752#ifdef USE_UNIX_SOCKETS
753 STRING_UNIX_SOCKET_PATH, /* path to Unix socket, if used */
754#endif
755 STRING_TARGET, /* CURLOPT_REQUEST_TARGET */
756#ifndef CURL_DISABLE_DOH
757 STRING_DOH, /* CURLOPT_DOH_URL */
758#endif
759#ifndef CURL_DISABLE_ALTSVC
760 STRING_ALTSVC, /* CURLOPT_ALTSVC */
761#endif
762#ifndef CURL_DISABLE_HSTS
763 STRING_HSTS, /* CURLOPT_HSTS */
764#endif
765 STRING_SASL_AUTHZID, /* CURLOPT_SASL_AUTHZID */
766#ifdef USE_ARES
767 STRING_DNS_SERVERS,
768 STRING_DNS_INTERFACE,
769 STRING_DNS_LOCAL_IP4,
770 STRING_DNS_LOCAL_IP6,
771#endif
772 STRING_SSL_EC_CURVES,
773#ifndef CURL_DISABLE_AWS
774 STRING_AWS_SIGV4, /* Parameters for V4 signature */
775#endif
776#ifndef CURL_DISABLE_HTTPSIG
777 STRING_HTTPSIG_KEY, /* hex-encoded key data */
778 STRING_HTTPSIG_KEYID, /* key identifier */
779 STRING_HTTPSIG_HEADERS, /* space-separated components to sign */
780#endif
781#ifndef CURL_DISABLE_PROXY
782 STRING_HAPROXY_CLIENT_IP, /* CURLOPT_HAPROXY_CLIENT_IP */
783#endif
784 STRING_ECH_CONFIG, /* CURLOPT_ECH_CONFIG */
785 STRING_ECH_PUBLIC, /* CURLOPT_ECH_PUBLIC */
786 STRING_SSL_SIGNATURE_ALGORITHMS, /* CURLOPT_SSL_SIGNATURE_ALGORITHMS */
788 STRING_LAST /* not used, an end-of-list marker */
789};
791enum dupblob {
792 BLOB_CERT,
793 BLOB_KEY,
794 BLOB_SSL_ISSUERCERT,
795 BLOB_CAINFO,
796#ifndef CURL_DISABLE_PROXY
797 BLOB_CERT_PROXY,
798 BLOB_KEY_PROXY,
799 BLOB_SSL_ISSUERCERT_PROXY,
800 BLOB_CAINFO_PROXY,
801#endif
802 BLOB_LAST
803};
805struct UserDefined {
806 FILE *err; /* the stderr user data goes here */
807 void *debugdata; /* the data that will be passed to fdebug */
808 char *errorbuffer; /* (Static) store failure messages in here */
809 void *out; /* CURLOPT_WRITEDATA */
810 void *in_set; /* CURLOPT_READDATA */
811 void *writeheader; /* write the header to this if non-NULL */
812 uint32_t httpauth; /* kind of HTTP authentication to use (bitmask) */
813 uint32_t proxyauth; /* kind of proxy authentication to use (bitmask) */
814 void *postfields; /* if POST, set the fields' values here */
815 char *str_copypostfields; /* CURLOPT_COPYPOSTFIELDS value */
816 curl_seek_callback seek_func; /* function that seeks the input */
817 curl_off_t postfieldsize; /* if POST, this might have a size to use instead
818 of strlen(), and then the data *may* be binary
819 (contain NUL bytes) */
820 curl_write_callback fwrite_func; /* function that stores the output */
821 curl_write_callback fwrite_header; /* function that stores headers */
822 curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */
823 curl_read_callback fread_func_set; /* function that reads the input */
824 curl_progress_callback fprogress; /* OLD and deprecated progress callback */
825 curl_xferinfo_callback fxferinfo; /* progress callback */
826 curl_debug_callback fdebug; /* function that write informational data */
827 curl_ioctl_callback ioctl_func; /* function for I/O control */
828 curl_sockopt_callback fsockopt; /* function for setting socket options */
829 void *sockopt_client; /* pointer to pass to the socket options callback */
830 curl_opensocket_callback fopensocket; /* function for checking/translating
831 the address and opening the
832 socket */
833 void *opensocket_client;
834 curl_closesocket_callback fclosesocket; /* function for closing the
835 socket */
836 void *closesocket_client;
837 curl_prereq_callback fprereq; /* pre-initial request callback */
838 void *prereq_userp; /* pre-initial request user data */
840 void *seek_client; /* pointer to pass to the seek callback */
841#ifndef CURL_DISABLE_HSTS
842 curl_hstsread_callback hsts_read;
843 void *hsts_read_userp;
844 curl_hstswrite_callback hsts_write;
845 void *hsts_write_userp;
846#endif
847 void *progress_client; /* pointer to pass to the progress callback */
848 void *ioctl_client; /* pointer to pass to the ioctl callback */
849 timediff_t conn_max_idle_ms; /* max idle time to allow a connection that
850 is to be reused */
851 timediff_t conn_max_age_ms; /* max time since creation to allow a
852 connection that is to be reused */
853 curl_off_t filesize; /* size of file to upload, -1 means unknown */
854 curl_off_t low_speed_limit; /* bytes/second */
855 curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */
856 curl_off_t max_recv_speed; /* high speed limit in bytes/second for
857 download */
858 curl_off_t set_resume_from; /* continue [ftp] transfer from here */
859 struct curl_slist *headers; /* linked list of extra headers */
860 struct curl_httppost *httppost; /* linked list of old POST data */
861#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
862 curl_mimepart *mimepostp; /* MIME/POST data. */
863#endif
864#ifndef CURL_DISABLE_TELNET
865 struct curl_slist *telnet_options; /* linked list of telnet options */
866#endif
867 struct curl_slist *resolve; /* list of names to add/remove from
868 DNS cache */
869 struct curl_slist *connect_to; /* list of host:port mappings to override
870 the hostname and port to connect to */
871 time_t timevalue; /* what time to compare with */
872 struct ssl_easy_config ssl; /* user defined SSL stuff */
873 curl_ssl_ctx_callback ssl_fsslctx; /* function to initialize SSL ctx */
874 void *ssl_fsslctxp; /* parameter for callback */
875#ifndef CURL_DISABLE_PROXY
876 struct ssl_easy_config proxy_ssl; /* user defined SSL stuff for proxy */
877 struct curl_slist *proxyheaders; /* linked list of extra CONNECT headers */
878 uint16_t proxyport; /* If non-zero, use this port number by
879 default. If the proxy string features a
880 ":[port]" that one will override this. */
881 uint8_t proxytype; /* what kind of proxy */
882 uint8_t socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */
883#endif
884 timediff_t dns_cache_timeout_ms; /* DNS cache timeout (milliseconds) */
885 uint32_t buffer_size; /* size of receive buffer to use */
886 uint32_t upload_buffer_size; /* size of upload buffer to use, keep it >=
887 CURL_MAX_WRITE_SIZE */
888 void *private_data; /* application-private data */
889#ifndef CURL_DISABLE_HTTP
890 struct curl_slist *http200aliases; /* linked list of aliases for http200 */
891#endif
892 curl_off_t max_filesize; /* Maximum file size to download */
893#ifndef CURL_DISABLE_FTP
894 timediff_t accepttimeout; /* in milliseconds, 0 means no timeout */
895#endif
896#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH)
897 struct curl_slist *quote; /* after connection is established */
898 struct curl_slist *postquote; /* after the transfer */
899 struct curl_slist *prequote; /* before the transfer, after type */
900#endif
901#ifdef USE_LIBSSH2
902 curl_sshhostkeycallback ssh_hostkeyfunc; /* hostkey check callback */
903 void *ssh_hostkeyfunc_userp; /* custom pointer to callback */
904#endif
905#ifdef USE_SSH
906 curl_sshkeycallback ssh_keyfunc; /* key matching callback */
907 void *ssh_keyfunc_userp; /* custom pointer to callback */
908 uint32_t ssh_auth_types; /* allowed SSH auth types */
909 uint32_t new_directory_perms; /* when creating remote dirs */
910#endif
911 struct u8_strset strings;
912 struct curl_blob *blobs[BLOB_LAST];
913 uint32_t new_file_perms; /* when creating remote files */
914#ifdef USE_IPV6
915 uint32_t scope_id; /* Scope id for IPv6 */
916#endif
917 curl_prot_t allowed_protocols;
918 curl_prot_t redir_protocols;
919#ifndef CURL_DISABLE_RTSP
920 void *rtp_out; /* write RTP to this if non-NULL */
921#endif
922#ifndef CURL_DISABLE_FTP
923 curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer
924 starts */
925 curl_chunk_end_callback chunk_end; /* called after part transferring
926 stopped */
927 curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds
928 to pattern (e.g. if WILDCARDMATCH is on) */
929 void *fnmatch_data;
930 void *wildcardptr;
931#endif
933 timediff_t timeout; /* ms, 0 means no timeout */
934 timediff_t connecttimeout; /* ms, 0 means default timeout */
935 timediff_t happy_eyeballs_timeout; /* ms, 0 is a valid value */
936 timediff_t server_response_timeout; /* ms, 0 means no timeout */
937 timediff_t shutdowntimeout; /* ms, 0 means default timeout */
938 curl_resolver_start_callback resolver_start; /* optional callback called
939 before resolver start */
940 void *resolver_start_client; /* pointer to pass to resolver start callback */
941 timediff_t upkeep_interval_ms; /* Time between calls for connection
942 upkeep. */
943 CURLU *uh; /* URL handle for the current parsed URL */
944#ifndef CURL_DISABLE_HTTP
945 void *trailer_data; /* pointer to pass to trailer data callback */
946 curl_trailer_callback trailer_callback; /* trailing data callback */
947#endif
948#ifndef CURL_DISABLE_SMTP
949 struct curl_slist *mail_rcpt; /* linked list of mail recipients */
950#endif
951 int ssl_ca_cache_timeout; /* Certificate store cache timeout (seconds) */
953 int tcp_keepidle; /* seconds in idle before sending keepalive probe */
954 int tcp_keepintvl; /* seconds between TCP keepalive probes */
955 int tcp_keepcnt; /* maximum number of keepalive probes */
957 uint32_t maxconnects; /* Max idle connections in the connection cache */
958#if defined(USE_HTTP2) || defined(USE_HTTP3)
959 /* Priority information for an easy handle in relation to others on the same
960 connection. */
961 int weight;
962#endif
963 short maxredirs; /* maximum no. of http(s) redirects to follow,
964 set to -1 for infinity */
965 uint16_t expect_100_timeout; /* in milliseconds */
966 uint16_t use_port; /* which port to use (when not using default) */
967 uint16_t low_speed_time; /* number of seconds */
968#ifndef CURL_DISABLE_BINDLOCAL
969 uint16_t localport; /* local port number to bind to */
970 uint16_t localportrange; /* number of additional port numbers to test
971 in case the 'localport' one cannot be
972 bind()ed */
973#endif
974#ifndef CURL_DISABLE_TFTP
975 uint16_t tftp_blksize; /* in bytes, 0 means use default */
976#endif
977#ifndef CURL_DISABLE_RTSP
978 uint8_t rtspreq; /* RTSP request type */
979#endif
980#ifndef CURL_DISABLE_NETRC
981 uint8_t use_netrc; /* enum CURL_NETRC_OPTION values */
982#endif
983#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH)
984 /* Despite the name, ftp_create_missing_dirs is for FTP(S) and SFTP
985 1 - create directories that do not exist
986 2 - the same but also allow MKD to fail once
987 */
988 uint8_t ftp_create_missing_dirs;
989#endif
990#ifndef CURL_DISABLE_FTP
991 uint8_t ftp_filemethod; /* how to get to a file: curl_ftpfile */
992 uint8_t ftpsslauth; /* what AUTH XXX to try: curl_ftpauth */
993 uint8_t ftp_ccc; /* FTP CCC options: curl_ftpccc */
994#endif
995 uint8_t httpsig_algorithm; /* CURLHTTPSIG_* algorithm for RFC 9421 */
996 uint8_t use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or IMAP or
997 POP3 or others! (type: curl_usessl)*/
998 uint8_t timecondition; /* kind of time comparison: curl_TimeCond */
999 uint8_t method; /* what kind of HTTP request: Curl_HttpReq */
1000 uint8_t httpwant; /* when non-zero, a specific HTTP version requested
1001 to be used in the library's request(s) */
1002 uint8_t ipver; /* the CURL_IPRESOLVE_* defines in the public header
1003 file 0 - whatever, 1 - v2, 2 - v6 */
1004 uint8_t upload_flags; /* flags set by CURLOPT_UPLOAD_FLAGS */
1005#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
1006 /* GSS-API/SSPI credential delegation, see CURLOPT_GSSAPI_DELEGATION */
1007 uint8_t gssapi_delegation;
1008#endif
1009 uint8_t http_follow_mode; /* follow HTTP redirects */
1010 BIT(connect_only); /* make connection/request, then let application use the
1011 socket */
1012 BIT(connect_only_ws); /* special websocket connect-only level */
1013#ifndef CURL_DISABLE_SMTP
1014 BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
1015 recipients */
1016#endif
1017#ifndef CURL_DISABLE_MIME
1018 BIT(mime_formescape);
1019#endif
1020 BIT(is_fread_set); /* has read callback been set to non-NULL? */
1021#ifndef CURL_DISABLE_TFTP
1022 BIT(tftp_no_options); /* do not send TFTP options requests */
1023#endif
1024 BIT(sep_headers); /* handle host and proxy headers separately */
1025#ifndef CURL_DISABLE_COOKIES
1026 BIT(cookiesession); /* new cookie session? */
1027#endif
1028 BIT(crlf); /* convert crlf on ftp upload(?) */
1029#ifdef USE_SSH
1030 BIT(ssh_compression); /* enable SSH compression */
1031#endif
1033/* Here follows boolean settings that define how to behave during
1034 this session. They are STATIC, set by libcurl users or at least initially
1035 and they do not change during operations. */
1036 BIT(quick_exit); /* set 1L when it is okay to leak things (like
1037 threads), as we are about to exit() anyway and
1038 do not want lengthy cleanups to delay termination,
1039 e.g. after a DNS timeout */
1040 BIT(get_filetime); /* get the time and get of the remote file */
1041#ifndef CURL_DISABLE_PROXY
1042 BIT(tunnel_thru_httpproxy); /* use CONNECT through an HTTP proxy */
1043#endif
1044 BIT(prefer_ascii); /* ASCII rather than binary */
1045 BIT(remote_append); /* append, not overwrite, on upload */
1046#ifdef CURL_LIST_ONLY_PROTOCOL
1047 BIT(list_only); /* list directory */
1048#endif
1049#ifndef CURL_DISABLE_FTP
1050 BIT(ftp_use_port); /* use the FTP PORT command */
1051 BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
1052 BIT(ftp_use_eprt); /* if EPRT is to be attempted or not */
1053 BIT(ftp_use_pret); /* if PRET is to be used before PASV or not */
1054 BIT(ftp_skip_ip); /* skip the IP address the FTP server passes on to
1055 us */
1056 BIT(wildcard_enabled); /* enable wildcard matching */
1057#endif
1058 BIT(http_fail_on_error); /* fail on HTTP error codes >= 400 */
1059 BIT(http_keep_sending_on_error); /* for HTTP status codes >= 300 */
1060 BIT(http_transfer_encoding); /* request compressed HTTP transfer-encoding */
1061 BIT(allow_auth_to_other_hosts);
1062 BIT(include_header); /* include received protocol headers in data output */
1063 BIT(http_set_referer); /* is a custom referer used */
1064 BIT(http_auto_referer); /* set "correct" referer when following
1065 location: */
1066 BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
1067 BIT(verbose); /* output verbosity */
1068 BIT(reuse_forbid); /* forbidden to be reused, close after use */
1069 BIT(reuse_fresh); /* do not reuse an existing connection */
1070 BIT(no_signal); /* do not use any signal/alarm handler */
1071 BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */
1072 BIT(ignorecl); /* ignore content length */
1073 BIT(http_te_skip); /* pass the raw body data to the user, even when
1074 transfer-encoded (chunked, compressed) */
1075 BIT(http_ce_skip); /* pass the raw body data to the user, even when
1076 content-encoded (chunked, compressed) */
1077 BIT(proxy_transfer_mode); /* set transfer mode (;type=<a|i>) when doing
1078 FTP via an HTTP proxy */
1079#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
1080 BIT(socks5_gssapi_nec); /* Flag to support NEC SOCKS5 server */
1081#endif
1082 BIT(socks5_auth_only); /* SOCKS5 must authenticate */
1083 BIT(sasl_ir); /* Enable/disable SASL initial response */
1084 BIT(tcp_keepalive); /* use TCP keepalives */
1085 BIT(tcp_fastopen); /* use TCP Fast Open */
1086 BIT(ssl_enable_alpn);/* TLS ALPN extension? */
1087 BIT(path_as_is); /* allow dotdots? */
1088 BIT(pipewait); /* wait for multiplex status before starting a new
1089 connection */
1090 BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
1091 from user callbacks */
1092 BIT(dns_shuffle_addresses); /* whether to shuffle addresses before use */
1093#ifndef CURL_DISABLE_PROXY
1094 BIT(haproxyprotocol); /* whether to send HAProxy PROXY protocol v1
1095 header */
1096#endif
1097#ifdef USE_UNIX_SOCKETS
1098 BIT(abstract_unix_socket);
1099#endif
1100 BIT(disallow_username_in_url); /* disallow username in URL */
1101#ifndef CURL_DISABLE_DOH
1102 BIT(doh); /* DNS-over-HTTPS enabled */
1103 BIT(doh_verifypeer); /* DoH certificate peer verification */
1104 BIT(doh_verifyhost); /* DoH certificate hostname verification */
1105 BIT(doh_verifystatus); /* DoH certificate status verification */
1106#endif
1107 BIT(http09_allowed); /* allow HTTP/0.9 responses */
1108#ifndef CURL_DISABLE_WEBSOCKETS
1109 BIT(ws_raw_mode);
1110 BIT(ws_no_auto_pong);
1111#endif
1112 BIT(post301); /* keep POSTs as POSTs after a 301 request */
1113 BIT(post302); /* keep POSTs as POSTs after a 302 request */
1114 BIT(post303); /* keep POSTs as POSTs after a 303 request */
1115#ifdef USE_OPENSSL
1116 BIT(engine_default);
1117#endif
1120#ifndef CURL_DISABLE_MIME
1121#define IS_MIME_POST(a) \
1122 ((a)->set.mimepostp && ((a)->set.mimepostp->kind != MIMEKIND_NONE))
1123#else
1124#define IS_MIME_POST(a) FALSE
1125#endif
1127/* callback that gets called when the transfer `data` is done and
1128 * `data->master_mid` is set to an existing easy handle. */
1129typedef void multi_sub_xfer_done_cb(struct Curl_easy *data,
1130 struct Curl_easy *master,
1131 CURLcode result);
1134 * The 'connectdata' struct MUST have all the connection oriented stuff as we
1135 * may have several simultaneous connections and connection structs in memory.
1137 * The 'struct UserDefined' must only contain data that is set once to go for
1138 * many (perhaps) independent connections. Values that are generated or
1139 * calculated internally for the "session handle" must be defined within the
1140 * 'struct UrlState' instead.
1141 */
1143struct Curl_easy {
1144 /* First a simple identifier to more easily detect if a user mixes up this
1145 easy handle with a multi handle. Set this to CURLEASY_MAGIC_NUMBER */
1146 uint32_t magic;
1147 /* once an easy handle is added to a multi, either explicitly by the
1148 * libcurl application or implicitly during `curl_easy_perform()`,
1149 * a unique identifier inside this one multi instance. */
1150 uint32_t mid;
1151 CURLMstate mstate; /* the handle's state */
1152 CURLcode result; /* previous result */
1154 struct connectdata *conn;
1155 struct Curl_multi *multi; /* if non-NULL, points to the multi handle
1156 struct to which this "belongs" when used by
1157 the multi interface */
1158 struct Curl_eapi_stack callstack; /* easy api calls ongoing */
1160 struct Curl_share *share; /* Share, handles global variable mutexing */
1162 struct Curl_multi *multi_easy; /* if non-NULL, points to the multi handle
1163 struct to which this "belongs" when used
1164 by the easy interface */
1165 struct CURLMsg msg; /* A single posted message. */
1167 /* once an easy handle is tied to a connection pool a non-negative number to
1168 distinguish this transfer from other using the same pool. For easier
1169 tracking in log output. This may wrap around after CURL_OFF_T_MAX to 0
1170 again, so it has no uniqueness guarantee for large processings. Note: it
1171 has no uniqueness either IFF more than one connection pool is used by the
1172 libcurl application. */
1173 curl_off_t id;
1174 uint32_t master_mid; /* if set, this transfer belongs to a master */
1175 multi_sub_xfer_done_cb *sub_xfer_done;
1177 /* `meta_hash` is a general key-value store for implementations
1178 * with the lifetime of the easy handle.
1179 * Elements need to be added with their own destructor to be invoked when
1180 * the easy handle is cleaned up (see Curl_hash_add2()).*/
1181 struct Curl_hash meta_hash;
1183#ifdef USE_LIBPSL
1184 struct PslCache *psl; /* The associated PSL cache. */
1185#endif
1186 struct SingleRequest req; /* Request-specific data */
1187 struct UserDefined set; /* values set by the libcurl user */
1188#ifndef CURL_DISABLE_COOKIES
1189 struct CookieInfo *cookies; /* the cookies, read from files and servers.
1190 NOTE that the 'cookie' field in the
1191 UserDefined struct defines if the "engine"
1192 is to be used or not. */
1193#endif
1194#ifndef CURL_DISABLE_HSTS
1195 struct hsts *hsts;
1196#endif
1197#ifndef CURL_DISABLE_ALTSVC
1198 struct altsvcinfo *asi; /* the alt-svc cache */
1199#endif
1200 struct Progress progress; /* for all the progress meter data */
1201 struct UrlState state; /* struct for fields used for state info and
1202 other dynamic purposes */
1203#ifndef CURL_DISABLE_FTP
1204 struct WildcardData *wildcard; /* wildcard download state info */
1205#endif
1206 struct PureInfo info; /* stats, reports and info data */
1207 struct curl_tlssessioninfo tsi; /* Information about the TLS session, only
1208 valid after a client has asked for it */
1211#define CURL_EASY_STR(d, id) \
1212 Curl_u8_strset_get(&(d)->set.strings, (uint8_t)(id))
1213#define CURL_EASY_STR_SET(d, id, s, slen) \
1214 Curl_u8_strset_setx(&(d)->set.strings, (uint8_t)(id), s, slen)
1215#define CURL_EASY_STR_SETN(d, id, s) \
1216 Curl_u8_strset_setn(&(d)->set.strings, (uint8_t)(id), s)
1217#define CURL_EASY_STR_CLEAR(d, id) \
1218 Curl_u8_strset_unset(&(d)->set.strings, (uint8_t)(id))
1219#define CURL_EASY_STR_CLEAR0(d, id) \
1220 Curl_u8_strset_unset0(&(d)->set.strings, (uint8_t)(id))
1222#define LIBCURL_NAME "libcurl"
1224#endif /* HEADER_CURL_URLDATA_H */
Diagnostics4 git calls · 39 ms
CallStatusSizeTime039 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=33
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch20018 KiB · hit35 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=18111
git.response.cache=HIT
git.response.duration_ms=35
git.fetch.wants=e8571130369a7ff7612e17d9d7819e068c6403af
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=18111
git.pkt.payload.max=18090
git.sideband.band1.bytes=18089
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e2ef6f0800fda9
Request
d410c27b…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format