HTTP

作者: crf1028 | 来源:发表于2016-11-28 11:07 被阅读0次

TCP建立连接(Three-way handshake)

  1. C --> S 握手请求
  2. C <-- S 确认请求
  3. C --> S 数据请求
  4. C <-- S 发送数据

Non-Persistent Connections

  • 一次数据发送完成后就关闭TCP连接

HTTP with Persistent Connections

  • 发送多次数据后再关闭TCP连接
  • 降低延迟但是占用服务器端网络资源
  • 一般情况下HTTP服务器会将已闲置一段时间的TCP连接关闭

HTTP request message example

GET /hello.htm HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.tutorialspoint.com
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
  • 其他请求方法包括GET, POST, HEAD, PUT, and DELETE

HTTP server respond message example

HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
Content-Length: 88
Content-Type: text/html
Connection: Closed
<html> <body> <h1>Hello, World!</h1> </body></html>

相关文章

网友评论

      本文标题:HTTP

      本文链接:https://www.haomeiwen.com/subject/knqopttx.html