使用 HTTP/POST 传输大文件
如何使用 C(或 C++)中的 HTTP 协议上传(非常)大的文件?
我知道这不是上传大文件的正确方法,但这不是重点。
我已经看过有关 C++ 中文件 POST 传输的资料,但我注意到,每次,整个二进制文件都包含在 POST 序列内(在“--boundary”之间)。
那么,在深入研究 Webkit/Gecko 源代码之前,有人知道它们是怎么做的吗?
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.
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").
So, before going deeper and deeper into Webkit/Gecko source code, does somebody know how do they do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 HTTP POST 请求中使用“Content-Range”标头来上传大文件的一部分。
You may use "Content-Range" header in HTTP POST request, to upload a slice of a huge file.
您可以使用分块方法以块的形式发送数据。这将允许您更大规模地发送/接收数据。请参阅 RFC 2616 了解分块的实际工作原理。
You can use chunking method to send the data in chunks. This will allow you to send/receive data on a larger scale. Refer to RFC 2616 on how chunking really works.