这个陈述是否正确? HTTP GET方法始终没有消息体 [英] Is this statement correct? HTTP GET method always has no message body

查看:200
本文介绍了这个陈述是否正确? HTTP GET方法始终没有消息体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这句话是否正确? HTTP GET方法始终没有消息体。
我没有发现RFC2616的任何部分明确说明这一点。

Is this statement correct? HTTP GET method always has no message body. I didn't find any part of RFC2616 explicitly say this.

如果不是这样,那么Http GET请求在什么情况下会包含消息正文

And if this is not true, then in what circumstances will an Http GET request include a message body

推荐答案

restclient 也没有 REST控制台支持这一点,但卷曲确实。

Neither restclient nor REST console support this but curl does.

原始的HTTP 1.1规范在第4.3节中说明


如果规范的话,消息体不得包含在请求中请求方法(第5.1.1节)不允许在请求中发送实体主体。

A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests.

Sectio n 5.1.1 将我们重定向到第9.x节的各种方法。他们都没有明确禁止包含消息体。但是......

Section 5.1.1 redirects us to section 9.x for the various methods. None of them explicitly prohibit the inclusion of a message body. However...

第5.2节


互联网请求确定的确切资源是通过检查请求 - URI和主机头字段。

The exact resource identified by an Internet request is determined by examining both the Request-URI and the Host header field.

第9.3节


GET方法意味着检索任何信息(以实体的形式)由Request-URI标识。

The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.

在处理GET时共同提示请求,服务器不是 required 来检查Request-URI和Host头字段的其他内容。

Which together suggest that when processing a GET request, a server is not required to examine anything other that the Request-URI and Host header field.

总之,HTTP规范没有不会阻止你发送一个带有GET的消息体,但是有足够的含糊之处,如果它不会让我感到惊讶并非所有服务器都支持。

In summary, the HTTP spec doesn't prevent you from sending a message-body with GET, but there is sufficient ambiguity that it wouldn't surprise me if it was not supported by all servers.

这篇关于这个陈述是否正确? HTTP GET方法始终没有消息体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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