HTTP1.1
We kown an HTTP 1.1 requests is a class consisting of HTTP style reqeusts lines,reqeusts methods,reqeusts URL,header fields and body content.
The most common methods that are used by a client in an HTTP request are as follows:
-
Get
: Used when the client is requesting a resource on the web server. 当客户端向Web服务器请求一个资源的时候使用。 -
Head
: Used when the client is requesting some information about a resource but not requesting the itself. 当客户端向Web服务器请求一个资源的一些信息而不是资源的全部信息的时候使用。 -
Post
: Used when the client is sending information or data to the server for example,filling out an online form (Sends a large amount of complex data to the web server) 当客户端向服务端发送信息或者数据的时候使用–例如,表单提交(向Web服务器发送大量的复杂的数据)。 -
Put
: Used when the client is sending a replacement document or uploading a new document to web server under the request URL 当客户端向Web服务端指定URL发送一个替换的文档或者上传一个新文档的时候使用。 -
Delete
: Used when the client is trying to delete a document from the web server,identified by the request URL 当客户端尝试从Web服务端删除一个由请求URL唯一标识的文档的时候使用。 -
Trace
: Used when the client is asking the available proxies or intermediate servers changing the request to announce themselves. 当客户端要求可用的代理服务器或者中间服务更改请求来宣布自己的时候使用。 -
Options
: Used when the client wants to determine other available methods to retrieve or process a document on the web server. 当客户端想要决定其他可用的方法去检索或者处理web服务端的一个文档时使用 -
Connect
: Used when the client wants to establish a transparent connection to a remote host,usually to facilitate SSL-encrypted communication(HTTPS) through an HTTP proxy. 当客户端想要确定一个明确的连接到远程主机的时候使用,通常通过http代理服务器帮助进行SSL加密通信(HTTPS)连接。 -
Patch
(March 2010): Used when the client wants to update a local resources in web server. 客户端想要更新局部web服务器资源时使用。
The Main Difference between HTTP1.1 and HTTP1.0
Keep-alive
-
The HTTP 1.0 needs to use the keep-alive parameter to inform the server that a long connection is to be established, and the HTTP1.1 is supported by a long connection by default.
-
HTTP is based on TCP/IP protocol. it is a certain cost that creat a TCP connection requires three handshake. If every sessions is re established, the performance will be affected. So it’s best to keep a long connection, and you can use a long connection to send multiple requests.
##