1.http Protocol Introduction
HTTP is a request/response protocol that transmits data based on the TCP protocol.
HTTPS is a combination of the HTTP protocol and the condom layer (SSL), the security-enhanced version of HTTP.
The HTTP request consists of three parts: the request line, the message header, and the request body (optional).
Request line e.g.
get/http/1.1
Request Line Format:
1) Method (Request method) 2) Request-uri (Uniform Resource Identifier) 3) Http-version (HTTP protocol version) 4) CRLF (carriage return or newline)
Request Method:
Get: Request to get the resources identified by Request-uri Common
Post: Append new data to the resource identified by Request-uri common
HEAD: Request for a response message header for the resource identified by Request-uri
PUT: The requesting server stores a resource and uses Request-uri as its identity
Delete: Request Server Delete Request-uri The resource that is identified is commonly used
TRACE: Requests the server to echo received request information, primarily for testing or diagnostics
CONNECT: Keep Future use
Options: Request performance of the query server or query for resource-related options and requirements
The HTTP response consists of three parts: the status line, the message header, the response body
Status Line e.g.
http/1.1 OK
Status code:
1**: Indication information-Indicates that the request has been received and continues processing
2**: Success-Indicates that the request has been successfully received, understood, accepted
3**: Redirect--further action is required to complete the request
4**: Client Error--Request syntax error or request not implemented
5**: Server-side error-the server failed to implement a legitimate request
Common Status Codes:
$ OK//client request succeeded
Requests Bad//client request syntax error, cannot be understood by the server
401 Unauthorized//request unauthorized, this status code must be used with the Www-authenticate header field
403 Forbidden//server receives request, but refuses to provide service
404 Not Found//request resource does not exist, e.g. the wrong URL was entered
Internal Server error//server unexpected errors
503 Server Unavailable//server is currently unable to process client requests and may return to normal after some time
HTTP protocol performance-related technical essentials