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.

时间: 2024-10-22 18:26:26

Details about HTTP的相关文章

【HTML5】用脚本控制交互元素details元素的使用

1.源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Con

Validation failed for one or more entities. See &#39;EntityValidationErrors&#39; property for more details.

Validation failed for one or more entities. See 'EntityValidationErrors' property for more details. 这里给大家介绍一个Exception类,让我们能够轻松的知道具体的哪一个字段出了什么问题. 那就是 System.Data.Entity.Validation.DbEntityValidationException,相信代码都知道怎么写了,最简单的就是 try{// 写数据库}catch (DbEn

三个不常用的HTML元素:&lt;details&gt;、&lt;summary&gt;、&lt;dialog&gt;

前面的话 HTML5不仅新增了语义型区块级元素及表单类元素,也新增了一些其他的功能性元素,这些元素由于浏览器支持等各种原因,并没有被广泛使用 文档描述 <details>主要用于描述文档或文档某个部分的细节,与<summary>配合使用可以为<details>定义标题.标题是可见的,用户点击标题时,显示出details [注意]这两个标签只有chrome和opera支持 <details> 该标签仅有一个open属性,用来定义details是否可见(默认为不

Don&#39;t care for details

1 package com.zero.lab1.main; 2 3 public class Seat { 4 5 private Integer seatNum; 6 7 private Boolean avaliable; 8 9 public Seat(Integer seatNum, Boolean avaliable) { 10 super(); 11 this.seatNum = seatNum; 12 this.avaliable = avaliable; 13 } 14 15 p

Kooboo中怎么新增一个关联的Details 动态页面。

Kooboo中怎么新增一个关联的Details 动态页面. 有几个要点: 1. Sub Page的Parent Page 必须是英文书写.如果是中文会出现找不到页面 500错误 2. 要在Page Mapping中设置 url和page的关联 3. page要改成dynamices的. Dynamic pages I A dynamic web page is a kind of web page that has been prepared with fresh information (co

C++ preprocessor &quot;/lib/cpp&quot; fails sanity check See `config.log&#39; for more details

Ubuntu 12.04环境下编译xapian时报此错误,因为从来没有在此系统下跑过C++,所以用C++编译器的时候出现此问题 出现该情况是由于c++编译器的相关package没有安装,以root用户登陆,在终端上执行: # sudo get-apt install glibc-headers # sudo get-apt install gcc-c++ 也可以 #sudo apt-get install build-essential 通过第二种方法安装完毕后,编译通过 C++ preproc

中文录入问题 转载自:http://blog.csdn.net/ichsonx/article/details/8625925

2.1中文录入问题 默认安装的msysgit的shell环境中无法输入中文,为了能在shell界面输入中文,需要修改配置文件/etc/inputrc,增加或修改相关配置如下: #disable/enable 8bit input set meta-flag on set input-meta on set output-meta on set convert-meta off 关闭bash再重启就可以输入中文了. 2.2分页器中文输出问题 对于/etc/inputrc正确配置之后能正确输入中文了

What technical details should a programmer of a web application consider before making the site public?

What things should a programmer implementing the technical details of a web application consider before making the site public? If Jeff Atwood can forget about HttpOnly cookies, sitemaps, and cross-site request forgeries all in the same site, what im

VMware下Ubuntu与宿主Windows共享文件夹 (转至 http://blog.csdn.net/zz962/article/details/7706755)

概述1.安装VMware Tool2.设置共享 步骤开始安装VMware Tool 显示如下画面(如果宿主无法访问外网,可能会出现一个更新失败,可以无视之) 通过下列命令解压.执行,分别是下面的tar和sudo的两行(下面是已有vmware tool的情况,注意密码是登录口令,不会显示) 一路按Enter,最后得到 在VMware中给虚拟机设置共享目录 执行mount命令(下图中sudo mount那一行),之后mnt/hgfs里就可以看到前面设置的共享目录 如果mnt出错,可以执行 sudo

IntelliJ IDEA提示:Error during artifact deployment. See server log for details.

IntelliJ IDEA-2017.1.1 tomcat-8.5.13 问题:在IntelliJ IDEA中使用tomcat部署web app时,提示:Error during artifact deployment. See server log for details IntelliJ IDEA 不自动打开浏览器,也无法手动从IntelliJ IDEA打开浏览器,可以通过在浏览器地址栏输入地址访问servlet IntelliJ IDEA无法直接在8080端口访问html,只能在63342