http 中的 md5 带范围
想象一下,用户请求一个 10 字节文件的 Rage: bytes=2-5
。必须向用户提供多少 MD5 和?所有 10 个字节的 MD5 总和还是仅部分内容(字节 2-5)的 MD5 总和?
RFC2616 第 14.15 节内容如下:
MD5 摘要的计算基于 实体主体的内容, 包括任何内容编码 已应用,但不包括任何 传输编码应用于 消息正文。如果消息是 通过传输编码接收, 该编码必须在之前删除 检查 Content-MD5 值 接收到的实体。
我该如何解释呢?我问这个问题是因为我不会将 md5sums 添加到部分内容中,前提是必须为每个范围请求重新生成它。
Imagine a user asks for Rage: bytes=2-5
of a 10-byte file. What MD5 sum has to be served to the user? The MD5 sum of all 10 bytes or only of the partial content, bytes 2-5?
RFC2616 Section 14.15 reads:
The MD5 digest is computed based on
the content of the entity-body,
including any content-coding that has
been applied, but not including any
transfer-encoding applied to the
message-body. If the message is
received with a transfer-encoding,
that encoding MUST be removed prior to
checking the Content-MD5 value against
the received entity.
How must I interpret that? I ask this because I would refrain from adding md5sums to partial content, iff it has to be re-generated for each range-request.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是:http://trac.tools.ietf.org/wg/ httpbis/trac/ticket/178。
因此没有简单的答案,工作组很乐意接受反馈。
This is: http://trac.tools.ietf.org/wg/httpbis/trac/ticket/178.
So there is no easy answer, the Working Group will gladly accept feedback.
除非您在某些非常不寻常的网络协议上运行 HTTP,否则使用 MD5 校验和可以获得什么好处? TCP 处理完整性检查,HTTP 标头是可选的,其目的不是为了确保完整性以防止恶意攻击。
Unless you're running HTTP over some very unusual network protocol, what are you gaining by using MD5 checksums? TCP handles integrity checking, the HTTP header is optional, and its not intended to ensure integrity against malicious attacks.