HTTP protocol

xiaoxiao2021-03-06  42

The basic protocol of the Internet is the TCP / IP protocol, such as: FTP, HTTP, etc. is the application layer protocol built on the TCP / IP protocol. The main protocol used by the WWW server is the HTTP protocol (Hypertext Transfer Protocol), HTTP protocol support The service is not limited to WWW. Features of the HTTP protocol: support client / server mode, no connection, and stateless. The mode of operation is based on the request / response paradigm. The internal operation process is: 1. Establish a connection, the customer and server is a relative concept. When the WWW server is running, it has been listened to the TCP80 port (the default port of WWW), waiting for the connection. The establishment of the connection is achieved by the application socket. The customer opened a socket and constrained it on a port. If success, it is equivalent to establishing a virtual file. Equivalent to the operation of the virtual file. 2. Send a request, after opening a connection, the client sent the request message to the server's dating port to complete the request action. The requested format is: request message = request line (General Information | Request Head | Entity First) CRLF [Entity Content] Request Row = Method Request URL HTTP version number CRLF method = GET | HEAD | POST | Extension method U r l = protocol Name Host Name Directory and File Name Head - Requires the server to find meta information of an object, not the object itself. POST - transmits data from the client to the server, and uses the POST method when requiring the server and CGI for further processing. POST is mainly used to send the content of the FORM in the HTML text, allowing the CGI program to process. An example of a request is: get http://neetworking.zju.edu.cn/zju/index.htm http / 1.0 header information is also called metaminic information, ie information information, and use meta information to achieve conditional requests or answer. Request Head - Tell the server how to explain this request, mainly including the data type, compression method, and language that users can accept. The physical header - solid information type, length, compression method, last modification time, data validity period, etc. Entity - request or response object itself. 3. Send a response, the server sends a response message to the client after processing the client's request. Response message format of HTTP / 1.0: Response message = status line (General Information Head | Response Head | Entity First) CRLF [Entity Content] Status Row = HTTP Version Number State Code Reason Narrative Information Includes: Service Program, Notice The URL requested by the customer needs to be authenticated, when the requested resources can be used. 4. Turn off the connection: Both the customer and the server can end the TCP / IP conversation by closing the socket.

转载请注明原文地址:https://www.9cbs.com/read-72003.html

New Post(0)