7
7
* | (__| |_| | _ <| |___
8
8
* \___|\___/|_| \_\_____|
10
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
10
* Copyright (C) 1998 - 2008, 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.354 2007-10-24 21:09:59 bagder Exp $
23
* $Id: urldata.h,v 1.372 2008-01-21 23:48:58 bagder Exp $
24
24
***************************************************************************/
26
26
/* This file is for lib internal stuff */
467
471
SSH_SFTP_READDIR_BOTTOM,
468
472
SSH_SFTP_READDIR_DONE,
469
473
SSH_SFTP_DOWNLOAD_INIT,
470
SSH_SFTP_DOWNLOAD_STAT,
474
SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
475
SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
476
SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
477
SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
474
478
SSH_SCP_UPLOAD_INIT,
475
479
SSH_SCP_DOWNLOAD_INIT,
477
481
SSH_SCP_SEND_EOF,
478
482
SSH_SCP_WAIT_EOF,
479
483
SSH_SCP_WAIT_CLOSE,
480
SSH_SCP_CHANNEL_FREE,
482
SSH_SESSION_DISCONECT,
484
SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
485
SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
486
SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
485
488
SSH_LAST /* never used */
491
/* this struct is used in the HandleData struct which is part of the
492
SessionHandle, which means this is used on a per-easy handle basis.
493
Everything that is strictly related to a connection is banned from this
488
495
struct SSHPROTO {
489
curl_off_t *bytecountp;
492
496
char *path; /* the path we operate on */
496
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
497
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
498
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
499
LIBSSH2_SFTP_HANDLE *sftp_handle;
500
#endif /* USE_LIBSSH2 */
503
499
/* ssh_conn is used for struct connection-oriented data in the connectdata
505
501
struct ssh_conn {
506
const char *authlist; /* List of auth. methods, managed by libssh2 */
502
const char *authlist; /* List of auth. methods, managed by libssh2 */
507
503
#ifdef USE_LIBSSH2
508
const char *passphrase;
512
sshstate state; /* always use ssh.c:state() to change state! */
513
sshstate nextState; /* the state to goto after stopping */
514
CURLcode actualCode; /* the actual error code */
515
struct curl_slist *quote_item;
504
const char *passphrase; /* passphrase to use */
505
char *rsa_pub; /* path name */
506
char *rsa; /* path name */
507
bool authed; /* the connection has been authenticated fine */
508
sshstate state; /* always use ssh.c:state() to change state! */
509
sshstate nextstate; /* the state to goto after stopping */
510
CURLcode actualcode; /* the actual error code */
511
struct curl_slist *quote_item; /* for the quote option */
512
char *quote_path1; /* two generic pointers for the QUOTE stuff */
517
513
char *quote_path2;
518
LIBSSH2_SFTP_ATTRIBUTES quote_attrs;
514
LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
515
char *homedir; /* when doing SFTP we figure out home dir in the
518
/* Here's a set of struct members used by the SFTP_READDIR state */
519
519
LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
520
520
char *readdir_filename;
521
521
char *readdir_longentry;
522
522
int readdir_len, readdir_totalLen, readdir_currLen;
523
523
char *readdir_line;
524
524
char *readdir_linkPath;
525
int secondCreateDirs;
525
/* end of READDIR stuff */
527
int secondCreateDirs; /* counter use by the code to see if the
528
second attempt has been made to change
529
to/create a directory */
530
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
531
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
532
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
533
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
534
LIBSSH2_SFTP_HANDLE *sftp_handle;
527
535
#endif /* USE_LIBSSH2 */
626
634
#define KEEP_NONE 0
627
#define KEEP_READ 1 /* there is or may be data to read */
628
#define KEEP_WRITE 2 /* there is or may be data to write */
629
#define KEEP_READ_HOLD 4 /* when set, no reading should be done but there
630
might still be data to read */
631
#define KEEP_WRITE_HOLD 8 /* when set, no writing should be done but there
632
might still be data to write */
635
#define KEEP_READ (1<<0) /* there is or may be data to read */
636
#define KEEP_WRITE (1<<1) /* there is or may be data to write */
637
#define KEEP_READ_HOLD (1<<2) /* when set, no reading should be done but there
638
might still be data to read */
639
#define KEEP_WRITE_HOLD (1<<3) /* when set, no writing should be done but there
640
might still be data to write */
641
#define KEEP_READ_PAUSE (1<<4) /* reading is paused */
642
#define KEEP_WRITE_PAUSE (1<<5) /* writing is paused */
644
#define KEEP_READBITS (KEEP_READ | KEEP_READ_HOLD | KEEP_READ_PAUSE)
645
#define KEEP_WRITEBITS (KEEP_WRITE | KEEP_WRITE_HOLD | KEEP_WRITE_PAUSE)
658
#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
659
defined(USE_THREADING_GETADDRINFO)
663
struct Curl_dns_entry *dns;
664
bool done; /* set TRUE when the lookup is complete */
665
int status; /* if done is TRUE, this is the status from the callback */
666
void *os_specific; /* 'struct thread_data' for Windows */
670
#define FIRSTSOCKET 0
671
#define SECONDARYSOCKET 1
673
/* These function pointer types are here only to allow easier typecasting
674
within the source when we need to cast between data pointers (such as NULL)
675
and function pointers. */
676
typedef CURLcode (*Curl_do_more_func)(struct connectdata *);
677
typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool);
645
* This struct is all the previously local variables from Curl_perform() moved
646
* to struct to allow the function to return and get re-invoked better without
681
* Request specific data in the easy handle (SessionHandle). Previously,
682
* these members were on the connectdata struct but since a conn struct may
683
* now be shared between different SessionHandles, we store connection-specifc
684
* data here. This struct only keeps stuff that's interesting for *this*
685
* request, as it will be cleared between multiple ones
650
struct Curl_transfer_keeper {
652
/** Values copied over from the HandleData struct each time on init **/
687
struct SingleRequest {
654
688
curl_off_t size; /* -1 if unknown at this point */
655
689
curl_off_t *bytecountp; /* return number of bytes read or NULL */
658
692
-1 means unlimited */
659
693
curl_off_t *writebytecountp; /* return number of bytes written or NULL */
661
/** End of HandleData struct copies **/
663
695
curl_off_t bytecount; /* total number of bytes read */
664
696
curl_off_t writebytecount; /* number of bytes written */
666
long headerbytecount; /* only count received headers */
698
long headerbytecount; /* only count received headers */
667
699
long deductheadercount; /* this amount of bytes doesn't count when we check
668
if anything has been transfered at the end of
669
a connection. We use this counter to make only
670
a 100 reply (without a following second response
671
code) result in a CURLE_GOT_NOTHING error code */
700
if anything has been transfered at the end of a
701
connection. We use this counter to make only a
702
100 reply (without a following second response
703
code) result in a CURLE_GOT_NOTHING error code */
673
705
struct timeval start; /* transfer started at this time */
674
706
struct timeval now; /* current time */
728
760
bool ignorebody; /* we read a response-body but we ignore it! */
729
761
bool ignorecl; /* This HTTP response has no body so we ignore the Content-
730
762
Length: header */
733
#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
734
defined(USE_THREADING_GETADDRINFO)
738
struct Curl_dns_entry *dns;
739
bool done; /* set TRUE when the lookup is complete */
740
int status; /* if done is TRUE, this is the status from the callback */
741
void *os_specific; /* 'struct thread_data' for Windows */
745
#define FIRSTSOCKET 0
746
#define SECONDARYSOCKET 1
748
/* These function pointer types are here only to allow easier typecasting
749
within the source when we need to cast between data pointers (such as NULL)
750
and function pointers. */
751
typedef CURLcode (*Curl_do_more_func)(struct connectdata *);
752
typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool);
756
* Store's request specific data in the easy handle (SessionHandle).
757
* Previously, these members were on the connectdata struct but since
758
* a conn struct may now be shared between different SessionHandles,
759
* we store connection-specifc data here.
763
char *pathbuffer;/* allocated buffer to store the URL's path part in */
764
char *path; /* path to use, points to somewhere within the pathbuffer
767
764
char *newurl; /* This can only be set if a Location: was in the
768
765
document headers */
770
/* This struct is inited when needed */
771
struct Curl_transfer_keeper keep;
773
767
/* 'upload_present' is used to keep a byte counter of how much data there is
774
768
still left in the buffer, aimed for upload. */
775
769
ssize_t upload_present;
779
773
and the 'upload_present' contains the number of bytes available at this
781
775
char *upload_fromhere;
783
curl_off_t size; /* -1 if unknown at this point */
784
curl_off_t *bytecountp; /* return number of bytes read or NULL */
786
curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch, -1
788
curl_off_t *writebytecountp; /* return number of bytes written or NULL */
791
bool rangestringalloc; /* the range string is malloc()'ed */
793
char *range; /* range, if used. See README for detailed specification on
795
curl_off_t resume_from; /* continue [ftp] transfer from here */
797
/* Protocol specific data.
799
*************************************************************************
800
* Note that this data will be REMOVED after each request, so anything that
801
* should be kept/stored on a per-connection basis and thus live for the
802
* next requst on the same connection MUST be put in the connectdata struct!
803
*************************************************************************/
806
struct HTTP *https; /* alias, just for the sake of being more readable */
808
void *tftp; /* private for tftp.c-eyes only */
809
struct FILEPROTO *file;
810
void *telnet; /* private for telnet.c-eyes only */
812
struct SSHPROTO *ssh;
814
/* current user of this HandleData instance, or NULL */
815
struct connectdata *current_conn;
992
952
bool writechannel_inuse; /* whether the write channel is in use by an easy
994
954
bool is_in_pipeline; /* TRUE if this connection is in a pipeline */
955
bool server_supports_pipelining; /* TRUE if server supports pipelining,
956
set after first response */
996
958
struct curl_llist *send_pipe; /* List of handles waiting to
997
959
send on this pipeline */
998
960
struct curl_llist *recv_pipe; /* List of handles waiting to read
999
961
their responses on this pipeline */
962
struct curl_llist *pend_pipe; /* List of pending handles on
964
#define MAX_PIPELINE_LENGTH 5
1001
966
char* master_buffer; /* The master buffer allocated on-demand;
1002
967
used for pipelining. */
1175
1143
following not keep sending user+password... This is
1179
1146
struct curl_ssl_session *session; /* array of 'numsessions' size */
1180
1147
long sessionage; /* number of the most recent session */
1148
char *tempwrite; /* allocated buffer to keep data in when a write
1149
callback returns to make the connection paused */
1150
size_t tempwritesize; /* size of the 'tempwrite' allocated buffer */
1151
int tempwritetype; /* type of the 'tempwrite' buffer as a bitmask that is
1152
used with Curl_client_write() */
1182
1153
char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */
1183
1154
bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
1184
1155
This must be set to FALSE every time _easy_perform() is
1191
1162
bool allow_port; /* Is set.use_port allowed to take effect or not. This
1192
1163
is always set TRUE when curl_easy_perform() is called. */
1194
struct digestdata digest;
1195
struct digestdata proxydigest;
1164
struct digestdata digest; /* state data for host Digest auth */
1165
struct digestdata proxydigest; /* state data for proxy Digest auth */
1197
1167
#ifdef HAVE_GSSAPI
1198
struct negotiatedata negotiate;
1168
struct negotiatedata negotiate; /* state data for host Negotiate auth */
1169
struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */
1201
struct auth authhost;
1202
struct auth authproxy;
1172
struct auth authhost; /* auth details for host */
1173
struct auth authproxy; /* auth details for proxy */
1204
1175
bool authproblem; /* TRUE if there's some problem authenticating */
1241
1211
bool closed; /* set to TRUE when curl_easy_cleanup() has been called on this
1242
1212
handle, but it is kept around as mentioned for
1214
char *pathbuffer;/* allocated buffer to store the URL's path part in */
1215
char *path; /* path to use, points to somewhere within the pathbuffer
1219
bool rangestringalloc; /* the range string is malloc()'ed */
1221
char *range; /* range, if used. See README for detailed specification on
1223
curl_off_t resume_from; /* continue [ftp] transfer from here */
1225
/* Protocol specific data.
1227
*************************************************************************
1228
* Note that this data will be REMOVED after each request, so anything that
1229
* should be kept/stored on a per-connection basis and thus live for the
1230
* next requst on the same connection MUST be put in the connectdata struct!
1231
*************************************************************************/
1234
struct HTTP *https; /* alias, just for the sake of being more readable */
1236
void *tftp; /* private for tftp.c-eyes only */
1237
struct FILEPROTO *file;
1238
void *telnet; /* private for telnet.c-eyes only */
1240
struct SSHPROTO *ssh;
1242
/* current user of this SessionHandle instance, or NULL */
1243
struct connectdata *current_conn;
1329
1329
long followlocation; /* as in HTTP Location: */
1330
1330
long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
1331
1331
for infinity */
1332
bool post301; /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a 301 */
1332
bool post301; /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a
1333
1334
bool free_referer; /* set TRUE if 'referer' points to a string we
1335
1336
void *postfields; /* if POST, set the fields' values here */
1337
curl_seek_callback seek_func; /* function that seeks the input */
1336
1338
curl_off_t postfieldsize; /* if POST, this might have a size to use instead
1337
1339
of strlen(), and then the data *may* be binary
1338
1340
(contain zero bytes) */
1389
1392
long httpversion; /* when non-zero, a specific HTTP version requested to
1390
1393
be used in the library's request(s) */
1391
1394
struct ssl_config_data ssl; /* user defined SSL stuff */
1393
1395
curl_proxytype proxytype; /* what kind of proxy that is in use */
1395
1396
long dns_cache_timeout; /* DNS cache timeout */
1396
1397
long buffer_size; /* size of receive buffer to use */
1398
void *private_data; /* Private data */
1398
void *private_data; /* application-private data */
1400
1400
struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi
1401
1401
handle, an internal 'Curl_one_easy'
1415
1416
this session. They are STATIC, set by libcurl users or at least initially
1416
1417
and they don't change during operations. */
1418
bool printhost; /* printing host name in debug info */
1420
bool tunnel_thru_httpproxy;
1421
bool prefer_ascii; /* ASCII rather than binary */
1424
bool ftp_create_missing_dirs;
1427
bool http_fail_on_error;
1428
bool http_follow_location;
1419
bool printhost; /* printing host name in debug info */
1420
bool get_filetime; /* get the time and get of the remote file */
1421
bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */
1422
bool prefer_ascii; /* ASCII rather than binary */
1423
bool ftp_append; /* append, not overwrite, on upload */
1424
bool ftp_list_only; /* switch FTP command for listing directories */
1425
bool ftp_create_missing_dirs; /* create directories that don't exist */
1426
bool ftp_use_port; /* use the FTP PORT command */
1427
bool hide_progress; /* don't use the progress meter */
1428
bool http_fail_on_error; /* fail on HTTP error codes >= 300 */
1429
bool http_follow_location; /* follow HTTP redirects */
1429
1430
bool http_disable_hostname_check_before_authentication;
1430
1431
bool include_header; /* include received protocol headers in data output */
1431
bool http_set_referer;
1432
bool http_set_referer; /* is a custom referer used */
1432
1433
bool http_auto_referer; /* set "correct" referer when following location: */
1433
1434
bool opt_no_body; /* as set with CURLOPT_NO_BODY */
1435
bool set_port; /* custom port number used */
1436
bool upload; /* upload request */
1436
1437
enum CURL_NETRC_OPTION
1437
1438
use_netrc; /* defined in include/curl.h */
1439
bool verbose; /* output verbosity */
1439
1440
bool krb; /* kerberos connection requested */
1440
1441
bool reuse_forbid; /* forbidden to be reused, close after use */
1441
1442
bool reuse_fresh; /* do not re-use an existing connection */
1492
1494
in multi controlling structure to assist
1494
1496
struct Curl_share *share; /* Share, handles global variable mutexing */
1495
struct HandleData reqdata; /* Request-specific data */
1497
struct SingleRequest req; /* Request-specific data */
1496
1498
struct UserDefined set; /* values set by the libcurl user */
1497
1499
struct DynamicStatic change; /* possibly modified userdefined data */
1499
struct CookieInfo *cookies; /* the cookies, read from files and servers */
1500
struct CookieInfo *cookies; /* the cookies, read from files and servers.
1501
NOTE that the 'cookie' field in the
1502
UserDefined struct defines if the "engine"
1503
is to be used or not. */
1500
1504
struct Progress progress; /* for all the progress meter data */
1501
1505
struct UrlState state; /* struct for fields used for state info and
1502
1506
other dynamic purposes */