1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

crlf replacement on uploads did not work. test case 128 was added just now

to make sure it remains functional.
This commit is contained in:
Daniel Stenberg 2002-03-20 10:53:24 +00:00
parent ca9760756a
commit 854277bae5

View File

@ -773,16 +773,24 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* convert LF to CRLF if so asked */ /* convert LF to CRLF if so asked */
if (data->set.crlf) { if (data->set.crlf) {
for(i = 0, si = 0; i < nread; i++, si++) { for(i = 0, si = 0; i < nread; i++, si++) {
if (k->buf[i] == 0x0a) { if (conn->upload_fromhere[i] == 0x0a) {
data->state.scratch[si++] = 0x0d; data->state.scratch[si++] = 0x0d;
data->state.scratch[si] = 0x0a; data->state.scratch[si] = 0x0a;
} }
else { else
data->state.scratch[si] = k->uploadbuf[i]; data->state.scratch[si] = conn->upload_fromhere[i];
}
} }
if(si != nread) {
/* only perform the special operation if we really did replace
anything */
nread = si; nread = si;
k->buf = data->state.scratch; /* point to the new buffer */
/* upload from the new (replaced) buffer instead */
conn->upload_fromhere = data->state.scratch;
/* set the new amount too */
conn->upload_present = nread;
}
} }
} }
else { else {
@ -808,8 +816,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
is to happen */ is to happen */
conn->upload_fromhere += bytes_written; conn->upload_fromhere += bytes_written;
} }
else if(data->set.crlf)
k->buf = data->state.buffer; /* put it back on the buffer */
else { else {
/* we've uploaded that buffer now */ /* we've uploaded that buffer now */
conn->upload_fromhere = k->uploadbuf; conn->upload_fromhere = k->uploadbuf;