传输使用HTTP / POST大文件 [英] Transfer large files using HTTP/POST

查看:781
本文介绍了传输使用HTTP / POST大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何上传(很)大文件在C(或C ++)?HTTP协议

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

我知道这不是上传大文件的正确途径,但是这不是问题的关键。

I know it's not the right way to upload huge files, but that's not the point.

我已经看到了关于C文件的职位调动来源+ +,但我注意到,每一次,整个二进制文件被列入POST序列中(与--boundary)。

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

所以,才去越陷越深的Webkit / Gecko的来源$ C ​​$ C,是否有人知道他们怎么办?

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

推荐答案

您可以使用内容范围,在HTTP POST请求头,上传大文件的一个切片。

You may use "Content-Range" header in HTTP POST request, to upload a slice 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

......

这篇关于传输使用HTTP / POST大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆