mirror of
https://github.com/curl/curl.git
synced 2026-08-25 06:03:32 +03:00
ftp: add 'prefer_ascii' to the transfer state struct
... and make sure the code never updates 'set.prefer_ascii' as it breaks handle reuse which should use the setting as the user specified it. Added test 1569 to verify: it first makes an FTP transfer with ';type=A' and then another without type on the same handle and the second should then use binary. Previously, curl failed this. Closes #6578
This commit is contained in:
parent
0829909ebd
commit
115c9e27f5
9 changed files with 146 additions and 21 deletions
|
|
@ -286,7 +286,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
|||
* <DATA> CRLF
|
||||
*/
|
||||
/* On non-ASCII platforms the <DATA> may or may not be
|
||||
translated based on set.prefer_ascii while the protocol
|
||||
translated based on state.prefer_ascii while the protocol
|
||||
portion must always be translated to the network encoding.
|
||||
To further complicate matters, line end conversion might be
|
||||
done later on, so we need to prevent CRLFs from becoming
|
||||
|
|
@ -301,7 +301,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
|||
|
||||
if(
|
||||
#ifdef CURL_DO_LINEEND_CONV
|
||||
(data->set.prefer_ascii) ||
|
||||
(data->state.prefer_ascii) ||
|
||||
#endif
|
||||
(data->set.crlf)) {
|
||||
/* \n will become \r\n later on */
|
||||
|
|
@ -348,7 +348,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
|||
{
|
||||
CURLcode result;
|
||||
size_t length;
|
||||
if(data->set.prefer_ascii)
|
||||
if(data->state.prefer_ascii)
|
||||
/* translate the protocol and data */
|
||||
length = nread;
|
||||
else
|
||||
|
|
@ -389,7 +389,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
|||
nread += strlen(endofline_network); /* for the added end of line */
|
||||
}
|
||||
#ifdef CURL_DOES_CONVERSIONS
|
||||
else if((data->set.prefer_ascii) && (!sending_http_headers)) {
|
||||
else if((data->state.prefer_ascii) && (!sending_http_headers)) {
|
||||
CURLcode result;
|
||||
result = Curl_convert_to_network(data, data->req.upload_fromhere, nread);
|
||||
/* Curl_convert_to_network calls failf if unsuccessful */
|
||||
|
|
@ -1028,7 +1028,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
|
|||
if((!sending_http_headers) && (
|
||||
#ifdef CURL_DO_LINEEND_CONV
|
||||
/* always convert if we're FTPing in ASCII mode */
|
||||
(data->set.prefer_ascii) ||
|
||||
(data->state.prefer_ascii) ||
|
||||
#endif
|
||||
(data->set.crlf))) {
|
||||
/* Do we need to allocate a scratch buffer? */
|
||||
|
|
@ -1415,6 +1415,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||
}
|
||||
}
|
||||
|
||||
data->state.prefer_ascii = data->set.prefer_ascii;
|
||||
data->state.httpreq = data->set.method;
|
||||
data->change.url = data->set.str[STRING_SET_URL];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue