HTTP request Method Options

Source: Internet
Author: User

HTTP request methods are not only get and post, but are most commonly used. According to the RFC2616 standard (current http/1.1), there are usually 8 ways to do this: OPTIONS,, POST, put, DELETE, Trace, and connect. Official definition

The Options method is a feature option that is used to request that a resource identified by Request-uri be available for use in the request/response communication process. In this way, the client can decide what measures to take to the resource, or understand the performance of the server, before taking a specific resource request.

The response of this request method cannot be cached.

If the options request contains a body (with content-length or transfer-encoding), you must have content-type to specify the media type. Although the use of this body is not defined in the specification, HTTP future extensions may use it to query for more detailed information on the server. A server that does not support this extension can ignore the request body.

If the URI is an asterisk ("*"), the options request will attempt to apply to the server rather than to a specified resource. Because the server's communication options usually depend on resources, this "*" request can only be used as a "ping" or "no-op" method, or to test the performance of the server. For example, to test the http/1.1 agent.

If the URI is not an asterisk, it can only be used to get the options available in the resource's communication.

The resulting 200 response should contain a header field that indicates the optional characteristics (such as Allow) that the server implements and applies to the resource, possibly including extensions that the specification has not yet defined. If there is a response body, you should include information about the communication options. This specification does not define this body format, but may be defined in htto future extensions. You can use content negotiation to select the appropriate response format. If there is no response body, the response must contain content-length and the value is "0".

The max-forwards of the request header is used to request a specific agent. Check max-forwards when the agent receives an options request that allows the URI to be forwarded. If the Max-forwards value is 0, the message cannot be forwarded; Instead, the agent responds with its own communication options. If the max-forwards is a positive integer, the agent forwards the request with a value minus 1. If there is no max-forwards in the request, the forwarded request will not be available. In short

The options request method has two main uses:

1. Obtain the HTTP request method supported by the server; It is also the method that hackers often use.

2, to check the performance of the server. For example, if Ajax is a cross-domain request, it needs to send an HTTP options header to a resource in another domain to determine whether the actual request is secure.





The DELETE method

HTTP provides a Delete method that corresponds to the Put method. A delete request designates the content that needs to be deleted from the Web server as part of the resource in the request line.

The only interesting thing about the Delete method is that when you receive a response that is labeled OK, that does not mean that the specified resource has been deleted. That only means that the server received the command to delete the resource. This exception allows for an artificial intervention for security reasons.

http://blog.csdn.net/leikezhu1981/article/details/7402272


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.