Each message consists of three parts: starting line, header, body
(both the starting line and the header are ASCII text delimited by rows.) Each line ends with a two-character line termination sequence, including a carriage return (ASCII code 13) and a newline (ASCII code)) (\ r \ n)
Format of Request message:
<method><request-url><version>
<entity-body>
Get/test.txt http/1.1accept:text/*host:www.baidu.com
Format of the response message
<version><status><reason-phrase>
<entity-body>
http/1.0 okcontent-type:text/plaincontent-length:19hi! I ' m a message!
Common HTTP methods
| Method |
Describe |
Whether the body is included |
| GET |
Get a copy of a document from the server |
Whether |
| HEAD |
Get the header of the response message from the server only |
Whether |
| POST |
Send data to the server that needs to be processed |
Is |
| PUT |
Store the principal part of the request on the server |
Is |
| TRACE |
Tracking of messages that may go through a proxy server to the server |
Whether |
| OPTIONS |
Decide which methods can be executed on the server |
Whether |
| DELETE |
Delete a document from the server |
Whether |
Common HTTP status Codes
HTTP Learning Notes