urldata.h 80 KB

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