aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-01-28 17:07:22 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-01-28 17:07:22 +0000
commit958987c214cacdfaad6fa960b39e0c917f43af2d (patch)
treec56329e40b0b015ab7d081dfdd8868a75643f456 /lib
parented75842df07357acde35c6edef39aa6e31d752a2 (diff)
Chunked-transfers should have an additional CRLF after the final 0 CRLF
sequence.
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c4
-rw-r--r--lib/transfer.c14
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/http.c b/lib/http.c
index 0dcaf7866..c3862cded 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1614,8 +1614,8 @@ CURLcode Curl_http(struct connectdata *conn)
/* Append the POST data chunky-style */
add_bufferf(req_buffer, "%x\r\n", postsize);
add_buffer(req_buffer, data->set.postfields, postsize);
- add_buffer(req_buffer, "\r\n0\r\n", 5); /* end of a chunked
- transfer stream */
+ add_buffer(req_buffer, "\r\n0\r\n\r\n", 7); /* end of a chunked
+ transfer stream */
}
}
else {
diff --git a/lib/transfer.c b/lib/transfer.c
index 3c2bf4baf..eb0c99452 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -152,16 +152,16 @@ static int fillbuffer(struct connectdata *conn,
/* copy the prefix to the buffer */
memcpy(conn->upload_fromhere, hexbuffer, hexlen);
- if(nread>hexlen) {
- /* append CRLF to the data */
- memcpy(conn->upload_fromhere +
- nread, "\r\n", 2);
- nread+=2;
- }
- else {
+
+ /* always append CRLF to the data */
+ memcpy(conn->upload_fromhere + nread, "\r\n", 2);
+
+ if((nread - hexlen) == 0) {
/* mark this as done once this chunk is transfered */
conn->keep.upload_done = TRUE;
}
+
+ nread+=2; /* for the added CRLF */
}
return nread;
}