mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Michal Marek introduced CURLOPT_PROXY_TRANSFER_MODE which is used to control
the appending of the "type=" thing on FTP URLs when they are passed to a HTTP proxy. Some proxies just don't like that appending (which is done unconditionally in 7.17.1), and some proxies treat binary/ascii transfers better with the appending done!
This commit is contained in:
parent
380ed8bebf
commit
1c93e75375
7
CHANGES
7
CHANGES
@ -7,6 +7,13 @@
|
||||
Changelog
|
||||
|
||||
|
||||
Daniel S (3 Dec 2007)
|
||||
- Michal Marek introduced CURLOPT_PROXY_TRANSFER_MODE which is used to control
|
||||
the appending of the "type=" thing on FTP URLs when they are passed to a
|
||||
HTTP proxy. Some proxies just don't like that appending (which is done
|
||||
unconditionally in 7.17.1), and some proxies treat binary/ascii transfers
|
||||
better with the appending done!
|
||||
|
||||
Daniel S (29 Nov 2007)
|
||||
- A bug report on the curl-library list showed a HTTP Digest session going on
|
||||
with a 700+ letter nonce. Previously libcurl only support 127 letter ones
|
||||
|
@ -2,7 +2,7 @@ Curl and libcurl 7.17.2
|
||||
|
||||
Public curl releases: 103
|
||||
Command line options: 122
|
||||
curl_easy_setopt() options: 147
|
||||
curl_easy_setopt() options: 148
|
||||
Public functions in libcurl: 55
|
||||
Public web site mirrors: 42
|
||||
Known libcurl bindings: 36
|
||||
@ -11,6 +11,7 @@ Curl and libcurl 7.17.2
|
||||
This release includes the following changes:
|
||||
|
||||
o --data-urlencode was added
|
||||
o CURLOPT_PROXY_TRANSFER_MODE was added
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
|
@ -1064,6 +1064,13 @@ or similar.
|
||||
libcurl does not do a complete ASCII conversion when doing ASCII transfers
|
||||
over FTP. This is a known limitation/flaw that nobody has rectified. libcurl
|
||||
simply sets the mode to ascii and performs a standard transfer.
|
||||
.IP CURLOPT_PROXY_TRANSFER_MODE
|
||||
Pass a long. If the value is set to 1 (one), it tells libcurl to set the
|
||||
transfer mode (binary or ASCII) for FTP transfers done via an HTTP proxy, by
|
||||
appending ;type=a or ;type=i to the URL. Without this setting, or it being
|
||||
set to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT\fP has no effect when
|
||||
doing FTP via a proxy. Beware that not all proxies support this feature.
|
||||
(Added in 7.17.2)
|
||||
.IP CURLOPT_CRLF
|
||||
Convert Unix newlines to CRLF newlines on transfers.
|
||||
.IP CURLOPT_RANGE
|
||||
|
@ -1182,6 +1182,9 @@ typedef enum {
|
||||
/* POST volatile input fields. */
|
||||
CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
|
||||
|
||||
/* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
|
||||
CINIT(PROXY_TRANSFER_MODE, LONG, 166),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
|
30
lib/http.c
30
lib/http.c
@ -2122,22 +2122,24 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
}
|
||||
}
|
||||
ppath = data->change.url;
|
||||
/* when doing ftp, append ;type=<a|i> if not present */
|
||||
if(checkprefix("ftp://", ppath) || checkprefix("ftps://", ppath)) {
|
||||
char *p = strstr(ppath, ";type=");
|
||||
if(p && p[6] && p[7] == 0) {
|
||||
switch (toupper((int)((unsigned char)p[6]))) {
|
||||
case 'A':
|
||||
case 'D':
|
||||
case 'I':
|
||||
break;
|
||||
default:
|
||||
p = NULL;
|
||||
if (data->set.proxy_transfer_mode) {
|
||||
/* when doing ftp, append ;type=<a|i> if not present */
|
||||
if(checkprefix("ftp://", ppath) || checkprefix("ftps://", ppath)) {
|
||||
char *p = strstr(ppath, ";type=");
|
||||
if(p && p[6] && p[7] == 0) {
|
||||
switch (toupper((int)((unsigned char)p[6]))) {
|
||||
case 'A':
|
||||
case 'D':
|
||||
case 'I':
|
||||
break;
|
||||
default:
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
if(!p)
|
||||
snprintf(ftp_typecode, sizeof(ftp_typecode), ";type=%c",
|
||||
data->set.prefer_ascii ? 'a' : 'i');
|
||||
}
|
||||
if(!p)
|
||||
snprintf(ftp_typecode, sizeof(ftp_typecode), ";type=%c",
|
||||
data->set.prefer_ascii ? 'a' : 'i');
|
||||
}
|
||||
}
|
||||
if(HTTPREQ_POST_FORM == httpreq) {
|
||||
|
17
lib/url.c
17
lib/url.c
@ -2036,6 +2036,23 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
*/
|
||||
data->set.new_directory_perms = va_arg(param, long);
|
||||
break;
|
||||
case CURLOPT_PROXY_TRANSFER_MODE:
|
||||
/*
|
||||
* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy
|
||||
*/
|
||||
switch (va_arg(param, long)) {
|
||||
case 0:
|
||||
data->set.proxy_transfer_mode = FALSE;
|
||||
break;
|
||||
case 1:
|
||||
data->set.proxy_transfer_mode = TRUE;
|
||||
break;
|
||||
default:
|
||||
/* reserve other values for future use */
|
||||
result = CURLE_FAILED_INIT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* unknown tag and its companion, just ignore: */
|
||||
|
@ -1439,6 +1439,8 @@ struct UserDefined {
|
||||
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 */
|
||||
bool proxy_transfer_mode; /* set transfer mode (;type=<a|i>) when doing FTP
|
||||
via an HTTP proxy */
|
||||
|
||||
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user