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:
Daniel Stenberg 2021-02-08 15:56:10 +01:00
parent 0829909ebd
commit 115c9e27f5
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 146 additions and 21 deletions

View file

@ -1702,7 +1702,7 @@ CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
if(
#ifdef CURL_DO_LINEEND_CONV
(handle->set.prefer_ascii) ||
(handle->state.prefer_ascii) ||
#endif
(handle->set.crlf)) {
/* \n will become \r\n later on */
@ -2209,7 +2209,7 @@ CURLcode Curl_http_target(struct Curl_easy *data,
}
if(!type) {
result = Curl_dyn_addf(r, ";type=%c",
data->set.prefer_ascii ? 'a' : 'i');
data->state.prefer_ascii ? 'a' : 'i');
if(result)
return result;
}