zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    .Net基础:CLR基本原理
    行业软件开发商怎样来抢 BI 这块蛋糕?
    免费报表工具知多少?
    哪款报表工具更适合行业软件开发商?
    报表如何通过参数控制数据权限
    实现报表滚动到底部翻页效果
    报表 BI 选型的那些事
    零编码制作报表可能吗?
    为什么说当前报表开发的工作量主要在数据源环节?又如何解决呢?
    用存储过程和 JAVA 写报表数据源有什么弊端?
  • 原文地址:https://www.cnblogs.com/ppcoder/p/7183329.html
Copyright © 2011-2022 走看看