问题描述
列出了以下HTTP请求方法:
- HEAD:要求响应与GET请求相对应,但没有响应正文。
- 获取:请求指定资源的表示。
- POST:提交要处理的数据(例如,来自HTML表单)到已识别的资源。数据包含在请求正文中。
- PUT:上传指定资源的表示。
- 删除:删除指定的资源。
- TRACE:回显收到的请求,以便客户端可以看到(如果有的话) )中间服务器已进行更改或添加。
- 选项:返回服务器支持指定URL的HTTP方法。这可以通过请求'*'而不是特定资源来检查Web服务器的功能。
- CONNECT:将请求连接转换为透明TCP / IP隧道,通常用于通过未加密的HTTP代理进行SSL加密通信(HTTPS)。
- PATCH:用于对资源进行部分修改。
我有兴趣了解(特别是关于前五种方法):
- 哪些方法能够(应该?)接收有效载荷
- 可以接收有效负载的方法,它们如何接收?
- 通过URL中的查询字符串?
- 通过URL-编码正文?
- 通过raw / chunked body?
- 通过上述([all / some])的组合?
- 可以接收有效负载的方法,它们如何接收?
我感谢所有输入,如果你腠ld分享一些(最好是轻的)读数,这也很棒!
,HTTP 1.1语义和内容,是HTTP方法语义的最新和权威来源。此规范表明,对于可能包含在GET,HEAD,OPTIONS或CONNECT消息中的有效负载,没有明确的含义。第4.3.8节说客户端不得发送TRACE请求的正文。因此,只有TRACE不能有有效负载,但GET,HEAD,OPTIONS和CONNECT可能不会,如果客户端发送一个(意味着它可以忽略它),服务器不会知道如何处理它。 p>
如果您认为任何事情都不明确,那么,您可以在其中表达您的疑虑。
The Wikipedia entry on HTTP lists the following HTTP request methods:
- HEAD: Asks for the response identical to the one that would correspond to a GET request, but without the response body.
- GET: Requests a representation of the specified resource.
- POST: Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request.
- PUT: Uploads a representation of the specified resource.
- DELETE: Deletes the specified resource.
- TRACE: Echoes back the received request, so that a client can see what (if any) changes or additions have been made by intermediate servers.
- OPTIONS: Returns the HTTP methods that the server supports for specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
- CONNECT: Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.
- PATCH: Is used to apply partial modifications to a resource.
I'm interested in knowing (specifically regarding the first five methods):
- which of these methods are able (supposed to?) receive payloads
- of the methods that can receive payloads, how do they receive it?
- via query string in URL?
- via URL-encoded body?
- via raw / chunked body?
- via a combination of ([all / some] of) the above?
- of the methods that can receive payloads, how do they receive it?
I appreciate all input, if you could share some (preferably light) reading that would be great too!
RFC 7231, HTTP 1.1 Semantics and Content, is the most up-to-date and authoritative source on the semantics of the HTTP methods. This spec says that there are no defined meaning for a payload that may be included in a GET, HEAD, OPTIONS, or CONNECT message. Section 4.3.8 says that the client must not send a body for a TRACE request. So, only TRACE cannot have a payload, but GET, HEAD, OPTIONS, and CONNECT probably won't and the server isn't expected to know how to handle it if the client sends one (meaning it can ignore it).
If you believe anything is ambiguous, then there is a mailing list where you can voice your concerns.
这篇关于HTTP请求方法的有效负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!