In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Brief introduction of HTTP Protocol
HTTP protocol, the Chinese name "hypertext transfer protocol", is one of the most commonly used network protocols on the Internet. The important application of HTTP is WWW service (Internet service), that is, the application used for communication between WEB browser and WEB server, which we used to call www application or web application.
The HTTP protocol was designed to provide a way to publish and receive HTML (a page markup language hypertext markup language) pages.
WWW, abbreviated as web, is translated into Chinese as "World wide Web". WWW applications use the HTTP protocol. The default service port for WWW service of HTTP protocol is 80; the default port for another encrypted WWW service https is 443. 0.
Version of the HTTP protocol
HTTP protocol has experienced several versions of HTTP/0.9, HTTP/1.0 and HTTP/1.1 from its birth to now, of which HTTP/1.0 is the first widely used version, and HTTP/1.1 is the mainstream version currently used.
HTTP/1.0 introduction
HTTP/1.0 adds HTTP request headers on the basis of HTTP/0.9, supports more request methods, and handles multimedia objects. HTTP/1.0 stipulates that the browser only maintains a short connection with the server. Each request of the browser needs to establish a TCP connection with the server. The server disconnects the TCP connection immediately after completing the request processing, and the server does not track each client or record past requests.
HTTP/1.1 introduction
HTTP/1.1 is important to fix the defects in HTTP design, including scalability, cache processing, broadband optimization, persistent connection, HOST header, error notification, message delivery, content negotiation and so on.
In terms of connections, HTTP/1.1 supports persistent connections, and multiple TCP requests and responses can be transmitted on one HTTP connection, reducing the consumption and delay of establishing and closing connections.
In terms of request headers, HTTP/1.1 adds more request headers and response headers to enhance the function of HTTP. This allows WEB browsers to use host headers to specify which WEB site on the server to access, so that multiple virtual WEB sites can be configured on the same IP address and port using WEB services.
HTTP request method
In HTTP communication, each HTTP request message contains a method. It is used to tell the WEB server what specific actions to perform, including: getting the specified WEB page, submitting the content to the server, deleting the resources on the server, and so on. The methods contained in these HTTP request messages are called HTTP methods.
Commonly used HTTP methods
The GET client requests the specified resource information and the server returns the specified resource
HEAD only requests the HTTP header in the response message.
POST submits the data from the client to the server, for example: registration form
The data sent by PUT from the client to the server replaces the specified document content
DELETE requests the server to delete the specified resource
MOVE requests the server to move the specified page to another network address
HTTP status code
Whenever the client sends a HTTP request to the server, the WEB server returns a status response code. This status code is a three-digit number to tell the WEB client whether the request was successful or to take some other action.
The status codes of HTTP/1.1 are divided into five categories
100-199 is used to specify certain actions corresponding to the client
200-299 is used to indicate that the request was successful
300-399 is used for files that have been moved and are often included in the location header information to specify new address information. (redirect)
400-499 is used to indicate the client's error
500-599 is used to indicate server error
Common status codes and their corresponding functions
The 200 OK server successfully returned a web page, which is the standard status code returned by a successful http request
301 Moved Permanently permanent redirection
403 Forbidden forbids access, this request is legitimate, but the server refuses to respond to the client's request because it matches the preset rules, which is usually caused by improper configuration of server permissions.
The Not Found server cannot find the specified page requested by the client, which may be caused by the client requesting a resource that does not exist on the server.
500 Internal Server Error internal server error, the server encountered an unexpected situation and was unable to complete the customer's request. This is a general error report, usually caused by server setup or internal program problems. (selinux is not closed,)
502 Bad Gateway bad gateway, generally, when the proxy server requests the back-end service, the back-end service is not available or the response gateway server is not completed, which is usually caused by the problem of the node under the proxy server.
The Service Unavailable service is currently unavailable, either due to server overload or downtime maintenance, or because there is no node behind the proxy server that can provide services.
Gateway Timeout gateway timeout, generally, when the gateway proxy server requests the back-end service, the back-end service does not complete the processing of the request within a specific time. Generally, the overload of the server leads to the failure to return data to the proxy server within the specified time.
There are two types of HTTP messages:
One is the HTTP message sent by the WEB client to the WEB server, which is called the request message.
One is a message sent from a WEB server to a WEB client, called a response message.
The HTTP request message consists of a request line, a request header (header), a blank line and a request message body.
Request line request method URL protocol version
GET / index.html HTTP/1.1
Request header field name 1: value 1
Field name 2: value 2
Blank line
The request message body GET method does not have the request message body, but the POST method does.
The HTTP response message consists of the starting line, the response header (header), the blank line and the body of the response message.
General format of HTTP response message
Starting line protocol and version number digital status code status information
HTTP/1.1 200 OK
Response header field name 1: value 1
Field name 2: value 2
Blank line
Response message body (may be web page, video, picture)
Fiddler Web Debugger 4 (abbreviated as Fiddler4) is a powerful HTTP web page package grabbing debugging tool (HTTP protocol debugging agent tool). Fiddler4 data capture package software can record all client and server http and https requests, allowing users to monitor, set breakpoints, and even modify input and output data.
Introduction to HTTP Protocol MIME (Multipurpose Internet Mail extension) types
When the web server responds to a HTTP request, it adds a MIME type to each HTTP object data. When the WEB browser gets the object returned by the server, it will look at the relevant MIME type and deal with it accordingly.
You can view the supported media (MIME) types from the conf directory of the configuration file of www service software nginx.
Less mime.types
MIME type file type
Text/html html htm shtml
Text/css css
P_w_picpath/gif gif
.
URI and URL of HTTP Protocol
URL, the full name of "uniform resource locator", is also known as web address
URI uniform Resource Identifier
It can be understood that all URL are URI.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.