7
7
* | (__| |_| | _ <| |___
8
8
* \___|\___/|_| \_\_____|
10
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
10
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
12
12
* This software is licensed as described in the file COPYING, which
13
13
* you should have received as part of this distribution. The terms
20
20
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
21
* KIND, either express or implied.
23
* $Id: urldata.h,v 1.275 2005/11/28 23:06:00 bagder Exp $
23
* $Id: urldata.h,v 1.291 2006-05-26 11:26:42 bagder Exp $
24
24
***************************************************************************/
26
26
/* This file is for lib internal stuff */
343
359
should be FALSE when it gets to Curl_ftp_quit() */
344
360
bool cwddone; /* if it has been determined that the proper CWD combo
345
361
already has been done */
362
bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent
363
caching the current directory */
346
364
char *prevpath; /* conn->path from the previous transfer */
348
366
size_t nread_resp; /* number of bytes currently read of a server response */
426
444
bool ftp_use_eprt; /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
427
445
EPRT doesn't work we disable it for the forthcoming
429
bool ftp_use_lprt; /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
430
LPRT doesn't work we disable it for the forthcoming
432
447
bool netrc; /* name+password provided by netrc */
434
449
bool trailerHdrPresent; /* Set when Trailer: header found in HTTP response.
435
450
Required to determine whether to look for trailers
436
451
in case of Transfer-Encoding: chunking */
452
bool done; /* set to FALSE when Curl_do() is called and set to TRUE
453
when Curl_done() is called, to prevent Curl_done() to
454
get invoked twice when the multi interface is
439
458
struct hostname {
527
546
#define FIRSTSOCKET 0
528
547
#define SECONDARYSOCKET 1
549
/* These function pointer types are here only to allow easier typecasting
550
within the source when we need to cast between data pointers (such as NULL)
551
and function pointers. */
552
typedef CURLcode (*Curl_do_more_func)(struct connectdata *);
553
typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode);
531
556
* The connectdata struct contains all fields and variables that should be
532
557
* unique for an entire connection.
612
636
/* These two functions MUST be set by the curl_connect() function to be
613
637
be protocol dependent */
614
638
CURLcode (*curl_do)(struct connectdata *, bool *done);
615
CURLcode (*curl_done)(struct connectdata *, CURLcode);
639
Curl_done_func curl_done;
617
641
/* If the curl_do() function is better made in two halves, this
618
642
* curl_do_more() function will be called afterwards, if set. For example
619
643
* for doing the FTP stuff after the PASV/PORT command.
621
CURLcode (*curl_do_more)(struct connectdata *);
645
Curl_do_more_func curl_do_more;
623
647
/* This function *MAY* be set to a protocol-dependent function that is run
624
648
* after the connect() and everything is done, as a step in the connection.
635
659
/* Called from the multi interface during the PROTOCONNECT phase, and it
636
660
should then return a proper fd set */
637
CURLcode (*curl_proto_fdset)(struct connectdata *conn,
639
fd_set *write_fd_set,
661
int (*curl_proto_getsock)(struct connectdata *conn,
662
curl_socket_t *socks,
642
665
/* Called from the multi interface during the DOING phase, and it should
643
666
then return a proper fd set */
644
CURLcode (*curl_doing_fdset)(struct connectdata *conn,
646
fd_set *write_fd_set,
667
int (*curl_doing_getsock)(struct connectdata *conn,
668
curl_socket_t *socks,
649
671
/* This function *MAY* be set to a protocol-dependent function that is run
650
672
* by the curl_disconnect(), as a step in the disconnection.
701
723
/* previously this was in the urldata struct */
703
725
struct HTTP *http;
704
struct HTTP *gopher; /* alias, just for the sake of being more readable */
705
726
struct HTTP *https; /* alias, just for the sake of being more readable */
707
728
void *tftp; /* private for tftp.c-eyes only */
824
845
* Values that are generated, temporary or calculated internally for a
825
* "session handle" must be defined within the 'struct urlstate'. This struct
846
* "session handle" must be defined within the 'struct UrlState'. This struct
826
847
* will be used within the SessionHandle struct. When the 'SessionHandle'
827
848
* struct is cloned, this data MUST NOT be copied.
860
881
set, it holds an allocated connection. */
861
882
struct connectdata **connects;
862
883
long numconnects; /* size of the 'connects' array */
884
long lastconnect; /* index of most recent connect or -1 if undefined */
864
886
char *headerbuff; /* allocated buffer to store headers in */
865
887
size_t headersize; /* size of the allocation */
909
931
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
911
933
#endif /* USE_SSLEAY */
934
struct timeval expiretime; /* set this with Curl_expire() only */
935
struct Curl_tree timenode; /* for the splay stuff */
937
/* a place to store the most recenlty set FTP entrypath */
938
char *most_recent_ftp_entrypath;
941
/* do FTP line-end conversions on most platforms */
942
#define CURL_DO_LINEEND_CONV
943
/* for FTP downloads: track CRLF sequences that span blocks */
944
bool prev_block_had_trailing_cr;
945
/* for FTP downloads: how many CRLFs did we converted to LFs? */
946
curl_off_t crlf_conversions;
938
974
* This 'UserDefined' struct must only contain data that is set once to go
939
975
* for many (perhaps) independent connections. Values that are generated or
940
976
* calculated internally for the "session handle" MUST be defined within the
941
* 'struct urlstate' instead. The only exceptions MUST note the changes in
977
* 'struct UrlState' instead. The only exceptions MUST note the changes in
942
978
* the 'DynamicStatic' struct.
980
struct Curl_one_easy; /* declared and used only in multi.c */
981
struct Curl_multi; /* declared and used only in multi.c */
945
983
struct UserDefined {
946
984
FILE *err; /* the stderr user data goes here */
953
991
void *out; /* the fetched file goes here */
954
992
void *in; /* the uploaded file is read from here */
955
void *writeheader; /* write the header to this is non-NULL */
993
void *writeheader; /* write the header to this if non-NULL */
956
994
char *set_url; /* what original URL to work on */
957
995
char *set_proxy; /* proxy to use */
958
996
long use_port; /* which port to use (when not using default) */
974
1012
of strlen(), and then the data *may* be binary
975
1013
(contain zero bytes) */
976
1014
char *ftpport; /* port to send with the FTP PORT command */
977
char *device; /* network interface to use */
1015
char *device; /* local network interface/address to use */
1016
unsigned short localport; /* local port number to bind to */
1017
int localportrange; /* number of additional port numbers to test in case the
1018
'localport' one can't be bind()ed */
978
1019
curl_write_callback fwrite; /* function that stores the output */
979
1020
curl_write_callback fwrite_header; /* function that stores headers */
980
1021
curl_read_callback fread; /* function that reads the input */
981
1022
curl_progress_callback fprogress; /* function for progress information */
982
1023
curl_debug_callback fdebug; /* function that write informational data */
983
1024
curl_ioctl_callback ioctl; /* function for I/O control */
1026
/* the 3 curl_conv_callback functions below are used on non-ASCII hosts */
1027
/* function to convert from the network encoding: */
1028
curl_conv_callback convfromnetwork;
1029
/* function to convert to the network encoding: */
1030
curl_conv_callback convtonetwork;
1031
/* function to convert from UTF-8 encoding: */
1032
curl_conv_callback convfromutf8;
984
1034
void *progress_client; /* pointer to pass to the progress callback */
985
1035
void *ioctl_client; /* pointer to pass to the ioctl callback */
986
1036
long timeout; /* in seconds, 0 means no timeout */
1033
1083
char *private_data; /* Private data */
1085
struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi
1086
handle, an internal 'Curl_one_easy'
1087
struct is created and this is a pointer
1088
to the particular struct associated with
1089
this SessionHandle */
1035
1091
struct curl_slist *http200aliases; /* linked list of aliases for http200 */
1037
1093
long ip_version;
1076
1132
bool expect100header; /* TRUE if we added Expect: 100-continue */
1077
1133
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
1078
1134
bool ftp_use_eprt; /* if EPRT is to be attempted or not */
1079
bool ftp_use_lprt; /* if LPRT is to be attempted or not */
1080
1135
curl_ftpssl ftp_ssl; /* if AUTH TLS is to be attempted etc */
1081
1136
curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
1082
1137
bool no_signal; /* do not use any signal/alarm handler */
1096
1152
* From now on, the 'SessionHandle' must only contain data that is set once to
1097
1153
* go for many (perhaps) independent connections. Values that are generated or
1098
1154
* calculated internally for the "session handle" must be defined within the
1099
* 'struct urlstate' instead. */
1155
* 'struct UrlState' instead. */
1101
1157
struct SessionHandle {
1102
1158
struct curl_hash *hostcache;
1103
void *multi; /* if non-NULL, points to the multi handle
1159
struct Curl_multi *multi; /* if non-NULL, points to the multi handle
1104
1160
struct of which this "belongs" */
1105
1161
struct Curl_share *share; /* Share, handles global variable mutexing */
1106
1162
struct UserDefined set; /* values set by the libcurl user */
1111
1167
struct UrlState state; /* struct for fields used for state info and
1112
1168
other dynamic purposes */
1113
1169
struct PureInfo info; /* stats, reports and info data */
1170
/* set by ftp_transfertype for use by Curl_client_write and others */
1171
bool ftp_in_ascii_mode;
1172
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
1173
iconv_t outbound_cd; /* for translating to the network encoding */
1174
iconv_t inbound_cd; /* for translating from the network encoding */
1175
iconv_t utf8_cd; /* for translating to UTF8 */
1176
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
1116
1179
#define LIBCURL_NAME "libcurl"