Newer
Older
struct ssh_conn sshc;
} proto;
Daniel Stenberg
committed
int cselect_bits; /* bitmask of socket events */
Daniel Stenberg
committed
};
/* The end of connectdata. */
Daniel Stenberg
committed
/*
* Struct to keep statistical and informational data.
*/
struct PureInfo {
int httpcode; /* Recent HTTP or FTP response code */
Daniel Stenberg
committed
int httpversion;
Daniel Stenberg
committed
long filetime; /* If requested, this is might get set. Set to -1 if the time
was unretrievable. We cannot have this of type time_t,
since time_t is unsigned on several platforms such as
OpenVMS. */
Daniel Stenberg
committed
long header_size; /* size of read header(s) in bytes */
long request_size; /* the amount of bytes sent in the request(s) */
long proxyauthavail;
long httpauthavail;
long numconnects; /* how many new connection did libcurl created */
char *contenttype; /* the content type of the object */
Daniel Stenberg
committed
long lastshow; /* time() of the last displayed progress meter or NULL to
force redraw at next call */
Daniel Stenberg
committed
curl_off_t size_dl; /* total expected size */
curl_off_t size_ul; /* total expected size */
curl_off_t downloaded; /* transfered so far */
curl_off_t uploaded; /* transfered so far */
Daniel Stenberg
committed
curl_off_t current_speed; /* uses the currently fastest transfer */
bool callback; /* set when progress callback is used */
int width; /* screen width at download start */
int flags; /* see progress.h */
Daniel Stenberg
committed
curl_off_t dlspeed;
curl_off_t ulspeed;
Daniel Stenberg
committed
double t_nslookup;
double t_connect;
double t_pretransfer;
double t_redirect;
Daniel Stenberg
committed
struct timeval start;
struct timeval t_startsingle;
#define CURR_TIME (5+1) /* 6 entries for 5 seconds */
Daniel Stenberg
committed
curl_off_t speeder[ CURR_TIME ];
Daniel Stenberg
committed
typedef enum {
HTTPREQ_NONE, /* first in list */
HTTPREQ_GET,
HTTPREQ_POST,
HTTPREQ_POST_FORM, /* we make a difference internally */
HTTPREQ_PUT,
Daniel Stenberg
committed
HTTPREQ_HEAD,
Daniel Stenberg
committed
HTTPREQ_CUSTOM,
HTTPREQ_LAST /* last in list */
} Curl_HttpReq;
Daniel Stenberg
committed
/*
* Values that are generated, temporary or calculated internally for a
* "session handle" must be defined within the 'struct UrlState'. This struct
Daniel Stenberg
committed
* will be used within the SessionHandle struct. When the 'SessionHandle'
* struct is cloned, this data MUST NOT be copied.
*
* Remember that any "state" information goes globally for the curl handle.
* Session-data MUST be put in the connectdata struct and here. */
#define MAX_CURL_USER_LENGTH 256
#define MAX_CURL_PASSWORD_LENGTH 256
#define MAX_CURL_USER_LENGTH_TXT "255"
#define MAX_CURL_PASSWORD_LENGTH_TXT "255"
Daniel Stenberg
committed
struct auth {
long want; /* Bitmask set to the authentication methods wanted by the app
(with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */
long picked;
long avail; /* bitmask for what the server reports to support for this
resource */
bool done; /* TRUE when the auth phase is done and ready to do the *actual*
request */
bool multi; /* TRUE if this is not yet authenticated but within the auth
multipass negotiation */
struct conncache {
/* 'connects' will be an allocated array with pointers. If the pointer is
set, it holds an allocated connection. */
struct connectdata **connects;
long num; /* number of entries of the 'connects' array */
enum {
CONNCACHE_PRIVATE, /* used for an easy handle alone */
CONNCACHE_MULTI /* shared within a multi handle */
} type;
};
Daniel Stenberg
committed
struct UrlState {
enum {
Curl_if_none,
Curl_if_easy,
Curl_if_multi
} used_interface;
struct conncache *connc; /* points to the connection cache this handle
uses */
Daniel Stenberg
committed
/* buffers to store authentication data in, as parsed from input options */
struct timeval keeps_speed; /* for the progress meter really */
long lastconnect; /* index of most recent connect or -1 if undefined */
Daniel Stenberg
committed
char *headerbuff; /* allocated buffer to store headers in */
size_t headersize; /* size of the allocation */
Daniel Stenberg
committed
char buffer[BUFSIZE+1]; /* download buffer */
char uploadbuffer[BUFSIZE+1]; /* upload buffer */
curl_off_t current_speed; /* the ProgressShow() funcion sets this,
bytes / second */
Daniel Stenberg
committed
bool this_is_a_follow; /* this is a followed Location: request */
Daniel Stenberg
committed
bool is_in_pipeline; /* Indicates whether this handle is part of a pipeline */
Daniel Stenberg
committed
char *first_host; /* if set, this should be the host name that we will
sent authorization to, no else. Used to make Location:
following not keep sending user+password... This is
strdup() data.
Daniel Stenberg
committed
*/
Daniel Stenberg
committed
struct curl_ssl_session *session; /* array of 'numsessions' size */
long sessionage; /* number of the most recent session */
char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */
Daniel Stenberg
committed
bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
This must be set to FALSE every time _easy_perform() is
called. */
Daniel Stenberg
committed
int os_errno; /* filled in with errno whenever an error occurs */
#ifdef HAVE_SIGNAL
/* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
void (*prev_signal)(int sig);
#endif
bool allow_port; /* Is set.use_port allowed to take effect or not. This
is always set TRUE when curl_easy_perform() is called. */
struct digestdata digest;
struct digestdata proxydigest;
#ifdef HAVE_GSSAPI
struct negotiatedata negotiate;
#endif
struct auth authhost;
struct auth authproxy;
Daniel Stenberg
committed
Daniel Stenberg
committed
bool authproblem; /* TRUE if there's some problem authenticating */
Daniel Stenberg
committed
#ifdef USE_ARES
ares_channel areschannel; /* for name resolves */
#endif
Daniel Stenberg
committed
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
ENGINE *engine;
#endif /* USE_SSLEAY */
Daniel Stenberg
committed
struct timeval expiretime; /* set this with Curl_expire() only */
struct Curl_tree timenode; /* for the splay stuff */
/* a place to store the most recenlty set FTP entrypath */
char *most_recent_ftp_entrypath;
Daniel Stenberg
committed
/* set after initial USER failure, to prevent an authentication loop */
bool ftp_trying_alternative;
Daniel Stenberg
committed
bool expect100header; /* TRUE if we added Expect: 100-continue */
bool pipe_broke; /* TRUE if the connection we were pipelined on broke
and we need to restart from the beginning */
bool cancelled; /* TRUE if the request was cancelled */
#ifndef WIN32
/* do FTP line-end conversions on most platforms */
#define CURL_DO_LINEEND_CONV
/* for FTP downloads: track CRLF sequences that span blocks */
bool prev_block_had_trailing_cr;
/* for FTP downloads: how many CRLFs did we converted to LFs? */
Daniel Stenberg
committed
curl_off_t crlf_conversions;
#endif
/* If set to non-NULL, there's a connection in a shared connection cache
that uses this handle so we can't kill this SessionHandle just yet but
must keep it around and add it to the list of handles to kill once all
its connections are gone */
void *shared_conn;
Daniel Stenberg
committed
bool closed; /* set to TRUE when curl_easy_cleanup() has been called on this
handle, but it is kept around as mentioned for
shared_conn */
Daniel Stenberg
committed
Daniel Stenberg
committed
* This 'DynamicStatic' struct defines dynamic states that actually change
* values in the 'UserDefined' area, which MUST be taken into consideration
* if the UserDefined struct is cloned or similar. You can probably just
* copy these, but each one indicate a special action on other data.
*/
struct DynamicStatic {
char *url; /* work URL, copied from UserDefined */
bool url_alloc; /* URL string is malloc()'ed */
bool url_changed; /* set on CURL_OPT_URL, used to detect if the URL was
changed after the connect phase, as we allow callback
to change it and if so, we reconnect to use the new
URL instead */
Daniel Stenberg
committed
char *referer; /* referer string */
bool referer_alloc; /* referer sting is malloc()ed */
Daniel Stenberg
committed
struct curl_slist *cookielist; /* list of cookie files set by
curl_easy_setopt(COOKIEFILE) calls */
Daniel Stenberg
committed
};
/*
* This 'UserDefined' struct must only contain data that is set once to go
* for many (perhaps) independent connections. Values that are generated or
Daniel Stenberg
committed
* calculated internally for the "session handle" MUST be defined within the
* 'struct UrlState' instead. The only exceptions MUST note the changes in
Daniel Stenberg
committed
* the 'DynamicStatic' struct.
Daniel Stenberg
committed
* Character pointer fields point to dynamic storage, unless otherwise stated.
Daniel Stenberg
committed
struct Curl_one_easy; /* declared and used only in multi.c */
struct Curl_multi; /* declared and used only in multi.c */
Daniel Stenberg
committed
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
enum dupstring {
STRING_CERT, /* client certificate file name */
STRING_CERT_TYPE, /* format for certificate (default: PEM)*/
STRING_COOKIE, /* HTTP cookie string to send */
STRING_COOKIEJAR, /* dump all cookies to this file */
STRING_CUSTOMREQUEST, /* HTTP/FTP request/method to use */
STRING_DEVICE, /* local network interface/address to use */
STRING_ENCODING, /* Accept-Encoding string */
STRING_FTP_ACCOUNT, /* ftp account data */
STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */
STRING_FTPPORT, /* port to send with the FTP PORT command */
STRING_KEY, /* private key file name */
STRING_KEY_PASSWD, /* plain text private key password */
STRING_KEY_TYPE, /* format for private key (default: PEM) */
STRING_KRB_LEVEL, /* krb security level */
STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find
$HOME/.netrc */
STRING_POSTFIELDS, /* if POST, set the fields' values here */
STRING_PROXY, /* proxy to use */
STRING_PROXYUSERPWD, /* Proxy <user:password>, if used */
STRING_SET_RANGE, /* range, if used */
STRING_SET_REFERER, /* custom string for the HTTP referer field */
STRING_SET_URL, /* what original URL to work on */
STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */
STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */
STRING_SSL_CAPATH, /* CA directory name (doesn't work on windows) */
STRING_SSL_CAFILE, /* certificate file to verify peer against */
STRING_SSL_CIPHER_LIST, /* list of ciphers to use */
STRING_SSL_EGDSOCKET, /* path to file containing the EGD daemon socket */
STRING_SSL_RANDOM_FILE, /* path to file containing "random" data */
STRING_USERAGENT, /* User-Agent string */
STRING_USERPWD, /* <user:password>, if used */
/* -- end of strings -- */
STRING_LAST /* not used, just an end-of-list marker */
};
Daniel Stenberg
committed
struct UserDefined {
FILE *err; /* the stderr user data goes here */
void *debugdata; /* the data that will be passed to fdebug */
Daniel Stenberg
committed
char *errorbuffer; /* (Static) store failure messages in here */
long proxyport; /* If non-zero, use this port number by default. If the
proxy string features a ":[port]" that one will override
void *out; /* the fetched file goes here */
void *in; /* the uploaded file is read from here */
void *writeheader; /* write the header to this if non-NULL */
Daniel Stenberg
committed
long use_port; /* which port to use (when not using default) */
long httpauth; /* what kind of HTTP authentication to use (bitmask) */
long proxyauth; /* what kind of proxy authentication to use (bitmask) */
Daniel Stenberg
committed
long followlocation; /* as in HTTP Location: */
long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
for infinity */
bool free_referer; /* set TRUE if 'referer' points to a string we
allocated */
curl_off_t postfieldsize; /* if POST, this might have a size to use instead
of strlen(), and then the data *may* be binary
(contain zero bytes) */
Daniel Stenberg
committed
unsigned short localport; /* local port number to bind to */
int localportrange; /* number of additional port numbers to test in case the
'localport' one can't be bind()ed */
curl_write_callback fwrite_func; /* function that stores the output */
Daniel Stenberg
committed
curl_write_callback fwrite_header; /* function that stores headers */
curl_read_callback fread_func; /* function that reads the input */
Daniel Stenberg
committed
curl_progress_callback fprogress; /* function for progress information */
curl_debug_callback fdebug; /* function that write informational data */
curl_ioctl_callback ioctl_func; /* function for I/O control */
curl_sockopt_callback fsockopt; /* function for setting socket options */
void *sockopt_client; /* pointer to pass to the socket options callback */
/* the 3 curl_conv_callback functions below are used on non-ASCII hosts */
/* function to convert from the network encoding: */
curl_conv_callback convfromnetwork;
/* function to convert to the network encoding: */
curl_conv_callback convtonetwork;
/* function to convert from UTF-8 encoding: */
curl_conv_callback convfromutf8;
void *progress_client; /* pointer to pass to the progress callback */
void *ioctl_client; /* pointer to pass to the ioctl callback */
Daniel Stenberg
committed
long timeout; /* in milliseconds, 0 means no timeout */
long connecttimeout; /* in milliseconds, 0 means no timeout */
long ftp_response_timeout; /* in milliseconds, 0 means no timeout */
curl_off_t infilesize; /* size of file to upload, -1 means unknown */
long low_speed_limit; /* bytes/second */
long low_speed_time; /* number of seconds */
curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */
curl_off_t max_recv_speed; /* high speed limit in bytes/second for download */
curl_off_t set_resume_from; /* continue [ftp] transfer from here */
struct curl_slist *headers; /* linked list of extra headers */
struct curl_httppost *httppost; /* linked list of POST data */
bool cookiesession; /* new cookie session? */
Daniel Stenberg
committed
bool crlf; /* convert crlf on ftp upload(?) */
struct curl_slist *quote; /* after connection is established */
struct curl_slist *postquote; /* after the transfer */
struct curl_slist *prequote; /* before the transfer, after type */
struct curl_slist *source_quote; /* 3rd party quote */
struct curl_slist *source_prequote; /* in 3rd party transfer mode - before
the transfer on source host */
struct curl_slist *source_postquote; /* in 3rd party transfer mode - after
the transfer on source host */
struct curl_slist *telnet_options; /* linked list of telnet options */
curl_TimeCond timecondition; /* kind of time/date comparison */
time_t timevalue; /* what time to compare with */
Daniel Stenberg
committed
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
long httpversion; /* when non-zero, a specific HTTP version requested to
be used in the library's request(s) */
Daniel Stenberg
committed
struct ssl_config_data ssl; /* user defined SSL stuff */
Daniel Stenberg
committed
curl_proxytype proxytype; /* what kind of proxy that is in use */
long dns_cache_timeout; /* DNS cache timeout */
long buffer_size; /* size of receive buffer to use */
Daniel Stenberg
committed
Daniel Stenberg
committed
void *private_data; /* Private data */
Daniel Stenberg
committed
struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi
handle, an internal 'Curl_one_easy'
struct is created and this is a pointer
to the particular struct associated with
this SessionHandle */
struct curl_slist *http200aliases; /* linked list of aliases for http200 */
long ip_version;
curl_off_t max_filesize; /* Maximum file size to download */
curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used */
Daniel Stenberg
committed
/* Here follows boolean settings that define how to behave during
this session. They are STATIC, set by libcurl users or at least initially
and they don't change during operations. */
bool printhost; /* printing host name in debug info */
Daniel Stenberg
committed
bool get_filetime;
bool tunnel_thru_httpproxy;
Daniel Stenberg
committed
bool prefer_ascii; /* ASCII rather than binary */
Daniel Stenberg
committed
bool ftp_append;
bool ftp_list_only;
bool ftp_create_missing_dirs;
Daniel Stenberg
committed
bool ftp_use_port;
bool hide_progress;
bool http_fail_on_error;
bool http_follow_location;
bool http_disable_hostname_check_before_authentication;
bool include_header; /* include received protocol headers in data output */
Daniel Stenberg
committed
bool http_set_referer;
bool http_auto_referer; /* set "correct" referer when following location: */
Daniel Stenberg
committed
bool opt_no_body; /* as set with CURLOPT_NO_BODY */
Daniel Stenberg
committed
bool set_port;
bool upload;
enum CURL_NETRC_OPTION
use_netrc; /* defined in include/curl.h */
Daniel Stenberg
committed
bool verbose;
bool krb; /* kerberos connection requested */
Daniel Stenberg
committed
bool reuse_forbid; /* forbidden to be reused, close after use */
bool reuse_fresh; /* do not re-use an existing connection */
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
bool ftp_use_eprt; /* if EPRT is to be attempted or not */
Daniel Stenberg
committed
Daniel Stenberg
committed
curl_ftpssl ftp_ssl; /* if AUTH TLS is to be attempted etc */
curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
Linus Nielsen
committed
curl_ftpccc ftp_ccc; /* FTP CCC options */
bool no_signal; /* do not use any signal/alarm handler */
Daniel Stenberg
committed
bool global_dns_cache; /* subject for future removal */
bool tcp_nodelay; /* whether to enable TCP_NODELAY or not */
Daniel Stenberg
committed
bool ignorecl; /* ignore content length */
bool ftp_skip_ip; /* skip the IP address the FTP server passes on to
us */
Daniel Stenberg
committed
bool connect_only; /* make connection, let application use the socket */
long ssh_auth_types; /* allowed SSH auth types */
Daniel Stenberg
committed
bool http_te_skip; /* pass the raw body data to the user, even when
transfer-encoded (chunked, compressed) */
bool http_ce_skip; /* pass the raw body data to the user, even when
content-encoded (chunked, compressed) */
long new_file_perms; /* Permissions to use when creating remote files */
long new_directory_perms; /* Permissions to use when creating remote dirs */
Daniel Stenberg
committed
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
Daniel Stenberg
committed
};
Daniel Stenberg
committed
struct Names {
struct curl_hash *hostcache;
enum {
HCACHE_NONE, /* not pointing to anything */
HCACHE_PRIVATE, /* points to our own */
HCACHE_GLOBAL, /* points to the (shrug) global one */
HCACHE_MULTI, /* points to a shared one in the multi handle */
HCACHE_SHARED /* points to a shared one in a shared object */
} hostcachetype;
};
Daniel Stenberg
committed
/*
Daniel Stenberg
committed
* The 'connectdata' struct MUST have all the connection oriented stuff as we
* may have several simultaneous connections and connection structs in memory.
Daniel Stenberg
committed
*
Daniel Stenberg
committed
* The 'struct UserDefined' must only contain data that is set once to go for
* many (perhaps) independent connections. Values that are generated or
Daniel Stenberg
committed
* calculated internally for the "session handle" must be defined within the
Daniel Stenberg
committed
* 'struct UrlState' instead.
*/
Daniel Stenberg
committed
struct SessionHandle {
Daniel Stenberg
committed
struct Names dns;
Daniel Stenberg
committed
struct Curl_multi *multi; /* if non-NULL, points to the multi handle
struct to which this "belongs" */
Daniel Stenberg
committed
struct Curl_one_easy *multi_pos; /* if non-NULL, points to the its position
in multi controlling structure to assist
in removal. */
struct Curl_share *share; /* Share, handles global variable mutexing */
struct HandleData reqdata; /* Request-specific data */
Daniel Stenberg
committed
struct UserDefined set; /* values set by the libcurl user */
struct DynamicStatic change; /* possibly modified userdefined data */
struct CookieInfo *cookies; /* the cookies, read from files and servers */
struct Progress progress; /* for all the progress meter data */
struct UrlState state; /* struct for fields used for state info and
other dynamic purposes */
struct PureInfo info; /* stats, reports and info data */
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
iconv_t outbound_cd; /* for translating to the network encoding */
iconv_t inbound_cd; /* for translating from the network encoding */
iconv_t utf8_cd; /* for translating to UTF8 */
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
unsigned int magic; /* set to a CURLEASY_MAGIC_NUMBER */
};
#define LIBCURL_NAME "libcurl"
#endif