HTTP (Hypertext Transfer Protocol) is an application layer protocol used to transfer data between web browsers and web servers. HTTPS is a secure version of HTTP, which uses encrypted channels to ensure that the transmitted data is not tampered with, eavesdropped and forged. The specific differences are as follows:
- The encryption methods are different: HTTP is transmitted in plain text, while HTTPS uses the SSL/TLS protocol for encrypted transmission to ensure the security of transmitted data.
- Different connection methods: HTTP uses TCP three-way handshake to establish a connection, and HTTPS uses SSL/TLS handshake in addition to TCP three-way handshake to establish a more secure connection.
- The default ports are different: HTTP uses port 80 by default, and HTTPS uses port 443 by default.
The common HTTP status codes are as follows:
- 1xx (information class): Indicates that a request has been received and processing continues.
- 2xx (success): Indicates that the request has been successfully received, understood, and accepted by the server.
- 200 OK: The request was successful.
- 204 No Content: The request is successful, but the returned response message does not contain the body of the entity.
- 206 Partial Content: The client sent a GET request with a Range header, and the server responded successfully.
- 3xx (redirect): Indicates that further action by the client is required to complete the request.
- 301 Moved Permanently: The requested resource is permanently moved to a new URI, ie redirected.
- 302 Found: The requested resource was temporarily moved to a new URI, i.e. redirected.
- 304 Not Modified: The client sent a GET request with an If-Modified-Since or If-None-Match header, and the entity responded by the server has not been updated.
- 4xx (client error): Indicates that there is an error in the client's request.
- 400 Bad Request: An error occurred in the request, and the server did not create or modify data.
- 401 Unauthorized: Indicates that the request requires authentication information for HTTP authentication.
- 403 Forbidden: Indicates that access to the requested resource is denied by the server.
- 404 Not Found: The server cannot find the resource according to the client's request.
- 5xx (Server Error): Indicates an error on the server side.
- 500 Internal Server Error: The server encountered an error while executing the request.
- 502 Bad Gateway: The server, acting as a gateway or proxy, received an invalid response from the upstream server.
- 503 Service Unavailable: The server is temporarily overloaded or under maintenance, unable to process client requests.