aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-20 10:53:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-20 10:53:24 +0000
commit854277bae509b0959c9f7a46c55acc9685e9404e (patch)
tree01cdae5eb0f63841c38549095f80c2f7d1a83b3c /lib
parentca9760756ae2d02b95f2ce7158a24df79d62ea85 (diff)
crlf replacement on uploads did not work. test case 128 was added just now
to make sure it remains functional.
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 6229aecb4..f34ec1f8d 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -773,16 +773,24 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* convert LF to CRLF if so asked */
if (data->set.crlf) {
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] = 0x0a;
}
- else {
- data->state.scratch[si] = k->uploadbuf[i];
- }
+ else
+ data->state.scratch[si] = conn->upload_fromhere[i];
+ }
+ if(si != nread) {
+ /* only perform the special operation if we really did replace
+ anything */
+ nread = si;
+
+ /* upload from the new (replaced) buffer instead */
+ conn->upload_fromhere = data->state.scratch;
+
+ /* set the new amount too */
+ conn->upload_present = nread;
}
- nread = si;
- k->buf = data->state.scratch; /* point to the new buffer */
}
}
else {
@@ -808,8 +816,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
is to happen */
conn->upload_fromhere += bytes_written;
}
- else if(data->set.crlf)
- k->buf = data->state.buffer; /* put it back on the buffer */
else {
/* we've uploaded that buffer now */
conn->upload_fromhere = k->uploadbuf;