HTTP部分上传,恢复上传的标准方法 [英] Standard method for HTTP partial upload, resume upload

查看:104
本文介绍了HTTP部分上传,恢复上传的标准方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发http客户端/服务器框架,并寻找处理部分上传的正确方法(与使用带有Range标头的GET方法的下载相同)。

I'm developing http client/server framework, and looking for the correct way to handle partial uploads (the same as for downloads using GET method with Range header).

但是,HTTP PUT并不打算恢复。
和PATCH方法,据我所知,不接受Range标头。

But, HTTP PUT is not intended to be resumed. And PATCH method, as i know, doesn't accept Range header.

有没有办法通过HTTP标准来处理这个问题(不使用扩展标头)或等)?

Is there any way to handle this in by HTTP standard (not using extension headers or etc)?

提前致谢。

推荐答案

我认为部分上传没有标准:

I think there is no standard for partial uploads:


  • 内容 - 请求中的范围未在 RFC2616 (http),但是措辞也将其称为响应标头,用于响应范围请求

  • 虽然您可以使用PATCH方法更新现有资源(例如添加更多字节),但它与部分上传不同,因为所有时间都不完整资源可用

  • Content-Range inside requests is not explicitly forbidden in RFC2616 (http), but also the wording refers to it as an response header which gets used in response of a range-request
  • while you could use the PATCH method to update an existing resource (e.g. to add more bytes) it would not be the same as a partial upload, because all the time the incomplete resource would be available

如果你看看Dropbox,谷歌驱动器等的协议,他们都会推出自己的协议,以便在多个块中传输单个文件。恢复上传所需的是

If you look at the protocols of Dropbox, google drive etc they all roll their own protocol to transfer a single files in multiple chunks. What you need for resumeable uploads is


  • 一种解决不完整上传的方法。普通网址是一个完整的,而不是部分资源,我知道没有部分资源的标准。

  • 一种查找上传当前状态的方法,也可能是部分的校验和确保本地文件没有改变。这可以通过WebDAV PROPFIND方法提供(一旦你能够解决不完整的资源:)

  • 一种上传块的方法。这里可以使用PATCH和内容范围标题。 mod_dav似乎允许PUT使用内容范围标题(请参阅 http://www.gossamer -threads.com/lists/apache/users/432346

  • 一种在资源完成后发布资源的方法,或者预先定义完整资源的方法(例如资源大小,校验和......)

  • a way to address an incomplete upload. Normal URLs address a complete, not a partial resource and I know of no standard for partial resources.
  • a way to find out the current state of the upload, maybe also checksums of the part to be sure, that the local file did not change. This could be provided by WebDAV PROPFIND method (once you are able to address the incomplete resource :)
  • a way to upload a chunk. Here one could maybe use PATCH with a content-range header. mod_dav seems to allow PUT with content-range header (see http://www.gossamer-threads.com/lists/apache/users/432346)
  • a way to publish the resource once it is complete, or a way to define upfront what complete means (e.g size of resource, checksum...)

这篇关于HTTP部分上传,恢复上传的标准方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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