The advent of wen2.0 era, the Internet from C/S architecture to B/s architecture
b/S IE browser/server structure
Web requests, interactive data based on the Unified Application Layer protocol (HTTP protocol)
HTTP, the Hypertext Transfer Protocol, is a rule that specifies the communication between the browser and the World Wide Web server, and is the foundation of the World Wide Web, which allows HTML (Hypertext Markup Language) documents to be routed from a Web server to a Web browser
Initiate an HTTP request: Enter a URL in the browser's address bar and enter
Using tools to initiate HTTP requests: The CURL command of the Linux system, the Curl.exe of the Windows system through Curl+url, allows you to view the HTTP response headers returned by the server after accessing the URL
Browsers only have more HTML rendering capabilities in terms of HTTP protocol.
URL: Uniform Resource Locator, also known as Web address, is the address of the Internet standard
URL standard format: protocol://www.xxser.com/post/httpxieyi.html
The HTTP protocol is detailed:
HTTP protocol Current version 1.1
HTTP is a stateless protocol, stateless refers to the Web server and the Web browser does not need to establish a persistent connection, the server side does not retain information about the connection, the HTTP request can only be initiated by the client and the server cannot actively send data to the client
HTTP follows the request/response model
HTTP request: Includes three parts: Request line (Request method), request header (message header), request body
An example:
post/login.php http/1.1//Request Line
host:www.xxser.com//Request Header
user-agent:mozilla/5.0 (Windows NT 6.1; rv:15.0) gecko/20100101 firefox/15.0
Blank line, representing the end of the request header
username=admin&password=admin//Request Body
The request line has three parts: a POST request, a slash to indicate that the login.php is requested at the root of the domain name, and finally the HTTP version 1.1.
The second line to the blank line is the request header, also known as the message header, host represents the requested address, User-agent represents the browser identity, the request header is set by the client
Last behavior request body, request body optional
HTTP response
Three parts: Response line, response header, response body
First line Response line: HTTP version, status code, message
Second line to end whitespace behavior response header: server sends to client
Finally, the response body: The HTML data sent by the server to the client
HTTP request Method:
(1) Get: Used to get the specified information of the requested page, in the format of the entity, send the data has a size limit, and will send the data displayed in the browser side
If the request resource is a dynamic script (non-HTML), then the returned text is the Web container's parsed HTML source code, not the source file
Request parameters: ID Selective acceptance parameters, usually by the developer-designated parameters of the project will receive
(2) HEAD: Except that the server cannot return the message body in the response, the other same get
Often used to test the validity, accessibility, and recent changes of hypertext links, and to test the existence of resources
(3) POST: Similar to get, but the Get method does not request content, while Poat is the one with the requested content
Up to a large amount of data sent to the server, the data is not displayed on the browser side, security is relatively high
Example: Uploading files, submitting messages
(4) Put: Used to request the server to store the requested entity under the request resource, if the request resource already exists in the server, it will replace the original data, as the latest modified version of the specified resource, if the requested resource does not exist, the resource will be created, and the data bit request body
Typically, the server shuts down the Put method because it creates files for the server, one of the dangerous methods
(5) Delete: The specified resource that is used to request the server to delete the request, usually the server shuts down this method because the client can delete the file operation, which is one of the dangerous methods
(6) TRACE: Used to fire a request message loop from a remote application layer, echoing the request received by the server, which allows the client to understand what is being accepted at the other end of the data request chain, and use that data for testing or diagnostics
(7) CONNECT: Proxy for dynamic switch to tunnel (8) Options: A feature option that is used to request that the resource identified by the URL be used during the communication of the request response. The client can decide what necessary action to take on the resource, or understand the performance of the server, before taking a specific resource request
HTTP request Flow