简体   繁体   English

Http请求方法和参数

[英]Http Request Methods, and Parameters

well, out of curiosity, what are the HTTP methods that accept parameters in the query string? 好吧,出于好奇,接受查询字符串中参数的HTTP方法是什么? they all? 他们都? which HTTP methods in which the parameters have to be sent via cURL POSTFIELDS? 哪些HTTP方法必须通过cURL POSTFIELDS发送参数?

All request methods ( GET , HEAD , POST , OPTIONS , PUT , TRACE , DELETE , BREW ) may have GET-style ?x=y request parameters. 所有请求方法( GETHEADPOSTOPTIONSPUTTRACEDELETEBREW )都可以具有GET样式?x=y请求参数。 It's just very uncommon for some others ( CONNECT ). 对于其他一些人( CONNECT )来说这是非常不常见的。

The reason is that HTTP deals with "resources", and it doesn't actually care about URL parameters. 原因是HTTP处理“资源”,实际上并不关心URL参数。 Starting from the / path delimiter it's all just considered a resource name. /路径定界符开始,所有内容都被视为资源名称。 Whether there are any ? 是否有? question marks in it, or the receiving webserver uses @ in its place is irrelevant, because implementation-specific. 问号,或接收方的Web服务器在其位置使用@都无关紧要,因为特定于实现。

HTTP clients obviously know about URL schemes and how to split them up, but it's not a big concern for the protocol itself. HTTP客户端显然知道URL方案以及如何对其进行拆分,但是对协议本身并不是一个大问题。 I think the specification ( RFC1616 ) makes little mention besides the URL scheme description. 我认为该规范( RFC1616 )除了URL方案描述之外很少提及。 HTTPbis might be more elaborate. HTTPbis可能更详细。

If you have a POST-style request body with other methods actually depends less on the HTTP verb, but on the presence of a Content-Type: and Content-Length: request header. 如果您具有带有其他方法的POST样式的请求主体,则实际上实际上较少依赖于HTTP动词,而是取决于Content-Type:Content-Length:请求标头的存在。

In the query string eg (http://www.mydomain.com/myscript.php?myParameter=myValue) is known as a GET method and the other method which sends data behind the scenes is POST. 在查询字符串中,例如(http://www.mydomain.com/myscript.php?myParameter=myValue)被称为GET方法,而在后台发送数据的另一种方法是POST。 You can in fact use both GET and POST at the same time. 实际上,您可以同时使用GET和POST。 If you are uploading files you are required to send it in POST with a enctype of "multipart/form-data" 如果您要上传文件,则需要在POST中以enctype为“ multipart / form-data”的形式发送文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM