I. INTRODUCTION of HTTP
1, HTTP protocol: (Hypertext Transport Protocol), that is, Hypertext Transfer Protocol. This protocol details the rules for communication between the browser and the World Wide Web server (message format).
2. Message: the content that is transmitted when the client communicates with the server is what we call a message. the client is sent to the server called the " Request Message ", the server is sent to the client called " Response message."
3. Classification:
Request message:
GET request
POST request
Response message:
4. Message Format:
Message header: Includes Wenshou and message header
Second, GET request message
GET request message only: message header
First line of message
GET/BOOKSTORE01/B.HTML?USERNAME=DFADF&PWD=DFA http/1.1 //Request way request path? parameter Key value pair &
Message Header "Key-value pair format"
host:localhost:8080//Request destination IP address and port number
user-agent:mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) gecko/20100101firefox/27.0//Current browser
accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
//browser tells the server what format of file the browser can receive
accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
//You can tell which location you are in
zh-cn: Simplified Chinese
en-US: American English
Accept-encoding:gzip, deflate
//browser tells the server that the browser can identify the decompression method
referer:http://localhost:8080/bookstore01/index.html
//Referer: Refers to the page from which the current page is to jump over
connection:keep-alive
//keep-alive: Indicates that the browser tells the server that this is a long connection
Get requests do not have blank lines and message bodies, get requests are passed through the address bar parameters!
Third, POST request message
Request First Line
post/bookstore01/b.html http/1.1 //request Path Request Protocol/version number
//request Header
host:localhost:8080
User-ag ent:mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) gecko/20100101 firefox/27.0
accept:text/html,application/xhtml+ xml,application/xml;q=0.9,*/*;q=0.8
accept-language:zh-cn,zh;q=0.8, en-us;q=0.5,en;q=0.3
Accept-encoding:gzip, deflate
referer:http://localhost:8080/bookstore01/index.html
connection:keep-alive
Blank Line
Username=zhangsan //message body
The POST request has a blank line and a request body, and the POST request passes the request parameters through the request body!
Iv. Response Messages
Response First line:
http/1.1 OK // Protocol Name/version number response status Code status descriptor
server:apache-coyote/1.1
Accept-ranges:bytes
etag:w/"262-1510560961503"
Last-modified:mon, 08:16:01 GMT
GMT
Content-type:text/html
content-length:262
Date:mon, 08:44:55 GMT
An analysis of HTTP protocol GET request and POST request