CURLOPT_FTP_USE_EPSV can now be set to FALSE to prevent libcurl from

attempting to use EPSV before the standard PASV.
This commit is contained in:
Daniel Stenberg 2001-11-28 23:20:14 +00:00
Родитель cfdcf5c933
Коммит 332eb7651a
3 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -812,7 +812,7 @@ ftp_pasv_verbose(struct connectdata *conn,
#ifdef HAVE_INET_NTOA_R
char ntoa_buf[64];
#endif
char hostent_buf[8192];
char hostent_buf[9000];
#if defined(HAVE_INET_ADDR)
in_addr_t address;
@ -824,12 +824,19 @@ ftp_pasv_verbose(struct connectdata *conn,
# ifdef HAVE_GETHOSTBYADDR_R
# ifdef HAVE_GETHOSTBYADDR_R_5
/* AIX, Digital Unix style:
/* AIX, Digital Unix (OSF1, Tru64) style:
extern int gethostbyaddr_r(char *addr, size_t len, int type,
struct hostent *htent, struct hostent_data *ht_data); */
/* Fred Noz helped me try this out, now it at least compiles! */
/* Bjorn Reese (November 28 2001):
The Tru64 man page on gethostbyaddr_r() says that
the hostent struct must be filled with zeroes before the call to
gethostbyaddr_r(). */
memset(hostent_buf, 0, sizeof(struct hostent));
if(gethostbyaddr_r((char *) &address,
sizeof(address), AF_INET,
(struct hostent *)hostent_buf,
@ -1297,7 +1304,8 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
char newhost[48];
char *newhostp=NULL;
for (modeoff = 0; mode[modeoff]; modeoff++) {
for (modeoff = (data->set.ftp_use_epsv?0:1);
mode[modeoff]; modeoff++) {
result = Curl_ftpsendf(conn, mode[modeoff]);
if(result)
return result;

Просмотреть файл

@ -245,6 +245,7 @@ CURLcode Curl_open(struct SessionHandle **curl)
data->state.current_speed = -1; /* init to negative == impossible */
data->set.httpreq = HTTPREQ_GET; /* Default HTTP request */
data->set.ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
/* make libcurl quiet by default: */
data->set.hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */
@ -523,6 +524,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.ftpport = va_arg(param, char *);
data->set.ftp_use_port = data->set.ftpport?1:0;
break;
case CURLOPT_FTP_USE_EPSV:
data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
break;
case CURLOPT_HTTPHEADER:
/*
* Set a list with HTTP headers to use (or replace internals with)

Просмотреть файл

@ -567,6 +567,7 @@ struct UserDefined {
bool reuse_forbid; /* forbidden to be reused, close after use */
bool reuse_fresh; /* do not re-use an existing connection */
bool expect100header; /* TRUE if we added Expect: 100-continue */
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
};
/*