use checking further */
;
else if(data->state.upload) {
- if((-1 != data->state.infilesize) &&
- (data->state.infilesize != data->req.writebytecount) &&
- !data->set.crlf &&
- (ftp->transfer == PPTRANSFER_BODY)) {
+ if((ftp->transfer == PPTRANSFER_BODY) &&
+ (data->state.infilesize != -1) && /* upload with known size */
+ ((!data->set.crlf && !data->state.prefer_ascii && /* no conversion */
+ (data->state.infilesize != data->req.writebytecount)) ||
+ ((data->set.crlf || data->state.prefer_ascii) && /* maybe crlf conv */
+ (data->state.infilesize > data->req.writebytecount))
+ )) {
failf(data, "Uploaded unaligned file size (%" FMT_OFF_T
" out of %" FMT_OFF_T " bytes)",
data->req.writebytecount, data->state.infilesize);
if(result)
return result;
start = i + 1;
- if(!data->set.crlf && (data->state.infilesize != -1)) {
- /* we are here only because FTP is in ASCII mode...
- bump infilesize for the LF we just added */
- data->state.infilesize++;
- /* comment: this might work for FTP, but in HTTP we could not change
- * the content length after having started the request... */
- }
}
if(start < i) { /* leftover */
return ctx->index > 0;
}
+static CURLcode cr_buf_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_buf_ctx *ctx = reader->ctx;
+ (void)data;
+ ctx->index = 0;
+ return CURLE_OK;
+}
+
static curl_off_t cr_buf_total_length(struct Curl_easy *data,
struct Curl_creader *reader)
{
cr_buf_needs_rewind,
cr_buf_total_length,
cr_buf_resume_from,
- Curl_creader_def_rewind,
+ cr_buf_rewind,
Curl_creader_def_unpause,
Curl_creader_def_is_paused,
Curl_creader_def_done,