1.1 Communication
Web content is stored on the server, and the Web Service uses the HTTP protocol, so it is often called an HTTP server. The communication process makes a request for the client (which we normally use), and the server responds to the client's HTTP request, which is the basic HTTP traffic.
1.2 Transferring content with additional type MIME
The client gets more than n types of content to the server, such as: Word, JPEG, AVI, HTML, and thousands of others.
The Web server appends a MIME type to all HTTP object data for resolving the transport content type during the transfer process. When a Web browser (client) obtains an object from the server, it determines how the object is handled based on the MIME type tag.
MIME types are a type of this tag that represents a primary object type and a specific subtype, separated by a slash.
Example: HTML-formatted text document tagged with text/html type
ASCII text documents are marked by the Text/plain type
JPEG version of the picture is image/jpeg type
1.3 URI, URL, URN
URI (Uniform Resource Identity): The Uniform Resource Identifier is the specific name of each resource on the server, and the URL is the unique identifier of the resource and locates the information resource.
URL (Uniform Resource location): Uniform Resource Locator, which describes the specific locations of a resource on a particular server, which can clearly explain how to get resources from an exact, fixed location.
Example: Http://www.baidu.com/images/Logo.gif get Baidu Site logo icon (this URL I write blindly, examples of the main, we understand the good)
The meaning of each part of the URL type:
- The first part of the URL is a scenario that describes the type of protocol used to access the resource, which is typically an HTTP
- The second part is the server's Internet address (server name) in the example above: www.baidu.com
- The rest of the section has a specific path location for a resource
Urn (Uniform Resource name): Uniform Resource name, URN is used as a unique name for a specific content, regardless of where the resource is located.
1.4 Things
An HTTP thing consists of a request command and a response result. This communication is done through the format data block of the HTTP message.
Method:
Status code: Each HTTP response message will be returned with a status code identifying the response status
-
- 200:ok, correct return
- 302:redirect, Find resources elsewhere
- 404:not Found, unable to find resources
1.5 Messages
A message is a simple string of one line, not a binary code
A request message sent from the client to the server, and a response message sent from the server to the client
The HTTP message consists of three parts:
- Start line Request message: Description of what to do; Response message: Describe what
- The first field is optional, some generally contain mime and length, etc.
- The main body is dispensable, can be the client or the service side of each other transmission of various types of data
1.6 Connections
HTTP is the application layer protocol, does not care about the communication details, the specific details have the Transport Layer TCP/IP solution
Remark, the meanings of each layer, from top to bottom:
- HTTP Application Layer
- TCP Transport Layer
- IP Network Layer
- Network-specific Link interface Data link layer
- Physical network hardware physical layer
The IP address extreme number is required before the HTTP client sends a message to the server to establish a TCP/IP connection with the server, so the IP and port number of the server must be resolved within the URL (the destination may not be the same as the port number)
Example 1:url:http//:www.baidu.com:80/index.html
Example 2:url:http//:192.168.1.3:80/index.html
As can be seen from the above example: Example 1 is not in digital form IP, using a text-based domain name, or can be called a host name
Example 2 uses the digital IP
Example 1, example 2, the port number is the default 80 (default 80 can not write)
The complete process of connecting and communicating is:
- The browser obtains the IP or host name from the URL (gets converted to an IP address) and the port number
- Establish a TCP connection to the Web server
- The browser sends an HTTP request message to the server
- The server sends an HTTP response message to the client
- Close the connection, the browser displays the response content
1.7 Protocol version
- http/0.9 old, more design flaws, only support get, not support headers, MIME, etc.
- http/1.0 wide application version with basic features
- http/1.0+ widely popular, informal version
- http/1.1
- Http-ng (aka 2.0)
1.8 Structure components of the web
1. Agent
The agent is located between the client and the server, receives all HTTP requests from the client and forwards the requests to the server, and the agent can filter the requests and responses, such as masking video, virus detection, etc.
2. Caching
When a proxy transmits a common document, the cache stores the document and can enjoy the services provided by the private copy of the cache when the client requests the same document again
3. Gateways
The gateway encapsulates requests for other protocol types into HTTP protocol messages, which are sent to the client
4. Tunnels
Send files and content through a tunnel, encrypt them
5.Agent Proxy
Various browsers
Above.
Follow-up will continue to take notes ~ ~
HTTP Authoritative Guide Notes-Overview