How to write a MultiPart download C++ program

ε祈祈猫儿з 提交于 2019-12-06 11:58:44

问题


I want to write a C++ program to download files with HTTP. For the sake of learning I would like to implement multipart downloading in my program the way DownThemAll! does. It is not possible to do lseek on a linux socket. I suppose it would be some HTTP option that we would need to specify, telling where to start downloading the file from. Thus we could have multiple connections open to the server. Is it right? What are the HTTP headers for doing so?


回答1:


I suggest you take a look at section 14.35.1 Byte Ranges of the HTTP spec:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35




回答2:


You need the Range HTTP header.




回答3:


There is a library based on C++ and ASIO called Urdl.

ASIO link: http://asio.sourceforge.net

Urdl link: http://think-async.com/Urdl/doc/html/index.html



来源:https://stackoverflow.com/questions/1390471/how-to-write-a-multipart-download-c-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!