doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
urldata.h
Go to the documentation of this file.
1 #ifndef __URLDATA_H
2 #define __URLDATA_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2004, 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: urldata.h,v 1.204 2004/03/12 13:06:01 bagder Exp $
24  ***************************************************************************/
25 
26 /* This file is for lib internal stuff */
27 
28 #include "setup.h"
29 
30 #define PORT_FTP 21
31 #define PORT_FTPS 990
32 #define PORT_TELNET 23
33 #define PORT_GOPHER 70
34 #define PORT_HTTP 80
35 #define PORT_HTTPS 443
36 #define PORT_DICT 2628
37 #define PORT_LDAP 389
38 
39 #define DICT_MATCH "/MATCH:"
40 #define DICT_MATCH2 "/M:"
41 #define DICT_MATCH3 "/FIND:"
42 #define DICT_DEFINE "/DEFINE:"
43 #define DICT_DEFINE2 "/D:"
44 #define DICT_DEFINE3 "/LOOKUP:"
45 
46 #define CURL_DEFAULT_USER "anonymous"
47 #define CURL_DEFAULT_PASSWORD "curl_by_daniel@haxx.se"
48 
49 #include "cookie.h"
50 #include "formdata.h"
51 
52 #ifdef USE_SSLEAY
53 /* SSLeay stuff usually in /usr/local/ssl/include */
54 #ifdef USE_OPENSSL
55 #include "openssl/rsa.h"
56 #include "openssl/crypto.h"
57 #include "openssl/x509.h"
58 #include "openssl/pem.h"
59 #include "openssl/ssl.h"
60 #include "openssl/err.h"
61 #ifdef HAVE_OPENSSL_ENGINE_H
62 #include <openssl/engine.h>
63 #endif
64 #else
65 #include "rsa.h"
66 #include "crypto.h"
67 #include "x509.h"
68 #include "pem.h"
69 #include "ssl.h"
70 #include "err.h"
71 #endif
72 #endif
73 
74 #ifdef HAVE_NETINET_IN_H
75 #include <netinet/in.h>
76 #endif
77 
78 #include "timeval.h"
79 
80 #ifdef HAVE_ZLIB_H
81 #include <zlib.h> /* for content-encoding */
82 #endif
83 
84 #include <curl/curl.h>
85 
86 #include "http_chunks.h" /* for the structs and enum stuff */
87 #include "hostip.h"
88 #include "hash.h"
89 
90 #ifdef HAVE_GSSAPI
91 #ifdef HAVE_GSSMIT
92 #include <gssapi/gssapi.h>
93 #include <gssapi/gssapi_generic.h>
94 #else
95 #include <gssapi.h>
96 #endif
97 #endif
98 
99 #ifdef USE_ARES
100 #include <ares.h>
101 #endif
102 
103 /* Download buffer size, keep it fairly big for speed reasons */
104 #define BUFSIZE CURL_MAX_WRITE_SIZE
105 
106 /* Initial size of the buffer to store headers in, it'll be enlarged in case
107  of need. */
108 #define HEADERSIZE 256
109 
110 /* Maximum number of dirs supported by libcurl in a FTP dir hierarchy */
111 #define CURL_MAX_FTP_DIRDEPTH 100
112 
113 /* Just a convenience macro to get the larger value out of two given.
114  We prefix with CURL to prevent name collisions. */
115 #define CURLMAX(x,y) ((x)>(y)?(x):(y))
116 
117 #ifdef HAVE_KRB4
118 /* Types needed for krb4-ftp connections */
119 struct krb4buffer {
120  void *data;
121  size_t size;
122  size_t index;
123  int eof_flag;
124 };
125 enum protection_level {
126  prot_clear,
127  prot_safe,
128  prot_confidential,
129  prot_private
130 };
131 #endif
132 
133 /* struct for data related to each SSL connection */
135  bool use; /* use ssl encrypted communications TRUE/FALSE */
136 #ifdef USE_SSLEAY
137  /* these ones requires specific SSL-types */
138  SSL_CTX* ctx;
139  SSL* handle;
140  X509* server_cert;
141 #endif /* USE_SSLEAY */
142 };
143 
145  long version; /* what version the client wants to use */
146  long certverifyresult; /* result from the certificate verification */
147  long verifypeer; /* set TRUE if this is desired */
148  long verifyhost; /* 0: no verify
149  1: check that CN exists
150  2: CN must match hostname */
151  char *CApath; /* DOES NOT WORK ON WINDOWS */
152  char *CAfile; /* cerficate to verify peer against */
153  char *random_file; /* path to file containing "random" data */
154  char *egdsocket; /* path to file containing the EGD daemon socket */
155  char *cipher_list; /* list of ciphers to use */
156  long numsessions; /* SSL session id cache size */
157  curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
158  void *fsslctxp; /*parameter for call back */
159 };
160 
161 /* information stored about one single SSL session */
163  char *name; /* host name for which this ID was used */
164  void *sessionid; /* as returned from the SSL layer */
165  long age; /* just a number, the higher the more recent */
166  unsigned short remote_port; /* remote port to connect to */
167  struct ssl_config_data ssl_config; /* setup for this session */
168 };
169 
170 /* Struct used for Digest challenge-response authentication */
171 struct digestdata {
172  char *nonce;
173  char *cnonce;
174  char *realm;
175  int algo;
176 };
177 
178 typedef enum {
184 } curlntlm;
185 
186 /* Struct used for NTLM challenge-response authentication */
187 struct ntlmdata {
189  unsigned char nonce[8];
190 };
191 
192 #ifdef HAVE_GSSAPI
193 struct negotiatedata {
194  bool gss; /* Whether we're processing GSS-Negotiate or Negotiate */
195  const char* protocol; /* "GSS-Negotiate" or "Negotiate" */
196  OM_uint32 status;
197  gss_ctx_id_t context;
198  gss_name_t server_name;
199  gss_buffer_desc output_token;
200 };
201 #endif
202 
203 /****************************************************************************
204  * HTTP unique setup
205  ***************************************************************************/
206 struct HTTP {
207  struct FormData *sendit;
208  curl_off_t postsize; /* off_t to handle large file sizes */
209  char *postdata;
210 
211  const char *p_pragma; /* Pragma: string */
212  const char *p_accept; /* Accept: string */
215 
216  /* For FORM posting */
217  struct Form form;
219 
220  struct back {
221  curl_read_callback fread; /* backup storage for fread pointer */
222  void *fread_in; /* backup storage for fread_in pointer */
223  char *postdata;
225  } backup;
226 
227  enum {
228  HTTPSEND_NADA, /* init */
229  HTTPSEND_REQUEST, /* sending a request */
230  HTTPSEND_BODY, /* sending body */
231  HTTPSEND_LAST /* never use this */
232  } sending;
233 
234  void *send_buffer; /* used if the request couldn't be sent in one chunk,
235  points to an allocated send_buffer struct */
236 };
237 
238 /****************************************************************************
239  * FTP unique setup
240  ***************************************************************************/
241 struct FTP {
243  char *user; /* user name string */
244  char *passwd; /* password string */
245  char *urlpath; /* the originally given path part of the URL */
246  char *dirs[CURL_MAX_FTP_DIRDEPTH]; /* path components */
247  char *file; /* decoded file */
248 
249  char *entrypath; /* the PWD reply when we logged on */
250 
251  char *cache; /* data cache between getresponse()-calls */
252  curl_off_t cache_size; /* size of cache in bytes */
253  bool dont_check; /* Set to TRUE to prevent the final (post-transfer)
254  file size and 226/250 status check. It should still
255  read the line, just ignore the result. */
256  bool no_transfer; /* nothing was transfered, (possibly because a resumed
257  transfer already was complete) */
258  long response_time; /* When no timeout is given, this is the amount of
259  seconds we await for an FTP response. Initialized
260  in Curl_ftp_connect() */
261  bool ctl_valid; /* Tells Curl_ftp_quit() whether or not to do
262  anything. If the connection has timed out or
263  been closed, this should be FALSE when it gets
264  to Curl_ftp_quit() */
265 };
266 
267 /****************************************************************************
268  * FILE unique setup
269  ***************************************************************************/
270 struct FILEPROTO {
271  int fd; /* open file descriptor to read from! */
272 };
273 
274 /*
275  * Boolean values that concerns this connection.
276  */
277 struct ConnectBits {
278  bool close; /* if set, we close the connection after this request */
279  bool reuse; /* if set, this is a re-used connection */
280  bool chunk; /* if set, this is a chunked transfer-encoding */
281  bool httpproxy; /* if set, this transfer is done through a http proxy */
282  bool user_passwd; /* do we use user+password for this connection? */
283  bool proxy_user_passwd; /* user+password for the proxy? */
284  bool ipv6_ip; /* we communicate with a remove site specified with pure IPv6
285  IP address */
286  bool use_range;
287  bool rangestringalloc; /* the range string is malloc()'ed */
288 
289  bool do_more; /* this is set TRUE if the ->curl_do_more() function is
290  supposed to be called, after ->curl_do() */
291 
292  bool upload_chunky; /* set TRUE if we are doing chunked transfer-encoding
293  on upload */
294  bool getheader; /* TRUE if header parsing is wanted */
295 
296  bool forbidchunk; /* used only to explicitly forbid chunk-upload for
297  specific upload buffers. See readmoredata() in
298  http.c for details. */
299  bool tcpconnect; /* the tcp stream (or simimlar) is connected, this
300  is set the first time on the first connect function
301  call */
302  bool retry; /* this connection is about to get closed and then
303  re-attempted at another connection. */
304 };
305 
306 /*
307  * This struct is all the previously local variables from Curl_perform() moved
308  * to struct to allow the function to return and get re-invoked better without
309  * losing state.
310  */
311 
313  curl_off_t bytecount; /* total number of bytes read */
314  int writebytecount; /* number of bytes written */
315  struct timeval start; /* transfer started at this time */
316  struct timeval now; /* current time */
317  bool header; /* incoming data has HTTP header */
318  enum {
319  HEADER_NORMAL, /* no bad header at all */
320  HEADER_PARTHEADER, /* part of the chunk is a bad header, the rest is
321  normal data */
322  HEADER_ALLBAD /* all was believed to be header */
323  } badheader; /* the header was deemed bad and will be
324  written as body */
325  int headerline; /* counts header lines to better track the
326  first one */
327  char *hbufp; /* points at *end* of header line */
328  int hbuflen;
329  char *str; /* within buf */
330  char *str_start; /* within buf */
331  char *end_ptr; /* within buf */
332  char *p; /* within headerbuff */
333  bool content_range; /* set TRUE if Content-Range: was found */
334  curl_off_t offset; /* possible resume offset read from the
335  Content-Range: header */
336  int httpcode; /* error code from the 'HTTP/1.? XXX' line */
337  int httpversion; /* the HTTP version*10 */
338  struct timeval start100; /* time stamp to wait for the 100 code from */
339  bool write_after_100_header; /* TRUE = we enable the write after we
340  received a 100-continue/timeout or
341  FALSE = directly */
342  bool wait100_after_headers; /* TRUE = after the request-headers have been
343  sent off properly, we go into the wait100
344  state, FALSE = don't */
345  int content_encoding; /* What content encoding. sec 3.5, RFC2616. */
346 
347 #define IDENTITY 0 /* No encoding */
348 #define DEFLATE 1 /* zlib delfate [RFC 1950 & 1951] */
349 #define GZIP 2 /* gzip algorithm [RFC 1952] */
350 #define COMPRESS 3 /* Not handled, added for completeness */
351 
352 #ifdef HAVE_LIBZ
353  bool zlib_init; /* True if zlib already initialized;
354  undefined if Content-Encoding header. */
355  z_stream z; /* State structure for zlib. */
356 #endif
357 
358  /* for the low speed checks: */
359  time_t timeofdoc;
361 
362  char *buf;
363  char *uploadbuf;
365 
366  /* pointers to the actual descriptors we check */
367  fd_set *readfdp;
368  fd_set *writefdp;
369 
370  /* the file descriptors to play with */
371  fd_set readfd;
372  fd_set writefd;
373  fd_set rkeepfd;
374  fd_set wkeepfd;
375  int keepon;
376 
377  bool upload_done; /* set to TRUE when doing chunked transfer-encoding upload
378  and we're uploading the last chunk */
379 
380  bool ignorebody; /* we read a response-body but we ignore it! */
381 };
382 
383 #if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME)
384 struct Curl_async {
385  char *hostname;
386  int port;
387  struct Curl_dns_entry *dns;
388  bool done; /* set TRUE when the lookup is complete */
389  int status; /* if done is TRUE, this is the status from the callback */
390  void *os_specific; /* 'struct thread_data' for Windows */
391 };
392 #endif
393 
394 #define FIRSTSOCKET 0
395 #define SECONDARYSOCKET 1
396 
397 /*
398  * The connectdata struct contains all fields and variables that should be
399  * unique for an entire connection.
400  */
401 struct connectdata {
402  /**** Fields set when inited and not modified again */
403  struct SessionHandle *data; /* link to the root CURL struct */
404  int connectindex; /* what index in the connects index this particular
405  struct has */
406 
407  long protocol; /* PROT_* flags concerning the protocol set */
408 #define PROT_MISSING (1<<0)
409 #define PROT_GOPHER (1<<1)
410 #define PROT_HTTP (1<<2)
411 #define PROT_HTTPS (1<<3)
412 #define PROT_FTP (1<<4)
413 #define PROT_TELNET (1<<5)
414 #define PROT_DICT (1<<6)
415 #define PROT_LDAP (1<<7)
416 #define PROT_FILE (1<<8)
417 #define PROT_FTPS (1<<9)
418 #define PROT_SSL (1<<10) /* protocol requires SSL */
419 
420  /* the particular host we use, in two different ways */
422 
423 #ifdef ENABLE_IPV6
424  struct addrinfo *serv_addr;
425 #else
426  struct sockaddr_in serv_addr;
427 #endif
428  char protostr[64]; /* store the protocol string in this buffer */
429  char gname[513]; /* store the hostname in this buffer */
430  char *name; /* host name pointer to fool around with */
431  char *path; /* allocated buffer to store the URL's path part in */
432  char *hostname; /* hostname to connect, as parsed from url */
433  long port; /* which port to use locally */
434  unsigned short remote_port; /* what remote port to connect to,
435  not the proxy port! */
436  char *ppath;
438  long headerbytecount; /* only count received headers */
439 
440  char *range; /* range, if used. See README for detailed specification on
441  this syntax. */
442  curl_off_t resume_from; /* continue [ftp] transfer from here */
443 
444  char *proxyhost; /* name of the http proxy host */
445 
446  char *user; /* user name string, allocated */
447  char *passwd; /* password string, allocated */
448 
449  char *proxyuser; /* proxy user name string, allocated */
450  char *proxypasswd; /* proxy password string, allocated */
451 
452  struct timeval now; /* "current" time */
453  struct timeval created; /* creation time */
454  curl_socket_t sock[2]; /* two sockets, the second is used for the data
455  transfer when doing FTP */
456  curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch, 0
457  means unlimited */
458 
459  struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */
461 
462  struct ConnectBits bits; /* various state-flags for this connection */
463 
464  /* These two functions MUST be set by the curl_connect() function to be
465  be protocol dependent */
468 
469  /* If the curl_do() function is better made in two halves, this
470  * curl_do_more() function will be called afterwards, if set. For example
471  * for doing the FTP stuff after the PASV/PORT command.
472  */
474 
475  /* This function *MAY* be set to a protocol-dependent function that is run
476  * after the connect() and everything is done, as a step in the connection.
477  */
479 
480  /* This function *MAY* be set to a protocol-dependent function that is run
481  * by the curl_disconnect(), as a step in the disconnection.
482  */
484 
485  /* This function *MAY* be set to a protocol-dependent function that is run
486  * in the curl_close() function if protocol-specific cleanups are required.
487  */
489 
490  /**** curl_get() phase fields */
491 
492  /* READ stuff */
493  curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
494  curl_off_t size; /* -1 if unknown at this point */
495  curl_off_t *bytecountp; /* return number of bytes read or NULL */
496 
497  /* WRITE stuff */
498  curl_socket_t writesockfd; /* socket to write to, it may very
499  well be the same we read from.
500  CURL_SOCKET_BAD disables */
501  curl_off_t *writebytecountp; /* return number of bytes written or NULL */
502 
506  char *proxyuserpwd; /* free later if not NULL! */
507  char *uagent; /* free later if not NULL! */
508  char *accept_encoding; /* free later if not NULL! */
509  char *userpwd; /* free later if not NULL! */
510  char *rangeline; /* free later if not NULL! */
511  char *ref; /* free later if not NULL! */
512  char *cookie; /* free later if not NULL! */
513  char *host; /* free later if not NULL */
514  char *cookiehost; /* free later if not NULL */
515  } allocptr;
516 
517  char *newurl; /* This can only be set if a Location: was in the
518  document headers */
519 
520 #ifdef HAVE_KRB4
521  enum protection_level command_prot;
522  enum protection_level data_prot;
523  enum protection_level request_data_prot;
524 
525  size_t buffer_size;
526 
527  struct krb4buffer in_buffer, out_buffer;
528  int sec_complete;
529  void *app_data;
530 
531  struct Curl_sec_client_mech *mech;
532  struct sockaddr_in local_addr;
533 
534 #endif
535 
536  /*************** Request - specific items ************/
537  /* previously this was in the urldata struct */
538  union {
539  struct HTTP *http;
540  struct HTTP *gopher; /* alias, just for the sake of being more readable */
541  struct HTTP *https; /* alias, just for the sake of being more readable */
542  struct FTP *ftp;
543  struct FILEPROTO *file;
544  void *telnet; /* private for telnet.c-eyes only */
545 #if 0 /* no need for special ones for these: */
546  struct LDAP *ldap;
547  struct DICT *dict;
548 #endif
549  void *generic;
550  } proto;
551 
552  /* This struct is inited when needed */
554 
555  /* 'upload_present' is used to keep a byte counter of how much data there is
556  still left in the buffer, aimed for upload. */
558 
559  /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a
560  buffer, so the next read should read from where this pointer points to,
561  and the 'upload_present' contains the number of bytes available at this
562  position */
564 
565  curl_read_callback fread; /* function that reads the input */
566  void *fread_in; /* pointer to pass to the fread() above */
567 
568  struct ntlmdata ntlm; /* NTLM differs from other authentication schemes
569  because it authenticates connections, not
570  single requests! */
571  struct ntlmdata proxyntlm; /* NTLM data for proxy */
572 
573  int sockerror; /* errno stored by Curl_read() if the underlying layer returns
574  error */
575 #if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME)
576  /* data used for the asynch name resolve callback */
577  struct Curl_async async;
578 #endif
579 };
580 
581 /* The end of connectdata. */
582 
583 /*
584  * Struct to keep statistical and informational data.
585  */
586 struct PureInfo {
587  int httpcode; /* Recent HTTP or FTP response code */
590  long filetime; /* If requested, this is might get set. Set to -1 if the time
591  was unretrievable. We cannot have this of type time_t,
592  since time_t is unsigned on several platforms such as
593  OpenVMS. */
594  long header_size; /* size of read header(s) in bytes */
595  long request_size; /* the amount of bytes sent in the request(s) */
596 
599 
600  char *contenttype; /* the content type of the object */
601 };
602 
603 
604 struct Progress {
605  long lastshow; /* time() of the last displayed progress meter or NULL to
606  force redraw at next call */
607  curl_off_t size_dl; /* total expected size */
608  curl_off_t size_ul; /* total expected size */
609  curl_off_t downloaded; /* transfered so far */
610  curl_off_t uploaded; /* transfered so far */
611 
612  curl_off_t current_speed; /* uses the currently fastest transfer */
613 
614  bool callback; /* set when progress callback is used */
615  int width; /* screen width at download start */
616  int flags; /* see progress.h */
617 
618  double timespent;
619 
622 
623  double t_nslookup;
624  double t_connect;
627  double t_redirect;
628 
629  struct timeval start;
630  struct timeval t_startsingle;
631 #define CURR_TIME (5+1) /* 6 entries for 5 seconds */
632 
633  curl_off_t speeder[ CURR_TIME ];
634  struct timeval speeder_time[ CURR_TIME ];
636 };
637 
638 typedef enum {
639  HTTPREQ_NONE, /* first in list */
642  HTTPREQ_POST_FORM, /* we make a difference internally */
645  HTTPREQ_LAST /* last in list */
646 } Curl_HttpReq;
647 
648 /*
649  * Values that are generated, temporary or calculated internally for a
650  * "session handle" must be defined within the 'struct urlstate'. This struct
651  * will be used within the SessionHandle struct. When the 'SessionHandle'
652  * struct is cloned, this data MUST NOT be copied.
653  *
654  * Remember that any "state" information goes globally for the curl handle.
655  * Session-data MUST be put in the connectdata struct and here. */
656 #define MAX_CURL_USER_LENGTH 256
657 #define MAX_CURL_PASSWORD_LENGTH 256
658 #define MAX_CURL_USER_LENGTH_TXT "255"
659 #define MAX_CURL_PASSWORD_LENGTH_TXT "255"
660 
661 struct UrlState {
662  enum {
665  Curl_if_multi
666  } used_interface;
667 
668  /* buffers to store authentication data in, as parsed from input options */
669  struct timeval keeps_speed; /* for the progress meter really */
670 
671  /* 'connects' will be an allocated array with pointers. If the pointer is
672  set, it holds an allocated connection. */
674  long numconnects; /* size of the 'connects' array */
675 
676  char *headerbuff; /* allocated buffer to store headers in */
677  int headersize; /* size of the allocation */
678 
679  char buffer[BUFSIZE+1]; /* download buffer */
680  char uploadbuffer[BUFSIZE+1]; /* upload buffer */
681  double current_speed; /* the ProgressShow() funcion sets this */
682 
683  bool this_is_a_follow; /* this is a followed Location: request */
684 
685  char *auth_host; /* if set, this should be the host name that we will
686  sent authorization to, no else. Used to make Location:
687  following not keep sending user+password... This is
688  strdup() data.
689  */
690 
691  struct curl_ssl_session *session; /* array of 'numsessions' size */
692  long sessionage; /* number of the most recent session */
693 
694  char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */
695  bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
696  This must be set to FALSE every time _easy_perform() is
697  called. */
698 
699 #ifdef HAVE_SIGNAL
700  /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
701  void (*prev_signal)(int sig);
702 #endif
703  bool allow_port; /* Is set.use_port allowed to take effect or not. This
704  is always set TRUE when curl_easy_perform() is called. */
705 
706  struct digestdata digest;
707 
708 #ifdef HAVE_GSSAPI
709  struct negotiatedata negotiate;
710 #endif
711 
712  long authstage; /* 0 - authwant and authavail are still not initialized
713  401 - web authentication is performed
714  407 - proxy authentication is performed */
715  long authwant; /* initially set to authentication methods requested by
716  client (either with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH
717  depending on authstage) */
718  long authavail; /* what the server reports */
719 
720 #ifdef USE_ARES
721  ares_channel areschannel; /* for name resolves */
722 #endif
723 };
724 
725 
726 /*
727  * This 'DynamicStatic' struct defines dynamic states that actually change
728  * values in the 'UserDefined' area, which MUST be taken into consideration
729  * if the UserDefined struct is cloned or similar. You can probably just
730  * copy these, but each one indicate a special action on other data.
731  */
732 
734  char *url; /* work URL, copied from UserDefined */
735  bool url_alloc; /* URL string is malloc()'ed */
736  bool url_changed; /* set on CURL_OPT_URL, used to detect if the URL was
737  changed after the connect phase, as we allow callback
738  to change it and if so, we reconnect to use the new
739  URL instead */
740  char *proxy; /* work proxy, copied from UserDefined */
741  bool proxy_alloc; /* http proxy string is malloc()'ed */
742  char *referer; /* referer string */
743  bool referer_alloc; /* referer sting is malloc()ed */
744  struct curl_slist *cookielist; /* list of cookie files set by
745  curl_easy_setopt(COOKIEFILE) calls */
746 };
747 
748 /*
749  * This 'UserDefined' struct must only contain data that is set once to go
750  * for many (perhaps) independent connections. Values that are generated or
751  * calculated internally for the "session handle" MUST be defined within the
752  * 'struct urlstate' instead. The only exceptions MUST note the changes in
753  * the 'DynamicStatic' struct.
754  */
755 
756 struct UserDefined {
757  FILE *err; /* the stderr user data goes here */
758  void *debugdata; /* the data that will be passed to fdebug */
759  char *errorbuffer; /* store failure messages in here */
760  char *proxyuserpwd; /* Proxy <user:password>, if used */
761  long proxyport; /* If non-zero, use this port number by default. If the
762  proxy string features a ":[port]" that one will override
763  this. */
764  void *out; /* the fetched file goes here */
765  void *in; /* the uploaded file is read from here */
766  void *writeheader; /* write the header to this is non-NULL */
767  char *set_url; /* what original URL to work on */
768  char *set_proxy; /* proxy to use */
769  long use_port; /* which port to use (when not using default) */
770  char *userpwd; /* <user:password>, if used */
771  long httpauth; /* what kind of HTTP authentication to use (bitmask) */
772  long proxyauth; /* what kind of proxy authentication to use (bitmask) */
773  char *set_range; /* range, if used. See README for detailed specification
774  on this syntax. */
775  long followlocation; /* as in HTTP Location: */
776  long maxredirs; /* maximum no. of http(s) redirects to follow */
777  char *set_referer; /* custom string */
778  bool free_referer; /* set TRUE if 'referer' points to a string we
779  allocated */
780  char *useragent; /* User-Agent string */
781  char *encoding; /* Accept-Encoding string */
782  char *postfields; /* if POST, set the fields' values here */
783  curl_off_t postfieldsize; /* if POST, this might have a size to use instead
784  of strlen(), and then the data *may* be binary
785  (contain zero bytes) */
786  char *ftpport; /* port to send with the FTP PORT command */
787  char *device; /* network interface to use */
788  curl_write_callback fwrite; /* function that stores the output */
789  curl_write_callback fwrite_header; /* function that stores headers */
790  curl_read_callback fread; /* function that reads the input */
791  curl_progress_callback fprogress; /* function for progress information */
792  curl_debug_callback fdebug; /* function that write informational data */
793  void *progress_client; /* pointer to pass to the progress callback */
794  long timeout; /* in seconds, 0 means no timeout */
795  long connecttimeout; /* in seconds, 0 means no timeout */
796  long ftp_response_timeout; /* in seconds, 0 means no timeout */
797  curl_off_t infilesize; /* size of file to upload, -1 means unknown */
798  long low_speed_limit; /* bytes/second */
799  long low_speed_time; /* number of seconds */
800  curl_off_t set_resume_from; /* continue [ftp] transfer from here */
801  char *cookie; /* HTTP cookie string to send */
802  struct curl_slist *headers; /* linked list of extra headers */
803  struct curl_httppost *httppost; /* linked list of POST data */
804  char *cert; /* certificate */
805  char *cert_type; /* format for certificate (default: PEM) */
806  char *key; /* private key */
807  char *key_type; /* format for private key (default: PEM) */
808  char *key_passwd; /* plain text private key password */
809  char *crypto_engine; /* name of the crypto engine to use */
810  char *cookiejar; /* dump all cookies to this file */
811  bool cookiesession; /* new cookie session? */
812  bool crlf; /* convert crlf on ftp upload(?) */
813  struct curl_slist *quote; /* after connection is established */
814  struct curl_slist *postquote; /* after the transfer */
815  struct curl_slist *prequote; /* before the transfer, after type (Wesley Laxton)*/
816  struct curl_slist *telnet_options; /* linked list of telnet options */
817  curl_TimeCond timecondition; /* kind of time/date comparison */
818  time_t timevalue; /* what time to compare with */
819  curl_closepolicy closepolicy; /* connection cache close concept */
820  Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
821  char *customrequest; /* HTTP/FTP request to use */
822  long httpversion; /* when non-zero, a specific HTTP version requested to
823  be used in the library's request(s) */
824  char *auth_host; /* if set, this is the allocated string to the host name
825  * to which to send the authorization data to, and no other
826  * host (which location-following otherwise could lead to)
827  */
828  char *krb4_level; /* what security level */
829  struct ssl_config_data ssl; /* user defined SSL stuff */
830 
831  curl_proxytype proxytype; /* what kind of proxy that is in use */
832 
833  int dns_cache_timeout; /* DNS cache timeout */
834  long buffer_size; /* size of receive buffer to use */
835 
836  char *private; /* Private data */
837 
838  struct curl_slist *http200aliases; /* linked list of aliases for http200 */
839 
841 
842  curl_off_t max_filesize; /* Maximum file size to download */
843 
844 /* Here follows boolean settings that define how to behave during
845  this session. They are STATIC, set by libcurl users or at least initially
846  and they don't change during operations. */
847 
851  bool ftp_ascii;
860 #define http_include_header include_header /* former name */
861 
863  bool http_auto_referer; /* set "correct" referer when following location: */
864  bool no_body;
865  bool set_port;
866  bool upload;
868  use_netrc; /* defined in include/curl.h */
869  char *netrc_file; /* if not NULL, use this instead of trying to find
870  $HOME/.netrc */
871  bool verbose;
872  bool krb4; /* kerberos4 connection requested */
873  bool reuse_forbid; /* forbidden to be reused, close after use */
874  bool reuse_fresh; /* do not re-use an existing connection */
875  bool expect100header; /* TRUE if we added Expect: 100-continue */
876  bool ftp_use_epsv; /* if EPSV is to be attempted or not */
877  bool ftp_use_eprt; /* if EPRT is to be attempted or not */
878  curl_ftpssl ftp_ssl; /* if AUTH TLS is to be attempted etc */
879  bool no_signal; /* do not use any signal/alarm handler */
880 
882 };
883 
884 /*
885  * In August 2001, this struct was redesigned and is since stricter than
886  * before. The 'connectdata' struct MUST have all the connection oriented
887  * stuff as we may now have several simultaneous connections and connection
888  * structs in memory.
889  *
890  * From now on, the 'SessionHandle' must only contain data that is set once to
891  * go for many (perhaps) independent connections. Values that are generated or
892  * calculated internally for the "session handle" must be defined within the
893  * 'struct urlstate' instead. */
894 
897  struct Curl_share *share; /* Share, handles global variable mutexing */
898  struct UserDefined set; /* values set by the libcurl user */
899  struct DynamicStatic change; /* possibly modified userdefined data */
900 
901  struct CookieInfo *cookies; /* the cookies, read from files and servers */
902  struct Progress progress; /* for all the progress meter data */
903  struct UrlState state; /* struct for fields used for state info and
904  other dynamic purposes */
905  struct PureInfo info; /* stats, reports and info data */
906 #if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
907  ENGINE* engine;
908 #endif /* USE_SSLEAY */
909 };
910 
911 #define LIBCURL_NAME "libcurl"
912 
913 #endif
struct FTP * ftp
Definition: urldata.h:542
bool krb4
Definition: urldata.h:872
struct ssl_connect_data ssl[2]
Definition: urldata.h:459
bool no_body
Definition: urldata.h:864
char * dirs[CURL_MAX_FTP_DIRDEPTH]
Definition: urldata.h:246
bool callback
Definition: urldata.h:614
bool ftp_use_port
Definition: urldata.h:854
int connectindex
Definition: urldata.h:404
curl_off_t cache_size
Definition: urldata.h:252
bool rangestringalloc
Definition: urldata.h:287
struct CookieInfo * cookies
Definition: urldata.h:901
bool httpproxy
Definition: urldata.h:281
struct ConnectBits bits
Definition: urldata.h:462
curl_off_t bytecount
Definition: urldata.h:437
struct timeval now
Definition: urldata.h:316
long numsessions
Definition: urldata.h:156
int fd
Definition: urldata.h:271
struct connectdata ** connects
Definition: urldata.h:673
void * telnet
Definition: urldata.h:544
struct Curl_transfer_keeper keep
Definition: urldata.h:553
struct FILEPROTO * file
Definition: urldata.h:543
void * send_buffer
Definition: urldata.h:234
union connectdata::@11 proto
CURLcode(* curl_close)(struct connectdata *)
Definition: urldata.h:488
bool http_disable_hostname_check_before_authentication
Definition: urldata.h:858
curl_closepolicy closepolicy
Definition: urldata.h:819
int curl_socket_t
Definition: setup.h:254
bool forbidchunk
Definition: urldata.h:296
curl_write_callback fwrite_header
Definition: urldata.h:789
struct timeval start100
Definition: urldata.h:338
curl_off_t uploaded
Definition: urldata.h:610
bool http_set_referer
Definition: urldata.h:862
Curl_HttpReq
Definition: urldata.h:638
long use_port
Definition: urldata.h:769
char * urlpath
Definition: urldata.h:245
void * in
Definition: urldata.h:765
long connecttimeout
Definition: urldata.h:795
bool url_alloc
Definition: urldata.h:735
curl_proxytype
Definition: curl.h:289
bool ftp_use_epsv
Definition: urldata.h:876
void * fsslctxp
Definition: urldata.h:158
int dns_cache_timeout
Definition: urldata.h:833
char * errorbuffer
Definition: urldata.h:759
curl_off_t postsize
Definition: urldata.h:224
char * useragent
Definition: urldata.h:780
int algo
Definition: urldata.h:175
char * customrequest
Definition: urldata.h:821
struct curl_slist * http200aliases
Definition: urldata.h:838
bool ctl_valid
Definition: urldata.h:261
CURLcode(* curl_disconnect)(struct connectdata *)
Definition: urldata.h:483
bool no_signal
Definition: urldata.h:879
struct HTTP * https
Definition: urldata.h:541
char * cookie
Definition: urldata.h:801
curl_socket_t sockfd
Definition: urldata.h:493
struct curl_ssl_session * session
Definition: urldata.h:691
CURLcode(* curl_done)(struct connectdata *)
Definition: urldata.h:467
CURLcode
Definition: curl.h:209
char * cookiejar
Definition: urldata.h:810
char * user
Definition: urldata.h:243
CURL_NETRC_OPTION
Definition: curl.h:837
bool no_transfer
Definition: urldata.h:256
curl_off_t readbytecount
Definition: urldata.h:213
#define CURR_TIME
Definition: urldata.h:631
char * contenttype
Definition: urldata.h:600
struct curl_slist * quote
Definition: urldata.h:813
curl_ftpssl ftp_ssl
Definition: urldata.h:878
char protostr[64]
Definition: urldata.h:428
bool upload
Definition: urldata.h:866
unsigned short remote_port
Definition: urldata.h:434
bool http_auto_referer
Definition: urldata.h:863
struct timeval created
Definition: urldata.h:453
size_t(* curl_write_callback)(char *buffer, size_t size, size_t nitems, void *outstream)
Definition: curl.h:169
curl_off_t current_speed
Definition: urldata.h:612
char * proxyuser
Definition: urldata.h:449
long request_size
Definition: urldata.h:595
off_t curl_off_t
Definition: curl.h:96
FILE * err
Definition: urldata.h:757
#define CURL_MAX_FTP_DIRDEPTH
Definition: urldata.h:111
long proxyauth
Definition: urldata.h:772
bool referer_alloc
Definition: urldata.h:743
long ftp_response_timeout
Definition: urldata.h:796
double t_nslookup
Definition: urldata.h:623
curl_off_t downloaded
Definition: urldata.h:609
char * CApath
Definition: urldata.h:151
char * egdsocket
Definition: urldata.h:154
void * progress_client
Definition: urldata.h:793
enum HTTP::@9 sending
enum Curl_transfer_keeper::@10 badheader
struct ssl_config_data ssl_config
Definition: urldata.h:460
curl_off_t set_resume_from
Definition: urldata.h:800
char * upload_fromhere
Definition: urldata.h:563
curl_hash * hostcache
Definition: urldata.h:896
char * random_file
Definition: urldata.h:153
CURLcode(* curl_do_more)(struct connectdata *)
Definition: urldata.h:473
struct FormData * sendit
Definition: urldata.h:207
bool reuse
Definition: urldata.h:279
bool dont_check
Definition: urldata.h:253
bool global_dns_cache
Definition: urldata.h:881
bool tunnel_thru_httpproxy
Definition: urldata.h:849
curl_closepolicy
Definition: curl.h:1139
bool get_filetime
Definition: urldata.h:848
bool allow_port
Definition: urldata.h:703
char * proxyuserpwd
Definition: urldata.h:760
CURLcode(* curl_connect)(struct connectdata *)
Definition: urldata.h:478
curl_off_t resume_from
Definition: urldata.h:442
void * out
Definition: urldata.h:764
bool write_after_100_header
Definition: urldata.h:339
bool errorbuf
Definition: urldata.h:695
long timeout
Definition: urldata.h:794
char * nonce
Definition: urldata.h:172
int upload_present
Definition: urldata.h:557
fd_set * writefdp
Definition: urldata.h:368
int(* curl_debug_callback)(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr)
Definition: curl.h:196
int flags
Definition: urldata.h:616
long header_size
Definition: urldata.h:594
curl_read_callback fread
Definition: urldata.h:221
char * auth_host
Definition: urldata.h:685
char * cipher_list
Definition: urldata.h:155
struct HTTP * http
Definition: urldata.h:539
void * sessionid
Definition: urldata.h:164
bool crlf
Definition: urldata.h:812
char * passwd
Definition: urldata.h:447
long followlocation
Definition: urldata.h:775
void * writeheader
Definition: urldata.h:766
bool reuse_forbid
Definition: urldata.h:873
bool ipv6_ip
Definition: urldata.h:284
char * set_proxy
Definition: urldata.h:768
bool ftp_use_eprt
Definition: urldata.h:877
char * proxy
Definition: urldata.h:740
struct ntlmdata proxyntlm
Definition: urldata.h:571
struct ssl_config_data ssl_config
Definition: urldata.h:167
bool expect100header
Definition: urldata.h:875
curl_off_t offset
Definition: urldata.h:334
GLuint index
Definition: glext.h:3476
long proxyauthavail
Definition: urldata.h:597
struct curl_slist * headers
Definition: urldata.h:802
curl_off_t size
Definition: urldata.h:494
void * debugdata
Definition: urldata.h:758
char * hostname
Definition: urldata.h:432
bool ftp_create_missing_dirs
Definition: urldata.h:853
long low_speed_time
Definition: urldata.h:799
int speeder_c
Definition: urldata.h:635
long buffer_size
Definition: urldata.h:834
char * url
Definition: urldata.h:734
Definition: hostip.h:40
curl_off_t postfieldsize
Definition: urldata.h:783
int ip_version
Definition: urldata.h:840
long verifypeer
Definition: urldata.h:147
char gname[513]
Definition: urldata.h:429
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:2853
curl_TimeCond
Definition: curl.h:858
GLuint buffer
Definition: glext.h:3108
char * cache
Definition: urldata.h:251
struct timeval now
Definition: urldata.h:452
char * ppath
Definition: urldata.h:436
char * set_referer
Definition: urldata.h:777
char * referer
Definition: urldata.h:742
char * crypto_engine
Definition: urldata.h:809
char * userpwd
Definition: urldata.h:770
long httpversion
Definition: urldata.h:822
bool hide_progress
Definition: urldata.h:855
double t_pretransfer
Definition: urldata.h:625
char * key
Definition: urldata.h:806
int httpversion
Definition: urldata.h:589
long authavail
Definition: urldata.h:718
struct Curl_share * share
Definition: urldata.h:897
double t_connect
Definition: urldata.h:624
long authwant
Definition: urldata.h:715
long maxredirs
Definition: urldata.h:776
char * auth_host
Definition: urldata.h:824
Definition: urldata.h:241
char * postdata
Definition: urldata.h:223
char * scratch
Definition: urldata.h:694
long proxyport
Definition: urldata.h:761
long numconnects
Definition: urldata.h:674
bool include_header
Definition: urldata.h:859
curl_debug_callback fdebug
Definition: urldata.h:792
bool this_is_a_follow
Definition: urldata.h:683
curl_ssl_ctx_callback fsslctx
Definition: urldata.h:157
struct ntlmdata ntlm
Definition: urldata.h:568
char * range
Definition: urldata.h:440
#define context
Definition: getdate.c:236
bool reuse_fresh
Definition: urldata.h:874
long authstage
Definition: urldata.h:712
struct SessionHandle * data
Definition: urldata.h:403
char * cert_type
Definition: urldata.h:805
bool getheader
Definition: urldata.h:294
curl_read_callback fread
Definition: urldata.h:565
char * newurl
Definition: urldata.h:517
char * entrypath
Definition: urldata.h:249
struct curl_slist * telnet_options
Definition: urldata.h:816
bool tcpconnect
Definition: urldata.h:299
struct curl_slist * cookielist
Definition: urldata.h:744
long verifyhost
Definition: urldata.h:148
bool close
Definition: urldata.h:278
const char * p_accept
Definition: urldata.h:212
double t_redirect
Definition: urldata.h:627
curl_socket_t writesockfd
Definition: urldata.h:498
curl_socket_t maxfd
Definition: urldata.h:364
curl_off_t * bytecountp
Definition: urldata.h:495
curl_off_t bytecount
Definition: urldata.h:313
bool chunk
Definition: urldata.h:280
curl_progress_callback fprogress
Definition: urldata.h:791
int width
Definition: urldata.h:615
bool proxy_user_passwd
Definition: urldata.h:283
int httpproxycode
Definition: urldata.h:588
char * proxyhost
Definition: urldata.h:444
struct HTTP * gopher
Definition: urldata.h:540
bool ftp_append
Definition: urldata.h:850
double timespent
Definition: urldata.h:618
char * name
Definition: urldata.h:430
int sockerror
Definition: urldata.h:573
char * key_passwd
Definition: urldata.h:808
curl_off_t infilesize
Definition: urldata.h:797
bool set_port
Definition: urldata.h:865
int httpcode
Definition: urldata.h:587
bool wait100_after_headers
Definition: urldata.h:342
curl_read_callback fread
Definition: urldata.h:790
char * proxypasswd
Definition: urldata.h:450
curl_off_t * writebytecountp
Definition: urldata.h:501
bool ftp_ascii
Definition: urldata.h:851
curl_off_t max_filesize
Definition: urldata.h:842
long lastshow
Definition: urldata.h:605
char * headerbuff
Definition: urldata.h:676
char * cert
Definition: urldata.h:804
char * ftpport
Definition: urldata.h:786
unsigned char nonce[8]
Definition: urldata.h:189
struct curl_slist * postquote
Definition: urldata.h:814
curl_socket_t sock[2]
Definition: urldata.h:454
long httpauthavail
Definition: urldata.h:598
char * postfields
Definition: urldata.h:782
bool verbose
Definition: urldata.h:871
double current_speed
Definition: urldata.h:681
struct Curl_dns_entry * connect_addr
Definition: urldata.h:421
curl_off_t ulspeed
Definition: urldata.h:621
double t_starttransfer
Definition: urldata.h:626
char * netrc_file
Definition: urldata.h:869
GLsizeiptr size
Definition: glext.h:3112
time_t timevalue
Definition: urldata.h:818
char * cnonce
Definition: urldata.h:173
curl_off_t size_ul
Definition: urldata.h:608
char * file
Definition: urldata.h:247
char * device
Definition: urldata.h:787
void * fread_in
Definition: urldata.h:222
curl_write_callback fwrite
Definition: urldata.h:788
bool url_changed
Definition: urldata.h:736
char * encoding
Definition: urldata.h:781
curl_off_t postsize
Definition: urldata.h:208
int headersize
Definition: urldata.h:677
curl_ftpssl
Definition: curl.h:314
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void * fread_in
Definition: urldata.h:566
curlntlm
Definition: urldata.h:178
long sessionage
Definition: urldata.h:692
curl_off_t writebytecount
Definition: urldata.h:214
char * krb4_level
Definition: urldata.h:828
int(* curl_progress_callback)(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
Definition: curl.h:159
bool upload_chunky
Definition: urldata.h:292
struct Curl_chunker chunk
Definition: urldata.h:218
CURLcode(* curl_ssl_ctx_callback)(CURL *curl, void *ssl_ctx, void *userptr)
Definition: curl.h:280
Definition: formdata.h:33
char * path
Definition: urldata.h:431
char * key_type
Definition: urldata.h:807
long port
Definition: urldata.h:433
struct Form form
Definition: urldata.h:217
bool use_range
Definition: urldata.h:286
long headerbytecount
Definition: urldata.h:438
char * set_range
Definition: urldata.h:773
long low_speed_limit
Definition: urldata.h:798
char * postdata
Definition: urldata.h:209
struct curl_slist * prequote
Definition: urldata.h:815
curl_off_t * bytecountp
Definition: urldata.h:242
unsigned short remote_port
Definition: urldata.h:166
long protocol
Definition: urldata.h:407
bool http_follow_location
Definition: urldata.h:857
curl_proxytype proxytype
Definition: urldata.h:831
Definition: urldata.h:206
curlntlm state
Definition: urldata.h:188
bool do_more
Definition: urldata.h:289
bool retry
Definition: urldata.h:302
struct connectdata::dynamically_allocated_data allocptr
char * passwd
Definition: urldata.h:244
long response_time
Definition: urldata.h:258
size_t(* curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream)
Definition: curl.h:174
CURLcode(* curl_do)(struct connectdata *)
Definition: urldata.h:466
curl_off_t maxdownload
Definition: urldata.h:456
bool ftp_list_only
Definition: urldata.h:852
Curl_HttpReq httpreq
Definition: urldata.h:820
struct curl_httppost * httppost
Definition: urldata.h:803
GLdouble GLdouble z
Definition: glext.h:3067
long certverifyresult
Definition: urldata.h:146
curl_TimeCond timecondition
Definition: urldata.h:817
char * realm
Definition: urldata.h:174
struct HTTP::back backup
long httpauth
Definition: urldata.h:771
const char * p_pragma
Definition: urldata.h:211
bool proxy_alloc
Definition: urldata.h:741
char * set_url
Definition: urldata.h:767
long filetime
Definition: urldata.h:590
bool user_passwd
Definition: urldata.h:282
curl_off_t dlspeed
Definition: urldata.h:620
curl_off_t size_dl
Definition: urldata.h:607
char * CAfile
Definition: urldata.h:152
#define BUFSIZE
Definition: urldata.h:104
GLuint start
Definition: glext.h:2845
bool cookiesession
Definition: urldata.h:811
char * user
Definition: urldata.h:446
fd_set * readfdp
Definition: urldata.h:367
bool http_fail_on_error
Definition: urldata.h:856
bool free_referer
Definition: urldata.h:778
Dynamicly allocated strings, may need to be freed before this.
Definition: urldata.h:505
struct sockaddr_in serv_addr
Definition: urldata.h:426