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