HTTP Data chunks over multiple packets?

Posted by myforwik on Stack Overflow See other posts from Stack Overflow or by myforwik
Published on 2010-05-06T23:13:03Z Indexed on 2010/05/06 23:18 UTC
Read the original article Hit count: 302

Filed under:
|
|

What is the correct way for a HTTP server to send data over multiple packets?

For example I want to transfer a file, the first packet I send is:

HTTP/1.1 200 OK
Content-type: application/force-download
Content-Type: application/download
Content-Type: application/octet-stream
Content-Description: File Transfer
Content-disposition: attachment; filename=test.dat
Content-Transfer-Encoding: chunked

400
<first 1024 bytes here>

400
<next 1024 bytes here>

400
<next 1024 bytes here>

Now I need to make a new packet, if I just send:

400
<next 1024 bytes here>

All the clients close there connections on me and the files are cut short.

What headers do I put in a second packet to continue on with the data stream?

© Stack Overflow or respective owner

Related posts about http

Related posts about chunked-encoding