urldata: remove crlf_conversions counter
Since the introduction of client writers, we check the body length in the PROTOCOL phase and do FTP lineend conversions laster in the CONTENT_DECODING phase. This means we no longer need to count the conversions for length checks. Closes #14709
This commit is contained in:
parent
1b0568539d
commit
64ab0ace27
10
lib/ftp.c
10
lib/ftp.c
@ -369,7 +369,6 @@ static CURLcode ftp_cw_lc_write(struct Curl_easy *data,
|
||||
}
|
||||
/* either we just wrote the newline or it is part of the next
|
||||
* chunk of bytes we write. */
|
||||
data->state.crlf_conversions++;
|
||||
ctx->newline_pending = FALSE;
|
||||
}
|
||||
|
||||
@ -400,7 +399,6 @@ static CURLcode ftp_cw_lc_write(struct Curl_easy *data,
|
||||
/* EndOfStream, if we have a trailing cr, now is the time to write it */
|
||||
if(ctx->newline_pending) {
|
||||
ctx->newline_pending = FALSE;
|
||||
data->state.crlf_conversions++;
|
||||
return Curl_cwriter_write(data, writer->next, type, &nl, 1);
|
||||
}
|
||||
/* Always pass on the EOS type indicator */
|
||||
@ -3547,14 +3545,6 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
||||
else {
|
||||
if((-1 != data->req.size) &&
|
||||
(data->req.size != data->req.bytecount) &&
|
||||
#ifdef CURL_DO_LINEEND_CONV
|
||||
/* Most FTP servers do not adjust their file SIZE response for CRLFs,
|
||||
* so we will check to see if the discrepancy can be explained by the
|
||||
* number of CRLFs we have changed to LFs.
|
||||
*/
|
||||
((data->req.size + data->state.crlf_conversions) !=
|
||||
data->req.bytecount) &&
|
||||
#endif /* CURL_DO_LINEEND_CONV */
|
||||
(data->req.maxdownload != data->req.bytecount)) {
|
||||
failf(data, "Received only partial file: %" CURL_FORMAT_CURL_OFF_T
|
||||
" bytes", data->req.bytecount);
|
||||
|
||||
@ -518,15 +518,7 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
|
||||
* returning.
|
||||
*/
|
||||
if(!(data->req.no_body) && (k->size != -1) &&
|
||||
(k->bytecount != k->size) &&
|
||||
#ifdef CURL_DO_LINEEND_CONV
|
||||
/* Most FTP servers do not adjust their file SIZE response for CRLFs,
|
||||
so we will check to see if the discrepancy can be explained
|
||||
by the number of CRLFs we have changed to LFs.
|
||||
*/
|
||||
(k->bytecount != (k->size + data->state.crlf_conversions)) &&
|
||||
#endif /* CURL_DO_LINEEND_CONV */
|
||||
!k->newurl) {
|
||||
(k->bytecount != k->size) && !k->newurl) {
|
||||
failf(data, "transfer closed with %" CURL_FORMAT_CURL_OFF_T
|
||||
" bytes remaining to read", k->size - k->bytecount);
|
||||
result = CURLE_PARTIAL_FILE;
|
||||
|
||||
@ -3671,10 +3671,6 @@ CURLcode Curl_setup_conn(struct Curl_easy *data,
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef CURL_DO_LINEEND_CONV
|
||||
data->state.crlf_conversions = 0; /* reset CRLF conversion counter */
|
||||
#endif /* CURL_DO_LINEEND_CONV */
|
||||
|
||||
/* set start time here for timeout purposes in the connect procedure, it
|
||||
is later set again for the progress meter purpose */
|
||||
conn->now = Curl_now();
|
||||
|
||||
@ -105,6 +105,11 @@ typedef unsigned int curl_prot_t;
|
||||
#define CURL_DEFAULT_USER "anonymous"
|
||||
#define CURL_DEFAULT_PASSWORD "ftp@example.com"
|
||||
|
||||
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__EMX__)
|
||||
/* do FTP line-end conversions on most platforms */
|
||||
#define CURL_DO_LINEEND_CONV
|
||||
#endif
|
||||
|
||||
/* Convenience defines for checking protocols or their SSL based version. Each
|
||||
protocol handler should only ever have a single CURLPROTO_ in its protocol
|
||||
field. */
|
||||
@ -1268,12 +1273,6 @@ struct UrlState {
|
||||
|
||||
/* a place to store the most recently set (S)FTP entrypath */
|
||||
char *most_recent_ftp_entrypath;
|
||||
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__EMX__)
|
||||
/* do FTP line-end conversions on most platforms */
|
||||
#define CURL_DO_LINEEND_CONV
|
||||
/* for FTP downloads: how many CRLFs did we converted to LFs? */
|
||||
curl_off_t crlf_conversions;
|
||||
#endif
|
||||
char *range; /* range, if used. See README for detailed specification on
|
||||
this syntax. */
|
||||
curl_off_t resume_from; /* continue [ftp] transfer from here */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user