Transfer large files using HTTP / POST

How can I upload a (very) large HTTP protocol file in C (or C ++)?

I know that this is not the right way to download huge files, but it is not.

I have already seen sources about transferring POST files in C ++, but I noticed that each time the WHOLE binary was included inside the POST sequence (between "- boundary").

So, before going deeper and deeper into the Webkit / Gecko source code, does anyone know how they do it?

+1
source share
2 answers

You can use the Content-Range header in the HTTP POST request to download a fragment of a huge file.

POST http://[server_ip]:80/upload?fn=xx.dat HTTP/1.1 Content-Range: bytes=0-4095 Content-Type: application/octet-stream Content-Length: 4096 ...... 
+2
source

You can use the chunking method to send data to chunks. This will allow you to send / receive data on a larger scale. Refer to RFC 2616 for how the unit works.

0
source

All Articles