320
/****************************************************************************
322
***************************************************************************/
324
struct FormData *sendit;
325
curl_off_t postsize; /* off_t to handle large file sizes */
326
const char *postdata;
328
const char *p_pragma; /* Pragma: string */
329
const char *p_accept; /* Accept: string */
330
curl_off_t readbytecount;
331
curl_off_t writebytecount;
333
/* For FORM posting */
337
curl_read_callback fread_func; /* backup storage for fread pointer */
338
void *fread_in; /* backup storage for fread_in pointer */
339
const char *postdata;
344
HTTPSEND_NADA, /* init */
345
HTTPSEND_REQUEST, /* sending a request */
346
HTTPSEND_BODY, /* sending body */
347
HTTPSEND_LAST /* never use this */
350
void *send_buffer; /* used if the request couldn't be sent in one chunk,
351
points to an allocated send_buffer struct */
354
/****************************************************************************
356
***************************************************************************/
358
FTP_STOP, /* do nothing state, stops the state machine */
359
FTP_WAIT220, /* waiting for the initial 220 response immediately after
371
FTP_QUOTE, /* waiting for a response to a command sent in a quote list */
375
FTP_CWD, /* change dir */
376
FTP_MKD, /* if the dir didn't exist */
377
FTP_MDTM, /* to figure out the datestamp */
378
FTP_TYPE, /* to set type when doing a head-like request */
379
FTP_LIST_TYPE, /* set type when about to do a dir list */
380
FTP_RETR_TYPE, /* set type when about to RETR a file */
381
FTP_STOR_TYPE, /* set type when about to STOR a file */
382
FTP_SIZE, /* get the remote file's size for head-like request */
383
FTP_RETR_SIZE, /* get the remote file's size for RETR */
384
FTP_STOR_SIZE, /* get the size for (resumed) STOR */
385
FTP_REST, /* when used to check if the server supports it in head-like */
386
FTP_RETR_REST, /* when asking for "resume" in for RETR */
387
FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */
388
FTP_PASV, /* generic state for PASV and EPSV, check count1 */
389
FTP_LIST, /* generic state for LIST, NLST or a custom list command */
391
FTP_STOR, /* generic state for STOR and APPE */
393
FTP_LAST /* never used */
397
FTPFILE_MULTICWD = 1, /* as defined by RFC1738 */
398
FTPFILE_NOCWD = 2, /* use SIZE / RETR / STOR on the full path */
399
FTPFILE_SINGLECWD = 3 /* make one CWD, then SIZE / RETR / STOR on the file */
403
FTPTRANSFER_BODY, /* yes do transfer a body */
404
FTPTRANSFER_INFO, /* do still go through to get info/headers */
405
FTPTRANSFER_NONE, /* don't get anything and don't get info */
406
FTPTRANSFER_LAST /* end of list marker, never used */
409
/* This FTP struct is used in the SessionHandle. All FTP data that is
410
connection-oriented must be in FTP_conn to properly deal with the fact that
411
perhaps the SessionHandle is changed between the times the connection is
414
curl_off_t *bytecountp;
415
char *user; /* user name string */
416
char *passwd; /* password string */
418
/* transfer a file/body or not, done as a typedefed enum just to make
419
debuggers display the full symbol and not just the numerical value */
420
curl_ftptransfer transfer;
421
curl_off_t downloadsize;
424
/* ftp_conn is used for struct connection-oriented data in the connectdata
427
char *entrypath; /* the PWD reply when we logged on */
428
char **dirs; /* realloc()ed array for path components */
429
int dirdepth; /* number of entries used in the 'dirs' array */
430
int diralloc; /* number of entries allocated for the 'dirs' array */
431
char *file; /* decoded file */
432
char *cache; /* data cache between getresponse()-calls */
433
curl_off_t cache_size; /* size of cache in bytes */
434
bool dont_check; /* Set to TRUE to prevent the final (post-transfer)
435
file size and 226/250 status check. It should still
436
read the line, just ignore the result. */
437
long response_time; /* When no timeout is given, this is the amount of
438
seconds we await for an FTP response. Initialized
439
in Curl_ftp_connect() */
440
bool ctl_valid; /* Tells Curl_ftp_quit() whether or not to do anything. If
441
the connection has timed out or been closed, this
442
should be FALSE when it gets to Curl_ftp_quit() */
443
bool cwddone; /* if it has been determined that the proper CWD combo
444
already has been done */
445
bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent
446
caching the current directory */
447
char *prevpath; /* conn->path from the previous transfer */
448
char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a
449
and others (A/I or zero) */
450
size_t nread_resp; /* number of bytes currently read of a server response */
451
char *linestart_resp; /* line start pointer for the FTP server response
453
bool pending_resp; /* set TRUE when a server response is pending or in
454
progress, and is cleared once the last response is
457
int count1; /* general purpose counter for the state machine */
458
int count2; /* general purpose counter for the state machine */
459
int count3; /* general purpose counter for the state machine */
460
char *sendthis; /* allocated pointer to a buffer that is to be sent to the
462
size_t sendleft; /* number of bytes left to send from the sendthis buffer */
463
size_t sendsize; /* total size of the sendthis buffer */
464
struct timeval response; /* set to Curl_tvnow() when a command has been sent
465
off, used to time-out response reading */
466
ftpstate state; /* always use ftp.c:state() to change state! */
467
char * server_os; /* The target server operating system. */
470
/****************************************************************************
472
***************************************************************************/
474
SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */
475
SSH_STOP = 0, /* do nothing state, stops the state machine */
477
SSH_S_STARTUP, /* Session startup, First state in SSH-CONNECT */
478
SSH_HOSTKEY, /* verify hostkey */
490
SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */
492
SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */
493
SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */
497
SSH_SFTP_QUOTE_SETSTAT,
498
SSH_SFTP_QUOTE_SYMLINK,
499
SSH_SFTP_QUOTE_MKDIR,
500
SSH_SFTP_QUOTE_RENAME,
501
SSH_SFTP_QUOTE_RMDIR,
502
SSH_SFTP_QUOTE_UNLINK,
504
SSH_SFTP_UPLOAD_INIT,
505
SSH_SFTP_CREATE_DIRS_INIT,
506
SSH_SFTP_CREATE_DIRS,
507
SSH_SFTP_CREATE_DIRS_MKDIR,
508
SSH_SFTP_READDIR_INIT,
510
SSH_SFTP_READDIR_LINK,
511
SSH_SFTP_READDIR_BOTTOM,
512
SSH_SFTP_READDIR_DONE,
513
SSH_SFTP_DOWNLOAD_INIT,
514
SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
515
SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
516
SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
517
SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
519
SSH_SCP_DOWNLOAD_INIT,
524
SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
525
SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
526
SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
528
SSH_LAST /* never used */
531
/* this struct is used in the HandleData struct which is part of the
532
SessionHandle, which means this is used on a per-easy handle basis.
533
Everything that is strictly related to a connection is banned from this
536
char *path; /* the path we operate on */
539
/* ssh_conn is used for struct connection-oriented data in the connectdata
542
const char *authlist; /* List of auth. methods, managed by libssh2 */
544
const char *passphrase; /* pass-phrase to use */
545
char *rsa_pub; /* path name */
546
char *rsa; /* path name */
547
bool authed; /* the connection has been authenticated fine */
548
sshstate state; /* always use ssh.c:state() to change state! */
549
sshstate nextstate; /* the state to goto after stopping */
550
CURLcode actualcode; /* the actual error code */
551
struct curl_slist *quote_item; /* for the quote option */
552
char *quote_path1; /* two generic pointers for the QUOTE stuff */
554
LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
555
char *homedir; /* when doing SFTP we figure out home dir in the
558
/* Here's a set of struct members used by the SFTP_READDIR state */
559
LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
560
char *readdir_filename;
561
char *readdir_longentry;
562
int readdir_len, readdir_totalLen, readdir_currLen;
564
char *readdir_linkPath;
565
/* end of READDIR stuff */
567
int secondCreateDirs; /* counter use by the code to see if the
568
second attempt has been made to change
569
to/create a directory */
570
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
571
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
572
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
573
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
574
LIBSSH2_SFTP_HANDLE *sftp_handle;
575
int orig_waitfor; /* default READ/WRITE bits wait for */
577
/* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h
579
#ifdef HAVE_LIBSSH2_KNOWNHOST_API
580
LIBSSH2_KNOWNHOSTS *kh;
582
#endif /* USE_LIBSSH2 */
586
/****************************************************************************
588
***************************************************************************/
590
char *path; /* the path we operate on */
591
char *freepath; /* pointer to the allocated block we must free, this might
592
differ from the 'path' pointer */
593
int fd; /* open file descriptor to read from! */
597
362
* Boolean values that concerns this connection.