1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Chunked-transfers should have an additional CRLF after the final 0 CRLF

sequence.
This commit is contained in:
Daniel Stenberg 2004-01-28 17:07:22 +00:00
parent ed75842df0
commit 958987c214
3 changed files with 10 additions and 9 deletions

View File

@ -1614,8 +1614,8 @@ CURLcode Curl_http(struct connectdata *conn)
/* Append the POST data chunky-style */ /* Append the POST data chunky-style */
add_bufferf(req_buffer, "%x\r\n", postsize); add_bufferf(req_buffer, "%x\r\n", postsize);
add_buffer(req_buffer, data->set.postfields, postsize); add_buffer(req_buffer, data->set.postfields, postsize);
add_buffer(req_buffer, "\r\n0\r\n", 5); /* end of a chunked add_buffer(req_buffer, "\r\n0\r\n\r\n", 7); /* end of a chunked
transfer stream */ transfer stream */
} }
} }
else { else {

View File

@ -152,16 +152,16 @@ static int fillbuffer(struct connectdata *conn,
/* copy the prefix to the buffer */ /* copy the prefix to the buffer */
memcpy(conn->upload_fromhere, hexbuffer, hexlen); memcpy(conn->upload_fromhere, hexbuffer, hexlen);
if(nread>hexlen) {
/* append CRLF to the data */ /* always append CRLF to the data */
memcpy(conn->upload_fromhere + memcpy(conn->upload_fromhere + nread, "\r\n", 2);
nread, "\r\n", 2);
nread+=2; if((nread - hexlen) == 0) {
}
else {
/* mark this as done once this chunk is transfered */ /* mark this as done once this chunk is transfered */
conn->keep.upload_done = TRUE; conn->keep.upload_done = TRUE;
} }
nread+=2; /* for the added CRLF */
} }
return nread; return nread;
} }

View File

@ -48,5 +48,6 @@ Content-Type: application/x-www-form-urlencoded
c c
we post this we post this
0 0
</protocol> </protocol>
</verify> </verify>