HTTP Request
An HTTP request consists of three parts: request line, request header domain, and request body.
Agreed request Structure
Request Line
Method
SP Request-Uri
SP HTTP-version
CRLF
Request MethodMethod
Method |
Description |
Get |
Resource identified by the request URI |
Post |
Request the resource identified by the URI and transmit data |
Head |
Request to obtain the Response Message Header of the resource identified by the URI |
Put |
Request to store a resource, similar to put in FTP |
Delete |
Request the server to delete the resource identified by the URI |
Trace |
Request Message received by the server |
Connect |
|
Options |
|
Request Header domain
Request body
Data content transmitted to the server
Example
1,GetRequest,GetGenerally, requests do not contain Request body content.
2,PostRequest
3,ConnectRequest
HTTPResponse
HTTPThe response is also divided into three parts: Status line, Response Header domain, and response body.
Agreed response structure
Status line
HTTP-version
SP Status-code
SP Reason-phraseCRLF
Status Code
Status Code |
Description |
1 ** |
Indicates that the request has been received |
2 ** |
Successful, indicating that the request has been successfully received, parsed, and processed |
3 ** |
Redirection. Further operations must be performed to complete the request. |
4 ** |
Client error. The client sent an invalid request. |
5 ** |
A server error occurs. The server fails to process valid requests. |
Response Header domain
Example
1Normal response
Materials
- Rfc2119/Rfc1945/Rfc2616
-
- Http://www.fiddler2.com/fiddler/help/http/headers.asp
-