Details about HTTP

Posted pp_crz_coder

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Details about HTTP相关的知识,希望对你有一定的参考价值。

HTTP(Hyper Text Transfer Protocol) is managed by W3C institute. There are two versions 1.0 and 1.1. The version 1.1 is used widely.

But what‘s the difference of the two versions?

  Version 1.0 : the request sended to the server and the response back to the client then the connection will be closed immediately.

  Version 1.1 : the connection could be used many times.

How to prove the difference? Use the telnet command in cmd.

 

The http request and http response are two main parts.

Request:

  GET /myapp/1.html HTTP/1.1             ----->  the submit method ; the source‘s path ; the http‘s version

  Host: localhost:8080          ----->  the host‘s address include the host‘s name and the port

  Connection: keep-alive        ------> the connection status

  Upgrade-Insecure-Requests: 1          ------> 

  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8       -----> the accepted MIME type , we can search the name via web.xml

                                            which has the tag :

                                                    <mime-mapping>

                                                      <extension>html</extension>

                                                      <mime-type>text/html</mime-type>

                                                    </mime-mapping>

  Accept-Encoding: gzip, deflate, sdch, br  -----> tell the server the browser support which kind of encoding type.

  Accept-Language: zh-CN,zh;q=0.8   -----> the language browser could use.The header‘s value could be set in the browser‘s setting . "q=0.8" represents the                     using frequncy of the language.The accept-language could support different accept-charset.

  Referer:http://localhost:8080/myapp/2.html  -----> Include an URL and user accesses the page via the URL.Referer could be used to count the flow.

  -----> there should reserve a blank row

 

Response:

  HTTP/1.1 200 OK           ----->  the http version ; the status code(200:normal 302:foward 404:resource not found 500:server error) ;

                        the connecting status

  Server: Apache-Coyote/1.1         -----> 

  Accept-Ranges: bytes

  ETag: W/"43-1499953570000"

  Last-Modified: Thu, 13 Jul 2017 13:46:10 GMT

  Content-Type: text/html       -----> the MIME type which the server send to the client.  

  Content-Length: 43        -----> tell the client the text‘s length 

  Date: Fri, 14 Jul 2017 14:52:58 GMT

  Refresh:1                    -----> refresh the page per sceond.

  Location:http://www.it315org/index.jsp      -----> forward to the new resource location.

  Content-Disposition: attachment;filename=aaa.zip                      -----> indicate the client to download the file.

  Set-Cookie:SS=Q0=5Lb_nQ;path=/search

  Expires:-1                                     ----->  the value=-1 means the page‘s cache will be destroied immediately.

  Cache-Control:no-cache(1.1)  -----> the page‘s cache will not exist.

  Pragma:no-cache(1.0)

  Connection:close/Keep-alive

  -----> there should reserve a blank row 

  <body>                ----
    <h1>Hello JavaWeb!</h1>       | ----> this is the response‘s entity content
  </body>                 ---- 

 

The GET method to submit data , the data will be put in the url address and start with "?" followed with the data and the data‘s value.

While the POST method to submit the data , the data will be put in the request enetity and the data‘s capacity is unlimited.

 

以上是关于Details about HTTP的主要内容,如果未能解决你的问题,请参考以下文章

things about python

Quartz.NET笔记 More About Jobs & JobDetails

ionic 4 如何动态添加 svg 图标 - title: 'About', url: '/about' , icon:'person'

学习网站

错误:为 URL About (src\pages\About.js) 导出 HTML 失败:不变量失败

JVM Internals