Back

HTTP 的几种请求方法(http request methods)

发布时间: 2015-01-03 07:54:00

refer to:  http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

这只是个 规格说明,用来建议各大browser厂商所遵循,而事实上的类型目前只有GET, POST。 restful中所使用的仅仅是:GET, POST, PUT, DELETE。 

HTTP 请求,分成两类:

安全方法(safe methods): GET/HEAD: 不会改变服务器的状态。(与PUT,POST, DELETE不同)

idempotence 方法: 

又分成:

GET: 发起请求,不改变服务器状态。

OPTIONS :The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:

- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;
- Providing a block of data, such as the result of submitting a
form, to a data-handling process;
- Extending a database through an append operation.

HEAD: 跟GET一样,发起请求,不改变服务器状态,但是不需要返回content. 

POST :新建数据

PUT : 修改数据

DELETE : 删除数据

TRACE:The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response

CONNECT: 告诉服务器,我是一个tunnel. This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel

Back