Details about HTTP

來源:互聯網
上載者:User

標籤:rom   ceo   closed   row   refresh   diff   file   ide   nsf   

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.