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

查看:8
本文介绍了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、google drive 等的协议,它们都使用自己的协议来传输多个块中的单个文件.可恢复上传需要的是

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

  • 解决上传不完整的方法.普通 URL 处理的是完整的资源,而不是部分资源,我不知道部分资源的标准.
  • 一种找出上传当前状态的方法,也许还可以检查部分的校验和,以确保本地文件没有改变.这可以通过 WebDAV PROPFIND 方法提供(一旦您能够解决不完整的资源:)
  • 一种上传块的方法.在这里,可以使用带有内容范围标头的 PATCH.mod_dav 似乎允许 PUT 带有内容范围标头(请参阅 http://www.gossamer-threads.com/lists/apache/users/432346)
  • 一种在资源完成后发布资源的方式,或者一种预先定义完成意味着什么的方式(例如资源的大小、校验和...)

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

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