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