避免HTTP / 1.1响应的分块编码 [英] avoiding chunked encoding of HTTP/1.1 response

查看:265
本文介绍了避免HTTP / 1.1响应的分块编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望避免从(符合)HTTP服务器获得 chunked 编码的HTTP服务器响应。我正在阅读 RFC 2616 部分 14.39 TE 在我看来,我可以通过指定 TE:chunked; q = 0 。如果我无法避免 chunked 编码,我想避免使用预告片。将指定 TE:预告片; q = 0 工作?

I want to avoid ever getting chunked encoded HTTP server response from (conforming) HTTP server. I am reading RFC 2616 section "14.39 TE" and it seems to me that I could avoid it by specifying TE: chunked;q=0. If I cannot avoid the chunked encoding, I want do avoid the trailers. Will specifying TE: trailers;q=0 work?

推荐答案

来自 rfc2616 - 超文本传输​​协议 - HTTP / 1.1 ,在3.6.1分块传输编码


所有HTTP / 1.1应用程序必须能够接收和解码
chunked传输编码,并且必须忽略他们不理解的块扩展扩展

All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding, and MUST ignore chunk-extension extensions they do not understand.

因此,如果你想要符合HTTP / 1.1,你必须接受分块编码。

So if you want to be conform to HTTP/1.1, you will have to accept chunked encoding.

至于预告片:我想如果你不发送 TE 标题字段您的请求,符合要求的服务器不应该向您发送任何预告片。如果它仍然发送预告片,你可能会保存以忽略它们(再次参见第3.6.1节):

As for the trailers: I think if you don't send a TE header field in your request, a conforming server shouldn't send you any trailers. If it still sends trailers you are probably save to ignore them (again section 3.6.1):


使用分块传输编码的服务器对于任何标题字段,不得使用
预告片,除非以下至少有一个是
true:

A server using chunked transfer-coding in a response MUST NOT use the trailer for any header fields unless at least one of the following is true:

a)请求包括表示预告片的TE标题字段在响应的传输编码中是可接受的
,如
第14.39节所述;或者,

a) the request included a TE header field that indicates "trailers" is acceptable in the transfer-coding of the response, as described in section 14.39; or,

b)服务器是响应的原始服务器,预告片
字段完全由可选元数据组成,收件人
可以使用消息(以原始服务器可接受的方式)
而不接收此元数据。换句话说,原始服务器
愿意接受拖车字段可能会沿着到客户端的路径静默丢弃
的可能性。

b) the server is the origin server for the response, the trailer fields consist entirely of optional metadata, and the recipient could use the message (in a manner acceptable to the origin server) without receiving this metadata. In other words, the origin server is willing to accept the possibility that the trailer fields might be silently discarded along the path to the client.

这篇关于避免HTTP / 1.1响应的分块编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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