1. HTTP request format:
Request-line
Headers (0 or multiple)
<Blank line>
Body (valid only for post requests)
The request-line format is:
Request request-Uri HTTP Version Number
1) For a GET request, return any information specified by request-Uri.
2) A head request is similar to a GET request, but the server program only returns the header information of the specified document, excluding the actual document content. This request is usually used to test the correctness, accessibility, and recent modifications of hypertext links.
3) post requests are used to send emails, news, or forms that can be filled by interactive users. This is the only request to send the body in the request. When using post requests, you must specify in the Content-Length Field of the Message Header
Body length.
2. HTTP/1.0 response format:
Status-line
Headers (0 or more)
<Blank line>
Body
The status-line format is:
HTTP Version: Response-code response-phrase
3. Header field:
The packet header can be divided into three types: request, response, and description subject.
4. Response Code
References:
TCP/IP details Volume 3
Thomesca (beicai): http://blog.csdn.net/thomescai
(Reprinted and retained)