urldata.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. #ifndef __URLDATA_H
  2. #define __URLDATA_H
  3. /*****************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2001, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * In order to be useful for every potential user, curl and libcurl are
  13. * dual-licensed under the MPL and the MIT/X-derivate licenses.
  14. *
  15. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. * copies of the Software, and permit persons to whom the Software is
  17. * furnished to do so, under the terms of the MPL or the MIT/X-derivate
  18. * licenses. You may pick one of these licenses.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id$
  24. *****************************************************************************/
  25. /* This file is for lib internal stuff */
  26. #include "setup.h"
  27. #include "hostip.h"
  28. #include "hash.h"
  29. #define PORT_FTP 21
  30. #define PORT_TELNET 23
  31. #define PORT_GOPHER 70
  32. #define PORT_HTTP 80
  33. #define PORT_HTTPS 443
  34. #define PORT_DICT 2628
  35. #define PORT_LDAP 389
  36. #define DICT_MATCH "/MATCH:"
  37. #define DICT_MATCH2 "/M:"
  38. #define DICT_MATCH3 "/FIND:"
  39. #define DICT_DEFINE "/DEFINE:"
  40. #define DICT_DEFINE2 "/D:"
  41. #define DICT_DEFINE3 "/LOOKUP:"
  42. #define CURL_DEFAULT_USER "anonymous"
  43. #define CURL_DEFAULT_PASSWORD "[email protected]"
  44. #include "cookie.h"
  45. #include "formdata.h"
  46. #ifdef USE_SSLEAY
  47. /* SSLeay stuff usually in /usr/local/ssl/include */
  48. #ifdef USE_OPENSSL
  49. #include "openssl/rsa.h"
  50. #include "openssl/crypto.h"
  51. #include "openssl/x509.h"
  52. #include "openssl/pem.h"
  53. #include "openssl/ssl.h"
  54. #include "openssl/err.h"
  55. #ifdef HAVE_OPENSSL_ENGINE_H
  56. #include <openssl/engine.h>
  57. #endif
  58. #else
  59. #include "rsa.h"
  60. #include "crypto.h"
  61. #include "x509.h"
  62. #include "pem.h"
  63. #include "ssl.h"
  64. #include "err.h"
  65. #endif
  66. #endif
  67. #ifdef HAVE_NETINET_IN_H
  68. #include <netinet/in.h>
  69. #endif
  70. #include "timeval.h"
  71. #include <curl/curl.h>
  72. #include "http_chunks.h" /* for the structs and enum stuff */
  73. /* Download buffer size, keep it fairly big for speed reasons */
  74. #define BUFSIZE (1024*20)
  75. /* Initial size of the buffer to store headers in, it'll be enlarged in case
  76. of need. */
  77. #define HEADERSIZE 256
  78. /* Just a convenience macro to get the larger value out of two given */
  79. #ifndef MAX
  80. #define MAX(x,y) ((x)>(y)?(x):(y))
  81. #endif
  82. #ifdef KRB4
  83. /* Types needed for krb4-ftp connections */
  84. struct krb4buffer {
  85. void *data;
  86. size_t size;
  87. size_t index;
  88. int eof_flag;
  89. };
  90. enum protection_level {
  91. prot_clear,
  92. prot_safe,
  93. prot_confidential,
  94. prot_private
  95. };
  96. #endif
  97. #ifndef HAVE_OPENSSL_ENGINE_H
  98. typedef void ENGINE;
  99. #endif
  100. /* struct for data related to SSL and SSL connections */
  101. struct ssl_connect_data {
  102. bool use; /* use ssl encrypted communications TRUE/FALSE */
  103. #ifdef USE_SSLEAY
  104. /* these ones requires specific SSL-types */
  105. SSL_CTX* ctx;
  106. SSL* handle;
  107. X509* server_cert;
  108. #endif /* USE_SSLEAY */
  109. };
  110. /* information about one single SSL session */
  111. struct curl_ssl_session {
  112. char *name; /* host name for which this ID was used */
  113. void *sessionid; /* as returned from the SSL layer */
  114. long age; /* just a number, the higher the more recent */
  115. unsigned short remote_port; /* remote port to connect to */
  116. };
  117. struct ssl_config_data {
  118. long version; /* what version the client wants to use */
  119. long certverifyresult; /* result from the certificate verification */
  120. long verifypeer; /* set TRUE if this is desired */
  121. long verifyhost; /* 0: no verif, 1: check that CN exists, 2: CN must match hostname */
  122. char *CApath; /* DOES NOT WORK ON WINDOWS */
  123. char *CAfile; /* cerficate to verify peer against */
  124. char *random_file; /* path to file containing "random" data */
  125. char *egdsocket; /* path to file containing the EGD daemon socket */
  126. char *cipher_list; /* list of ciphers to use */
  127. long numsessions; /* SSL session id cache size */
  128. };
  129. /****************************************************************************
  130. * HTTP unique setup
  131. ***************************************************************************/
  132. struct HTTP {
  133. struct FormData *sendit;
  134. int postsize;
  135. const char *p_pragma; /* Pragma: string */
  136. const char *p_accept; /* Accept: string */
  137. long readbytecount;
  138. long writebytecount;
  139. /* For FORM posting */
  140. struct Form form;
  141. curl_read_callback storefread;
  142. FILE *in;
  143. struct Curl_chunker chunk;
  144. };
  145. /****************************************************************************
  146. * FTP unique setup
  147. ***************************************************************************/
  148. struct FTP {
  149. long *bytecountp;
  150. char *user; /* user name string */
  151. char *passwd; /* password string */
  152. char *urlpath; /* the originally given path part of the URL */
  153. char *dir; /* decoded directory */
  154. char *file; /* decoded file */
  155. char *entrypath; /* the PWD reply when we logged on */
  156. char *cache; /* data cache between getresponse()-calls */
  157. size_t cache_size; /* size of cache in bytes */
  158. };
  159. /****************************************************************************
  160. * FILE unique setup
  161. ***************************************************************************/
  162. struct FILE {
  163. int fd; /* open file descriptor to read from! */
  164. };
  165. /*
  166. * Boolean values that concerns this connection.
  167. */
  168. struct ConnectBits {
  169. bool close; /* if set, we close the connection after this request */
  170. bool reuse; /* if set, this is a re-used connection */
  171. bool chunk; /* if set, this is a chunked transfer-encoding */
  172. bool httpproxy; /* if set, this transfer is done through a http proxy */
  173. bool user_passwd; /* do we use user+password for this connection? */
  174. bool proxy_user_passwd; /* user+password for the proxy? */
  175. bool use_range;
  176. bool rangestringalloc; /* the range string is malloc()'ed */
  177. bool resume_done; /* nothing was transfered, resumed transfer already
  178. complete */
  179. };
  180. /*
  181. * This struct is all the previously local variables from Curl_perform() moved
  182. * to struct to allow the function to return and get re-invoked better without
  183. * losing state.
  184. */
  185. struct Curl_transfer_keeper {
  186. int bytecount; /* total number of bytes read */
  187. int writebytecount; /* number of bytes written */
  188. long contentlength; /* size of incoming data */
  189. struct timeval start; /* transfer started at this time */
  190. struct timeval now; /* current time */
  191. bool header; /* incoming data has HTTP header */
  192. int headerline; /* counts header lines to better track the
  193. first one */
  194. char *hbufp; /* points at *end* of header line */
  195. int hbuflen;
  196. char *str; /* within buf */
  197. char *str_start; /* within buf */
  198. char *end_ptr; /* within buf */
  199. char *p; /* within headerbuff */
  200. bool content_range; /* set TRUE if Content-Range: was found */
  201. int offset; /* possible resume offset read from the
  202. Content-Range: header */
  203. int httpcode; /* error code from the 'HTTP/1.? XXX' line */
  204. int httpversion; /* the HTTP version*10 */
  205. bool write_after_100_header; /* should we enable the write after
  206. we received a 100-continue/timeout
  207. or directly */
  208. /* for the low speed checks: */
  209. time_t timeofdoc;
  210. long bodywrites;
  211. int writetype;
  212. /* the highest fd we use + 1 */
  213. struct SessionHandle *data;
  214. struct connectdata *conn;
  215. char *buf;
  216. char *uploadbuf;
  217. int maxfd;
  218. /* the file descriptors to play with */
  219. fd_set readfd;
  220. fd_set writefd;
  221. fd_set rkeepfd;
  222. fd_set wkeepfd;
  223. int keepon;
  224. };
  225. /*
  226. * The connectdata struct contains all fields and variables that should be
  227. * unique for an entire connection.
  228. */
  229. struct connectdata {
  230. /**** Fields set when inited and not modified again */
  231. struct SessionHandle *data; /* link to the root CURL struct */
  232. int connectindex; /* what index in the connects index this particular
  233. struct has */
  234. long protocol; /* PROT_* flags concerning the protocol set */
  235. #define PROT_MISSING (1<<0)
  236. #define PROT_GOPHER (1<<1)
  237. #define PROT_HTTP (1<<2)
  238. #define PROT_HTTPS (1<<3)
  239. #define PROT_FTP (1<<4)
  240. #define PROT_TELNET (1<<5)
  241. #define PROT_DICT (1<<6)
  242. #define PROT_LDAP (1<<7)
  243. #define PROT_FILE (1<<8)
  244. #define PROT_FTPS (1<<9)
  245. #define PROT_SSL (1<<10) /* protocol requires SSL */
  246. Curl_addrinfo *hostaddr; /* IP-protocol independent host info pointer list */
  247. char *hostent_buf; /* pointer to allocated memory for name info */
  248. #ifdef ENABLE_IPV6
  249. struct addrinfo *serv_addr; /* the particular host we use */
  250. #else
  251. struct sockaddr_in serv_addr;
  252. #endif
  253. char protostr[64]; /* store the protocol string in this buffer */
  254. char gname[513]; /* store the hostname in this buffer */
  255. char *name; /* host name pointer to fool around with */
  256. char *path; /* allocated buffer to store the URL's path part in */
  257. char *hostname; /* hostname to connect, as parsed from url */
  258. long port; /* which port to use locally */
  259. unsigned short remote_port; /* what remote port to connect to,
  260. not the proxy port! */
  261. char *ppath;
  262. long bytecount;
  263. long headerbytecount; /* only count received headers */
  264. char *range; /* range, if used. See README for detailed specification on
  265. this syntax. */
  266. ssize_t resume_from; /* continue [ftp] transfer from here */
  267. char *proxyhost; /* name of the http proxy host */
  268. struct timeval now; /* "current" time */
  269. struct timeval created; /* creation time */
  270. int firstsocket; /* the main socket to use */
  271. int secondarysocket; /* for i.e ftp transfers */
  272. long maxdownload; /* in bytes, the maximum amount of data to fetch, 0
  273. means unlimited */
  274. struct ssl_connect_data ssl; /* this is for ssl-stuff */
  275. struct ConnectBits bits; /* various state-flags for this connection */
  276. /* These two functions MUST be set by the curl_connect() function to be
  277. be protocol dependent */
  278. CURLcode (*curl_do)(struct connectdata *connect);
  279. CURLcode (*curl_done)(struct connectdata *connect);
  280. /* This function *MAY* be set to a protocol-dependent function that is run
  281. * after the connect() and everything is done, as a step in the connection.
  282. */
  283. CURLcode (*curl_connect)(struct connectdata *connect);
  284. /* This function *MAY* be set to a protocol-dependent function that is run
  285. * by the curl_disconnect(), as a step in the disconnection.
  286. */
  287. CURLcode (*curl_disconnect)(struct connectdata *connect);
  288. /* This function *MAY* be set to a protocol-dependent function that is run
  289. * in the curl_close() function if protocol-specific cleanups are required.
  290. */
  291. CURLcode (*curl_close)(struct connectdata *connect);
  292. /**** curl_get() phase fields */
  293. /* READ stuff */
  294. int sockfd; /* socket to read from or -1 */
  295. int size; /* -1 if unknown at this point */
  296. bool getheader; /* TRUE if header parsing is wanted */
  297. long *bytecountp; /* return number of bytes read or NULL */
  298. /* WRITE stuff */
  299. int writesockfd; /* socket to write to, it may very well be
  300. the same we read from. -1 disables */
  301. long *writebytecountp; /* return number of bytes written or NULL */
  302. /** Dynamicly allocated strings, may need to be freed before this **/
  303. /** struct is killed. **/
  304. struct dynamically_allocated_data {
  305. char *proxyuserpwd; /* free later if not NULL! */
  306. char *uagent; /* free later if not NULL! */
  307. char *userpwd; /* free later if not NULL! */
  308. char *rangeline; /* free later if not NULL! */
  309. char *ref; /* free later if not NULL! */
  310. char *cookie; /* free later if not NULL! */
  311. char *host; /* free later if not NULL */
  312. } allocptr;
  313. char *newurl; /* This can only be set if a Location: was in the
  314. document headers */
  315. #ifdef KRB4
  316. enum protection_level command_prot;
  317. enum protection_level data_prot;
  318. enum protection_level request_data_prot;
  319. size_t buffer_size;
  320. struct krb4buffer in_buffer, out_buffer;
  321. int sec_complete;
  322. void *app_data;
  323. struct Curl_sec_client_mech *mech;
  324. struct sockaddr_in local_addr;
  325. #endif
  326. /*************** Request - specific items ************/
  327. /* previously this was in the urldata struct */
  328. union {
  329. struct HTTP *http;
  330. struct HTTP *gopher; /* alias, just for the sake of being more readable */
  331. struct HTTP *https; /* alias, just for the sake of being more readable */
  332. struct FTP *ftp;
  333. struct FILE *file;
  334. void *telnet; /* private for telnet.c-eyes only */
  335. #if 0 /* no need for special ones for these: */
  336. struct LDAP *ldap;
  337. struct DICT *dict;
  338. #endif
  339. void *generic;
  340. } proto;
  341. /* This struct is inited when needed */
  342. struct Curl_transfer_keeper keep;
  343. /* 'upload_present' is used to keep a byte counter of how much data there is
  344. still left in the buffer, aimed for upload. */
  345. int upload_present;
  346. /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a
  347. buffer, so the next read should read from where this pointer points to,
  348. and the 'upload_present' contains the number of bytes available at this
  349. position */
  350. char *upload_fromhere;
  351. };
  352. /*
  353. * Struct to keep statistical and informational data.
  354. */
  355. struct PureInfo {
  356. int httpcode;
  357. int httpversion;
  358. long filetime; /* If requested, this is might get set. Set to -1 if
  359. the time was unretrievable */
  360. long header_size; /* size of read header(s) in bytes */
  361. long request_size; /* the amount of bytes sent in the request(s) */
  362. char *contenttype; /* the content type of the object */
  363. };
  364. struct Progress {
  365. long lastshow; /* time() of the last displayed progress meter or NULL to
  366. force redraw at next call */
  367. double size_dl;
  368. double size_ul;
  369. double downloaded;
  370. double uploaded;
  371. double current_speed; /* uses the currently fastest transfer */
  372. bool callback; /* set when progress callback is used */
  373. int width; /* screen width at download start */
  374. int flags; /* see progress.h */
  375. double timespent;
  376. double dlspeed;
  377. double ulspeed;
  378. double t_nslookup;
  379. double t_connect;
  380. double t_pretransfer;
  381. double t_starttransfer;
  382. struct timeval start;
  383. struct timeval t_startsingle;
  384. #define CURR_TIME (5+1) /* 6 entries for 5 seconds */
  385. double speeder[ CURR_TIME ];
  386. struct timeval speeder_time[ CURR_TIME ];
  387. int speeder_c;
  388. };
  389. typedef enum {
  390. HTTPREQ_NONE, /* first in list */
  391. HTTPREQ_GET,
  392. HTTPREQ_POST,
  393. HTTPREQ_POST_FORM, /* we make a difference internally */
  394. HTTPREQ_PUT,
  395. HTTPREQ_CUSTOM,
  396. HTTPREQ_LAST /* last in list */
  397. } Curl_HttpReq;
  398. /*
  399. * Values that are generated, temporary or calculated internally for a
  400. * "session handle" must be defined within the 'struct urlstate'. This struct
  401. * will be used within the SessionHandle struct. When the 'SessionHandle'
  402. * struct is cloned, this data MUST NOT be copied.
  403. *
  404. * Remember that any "state" information goes globally for the curl handle.
  405. * Session-data MUST be put in the connectdata struct and here. */
  406. #define MAX_CURL_USER_LENGTH 256
  407. #define MAX_CURL_PASSWORD_LENGTH 256
  408. struct UrlState {
  409. /* buffers to store authentication data in, as parsed from input options */
  410. char user[MAX_CURL_USER_LENGTH];
  411. char passwd[MAX_CURL_PASSWORD_LENGTH];
  412. char proxyuser[MAX_CURL_USER_LENGTH];
  413. char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
  414. struct timeval keeps_speed; /* for the progress meter really */
  415. /* 'connects' will be an allocated array with pointers. If the pointer is
  416. set, it holds an allocated connection. */
  417. struct connectdata **connects;
  418. long numconnects; /* size of the 'connects' array */
  419. char *headerbuff; /* allocated buffer to store headers in */
  420. int headersize; /* size of the allocation */
  421. char buffer[BUFSIZE+1]; /* download buffer */
  422. char uploadbuffer[BUFSIZE+1]; /* upload buffer */
  423. double current_speed; /* the ProgressShow() funcion sets this */
  424. bool this_is_a_follow; /* this is a followed Location: request */
  425. char *auth_host; /* if set, this should be the host name that we will
  426. sent authorization to, no else. Used to make Location:
  427. following not keep sending user+password... This is
  428. strdup() data.
  429. */
  430. struct curl_ssl_session *session; /* array of 'numsessions' size */
  431. long sessionage; /* number of the most recent session */
  432. char scratch[BUFSIZE*2]; /* huge buffer when doing upload CRLF replacing */
  433. bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
  434. This must be set to FALSE every time _easy_perform() is
  435. called. */
  436. #ifdef HAVE_SIGNAL
  437. /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
  438. void (*prev_signal)(int sig);
  439. #endif
  440. bool allow_port; /* Is set.use_port allowed to take effect or not. This
  441. is always set TRUE when curl_easy_perform() is called. */
  442. };
  443. /*
  444. * This 'DynamicStatic' struct defines dynamic states that actually change
  445. * values in the 'UserDefined' area, which MUST be taken into consideration
  446. * if the UserDefined struct is cloned or similar. You can probably just
  447. * copy these, but each one indicate a special action on other data.
  448. */
  449. struct DynamicStatic {
  450. char *url; /* work URL, copied from UserDefined */
  451. bool url_alloc; /* URL string is malloc()'ed */
  452. char *proxy; /* work proxy, copied from UserDefined */
  453. bool proxy_alloc; /* http proxy string is malloc()'ed */
  454. char *referer; /* referer string */
  455. bool referer_alloc; /* referer sting is malloc()ed */
  456. };
  457. /*
  458. * This 'UserDefined' struct must only contain data that is set once to go
  459. * for many (perhaps) independent connections. Values that are generated or
  460. * calculated internally for the "session handle" MUST be defined within the
  461. * 'struct urlstate' instead. The only exceptions MUST note the changes in
  462. * the 'DynamicStatic' struct.
  463. */
  464. struct UserDefined {
  465. FILE *err; /* the stderr writes goes here */
  466. char *errorbuffer; /* store failure messages in here */
  467. char *proxyuserpwd; /* Proxy <user:password>, if used */
  468. long proxyport; /* If non-zero, use this port number by default. If the
  469. proxy string features a ":[port]" that one will override
  470. this. */
  471. void *out; /* the fetched file goes here */
  472. void *in; /* the uploaded file is read from here */
  473. void *writeheader; /* write the header to this is non-NULL */
  474. char *set_url; /* what original URL to work on */
  475. char *set_proxy; /* proxy to use */
  476. long use_port; /* which port to use (when not using default) */
  477. char *userpwd; /* <user:password>, if used */
  478. char *set_range; /* range, if used. See README for detailed specification
  479. on this syntax. */
  480. long followlocation; /* as in HTTP Location: */
  481. long maxredirs; /* maximum no. of http(s) redirects to follow */
  482. char *set_referer; /* custom string */
  483. bool free_referer; /* set TRUE if 'referer' points to a string we
  484. allocated */
  485. char *useragent; /* User-Agent string */
  486. char *postfields; /* if POST, set the fields' values here */
  487. size_t postfieldsize; /* if POST, this might have a size to use instead of
  488. strlen(), and then the data *may* be binary (contain
  489. zero bytes) */
  490. char *ftpport; /* port to send with the FTP PORT command */
  491. char *device; /* network interface to use */
  492. curl_write_callback fwrite; /* function that stores the output */
  493. curl_write_callback fwrite_header; /* function that stores headers */
  494. curl_read_callback fread; /* function that reads the input */
  495. curl_progress_callback fprogress; /* function for progress information */
  496. void *progress_client; /* pointer to pass to the progress callback */
  497. curl_passwd_callback fpasswd; /* call for password */
  498. void *passwd_client; /* pass to the passwd callback */
  499. long timeout; /* in seconds, 0 means no timeout */
  500. long connecttimeout; /* in seconds, 0 means no timeout */
  501. long infilesize; /* size of file to upload, -1 means unknown */
  502. long low_speed_limit; /* bytes/second */
  503. long low_speed_time; /* number of seconds */
  504. int set_resume_from; /* continue [ftp] transfer from here */
  505. char *cookie; /* HTTP cookie string to send */
  506. struct curl_slist *headers; /* linked list of extra headers */
  507. struct HttpPost *httppost; /* linked list of POST data */
  508. char *cert; /* certificate */
  509. char *cert_type; /* format for certificate (default: PEM) */
  510. char *key; /* private key */
  511. char *key_type; /* format for private key (default: PEM) */
  512. char *key_passwd; /* plain text private key password */
  513. char *crypto_engine; /* name of the crypto engine to use */
  514. char *cookiejar; /* dump all cookies to this file */
  515. bool crlf; /* convert crlf on ftp upload(?) */
  516. struct curl_slist *quote; /* after connection is established */
  517. struct curl_slist *postquote; /* after the transfer */
  518. struct curl_slist *prequote; /* before the transfer, after type (Wesley Laxton)*/
  519. struct curl_slist *telnet_options; /* linked list of telnet options */
  520. curl_TimeCond timecondition; /* kind of time/date comparison */
  521. time_t timevalue; /* what time to compare with */
  522. curl_closepolicy closepolicy; /* connection cache close concept */
  523. Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
  524. char *customrequest; /* HTTP/FTP request to use */
  525. long httpversion; /* when non-zero, a specific HTTP version requested to
  526. be used in the library's request(s) */
  527. char *auth_host; /* if set, this is the allocated string to the host name
  528. * to which to send the authorization data to, and no other
  529. * host (which location-following otherwise could lead to)
  530. */
  531. char *krb4_level; /* what security level */
  532. struct ssl_config_data ssl; /* user defined SSL stuff */
  533. int dns_cache_timeout; /* DNS cache timeout */
  534. /* Here follows boolean settings that define how to behave during
  535. this session. They are STATIC, set by libcurl users or at least initially
  536. and they don't change during operations. */
  537. bool get_filetime;
  538. bool tunnel_thru_httpproxy;
  539. bool ftp_append;
  540. bool ftp_ascii;
  541. bool ftp_list_only;
  542. bool ftp_use_port;
  543. bool hide_progress;
  544. bool http_fail_on_error;
  545. bool http_follow_location;
  546. bool include_header;
  547. #define http_include_header include_header /* former name */
  548. bool http_set_referer;
  549. bool http_auto_referer; /* set "correct" referer when following location: */
  550. bool no_body;
  551. bool set_port;
  552. bool upload;
  553. bool use_netrc;
  554. bool verbose;
  555. bool krb4; /* kerberos4 connection requested */
  556. bool reuse_forbid; /* forbidden to be reused, close after use */
  557. bool reuse_fresh; /* do not re-use an existing connection */
  558. bool expect100header; /* TRUE if we added Expect: 100-continue */
  559. bool ftp_use_epsv; /* if EPSV is to be attempted or not */
  560. bool global_dns_cache;
  561. };
  562. /*
  563. * In August 2001, this struct was redesigned and is since stricter than
  564. * before. The 'connectdata' struct MUST have all the connection oriented
  565. * stuff as we may now have several simultaneous connections and connection
  566. * structs in memory.
  567. *
  568. * From now on, the 'SessionHandle' must only contain data that is set once to
  569. * go for many (perhaps) independent connections. Values that are generated or
  570. * calculated internally for the "session handle" must be defined within the
  571. * 'struct urlstate' instead. */
  572. struct SessionHandle {
  573. curl_hash *hostcache;
  574. struct UserDefined set; /* values set by the libcurl user */
  575. struct DynamicStatic change; /* possibly modified userdefined data */
  576. struct CookieInfo *cookies; /* the cookies, read from files and servers */
  577. struct Progress progress; /* for all the progress meter data */
  578. struct UrlState state; /* struct for fields used for state info and
  579. other dynamic purposes */
  580. struct PureInfo info; /* stats, reports and info data */
  581. #ifdef USE_SSLEAY
  582. ENGINE* engine;
  583. #endif /* USE_SSLEAY */
  584. };
  585. #define LIBCURL_NAME "libcurl"
  586. #endif