HTTP protocol Advanced (i) HTTP overview

Source: Internet
Author: User
Tags ftp protocol

Some time ago, some basic knowledge of the HTTP protocol learned and collated notes, sent to the blog, recently intermittently look at some more in-depth about the HTTP protocol things, incidentally also organized ...

Of course, some of the content may overlap with the previous blog content, but basically on the basis of the deepening of the consolidation, later, it is estimated that in passing the TCP protocol a little something, well, so ...

--Reference book "http authoritative guide"

1. Web Client and server

The HTTP client makes the request, which contains the content of the request, to the server, the server returns the data in the content, and the HTTP client and server constitute the basic components of the World Wide Web

We often say that the client is a Web browser, such as Microsoft's IE, Google Chrome, Firefox firefox, etc., the browser sends the HTTP request object to the server and displays the object on your screen

2. Resources

Web server is the host of web resources, source; The simplest web resource is a static file in the server file system, which may contain many things: text files, HTML files, Word files, picture files, avi movie files, Adobe's Acrobat files and all the files you can imagine

But resources are not limited to static files, it can also generate software programs (such as Live photos of the camera, stock transactions, database of real estate transactions, gifts from the online store, etc.).

In short, all types of content come from resources ...

2.1 Media Type

There are thousands of different data types on the Internet, and HTTP has a data format label of MIME type (MIME type) for each object that needs to be transmitted over HTTP

MIME: Multi-purpose Internet Mail extension

Each time a Web browser fetches an object from the server, it looks at its MIME type to see if it can handle the type; Most browsers can handle hundreds of common types of objects

A MIME type is a text marker that represents a primary object type and a specific subtype, separated by a slash, for example

HTML-Formatted text document: test.html

Normal ASCII text document: Test/plain

Image type: Image/jpeg, image/gif

2.2 URI

Each server resource has a name so that the client can tell what resources it is interested in

Server resource name is called: Uniform Resource Identifier (Uniform Resource Identifier,uri)

URIs, like postal addresses on the Internet, uniquely identify and locate information resources around the world

2.3 URL

URL: A Uniform Resource locator is the most common form of a resource that describes a specific resource on a particular server and clearly explains how to get resources from a precise, fixed location

URL that describes the protocol, server, and local resources

Most URLs follow a standard format that contains three parts:

The first part: the scheme; Describes the type of protocol used to access the resource, typically the HTTP protocol: hhtp://

Part II: Address; For example: www.baidu.com

Part III: Specify a resource on the server, for example: Specisal/saw-blade.gif

2.4 URN

The second way of a URI is a urn: a Uniform Resource name; a urn is used as a unique name for a specific content, regardless of where the current resource is located, using a URN, you can move resources around, and use the same name to access resources through multiple network protocols

The urn is still in the experimental phase because its efficient work requires a supporting architecture to parse the location of the resource. And this kind of architecture is relatively scarce, the following detailed introduction

3. Business

A transaction consists of a request command and a response result, which is made by a formatted chunk of HTTP message (HTTP message)

Transactions can also be understood as a process of complete communication from the client to the server to the client

3.1 Methods

HTTP supports eight different request commands, called methods, each request message contains a method that tells the server what action to perform, before having specifically described these methods, Portal: http://www.cnblogs.com/imyalost/p/5630940.html

3.2 Status Code

Each response message will carry a status code to inform the client, request the result, or whether other actions are required, before the introduction of these status codes, Portal: http://www.cnblogs.com/imyalost/p/5688169.html

3.3 A Web interface can contain multiple objects

is usually not a single resource, but a collection of resources (a transaction obtains a resource, different resources "even distributed on different servers" compose an interface)

4. Message

Composition: A simple line of string composition

Features: Plain text, easy to read and write

Request message: Sent from client to server

Response message (Response message): Sent from server to client

The HTTP message consists of the following three parts:

Start line: The first line of the message, to explain what to do, what happened

First field: After the starting line, there are 0 or more, each header field contains a first name and a value, easy to parse, separated by a colon (:), ending with a blank line

Subject: Empty line below is the message body, which contains all types of data

5. Connection Agreement

5.1 TCP/IP

The HTTP protocol is the topmost application layer protocol that is located in the entire data transmission communication, not paying attention to details, the protocol responsible for communication details is the Transport Layer Control Protocol (Transmission control PROTOCL,TCP)

TCP Features:1) Error-Free data transfer

2) sequential transmission (according to the data sent in the order to reach the server)

3) non-segmented data stream (any size will send the data out at any time)

Internet is the world's most commonly used computer and network equipment hierarchical packet Switching network protocol set, which hides the network and hardware characteristics and weaknesses, so that all types of computers and networks can be reliable communication

Here's the five-tier protocol stack for the Internet Protocol.

5.2 Connection, IP address and port number

Before a client sends a request message to the server, it needs to establish a TCP/IP connection channel between the client and the server with an Internet Protocol (PROTOCOL,IP) address and port number

URL is the address of the resource, nature can provide us with storage resources of the machine's address, look at the following URL:

Http://207.200.83.29:80/index.html

Http://www.netscape.com:80/index.html

Http://www.netscape.com/index.html

The first IP address 207.200.83.29 using the machine, and the port number 80

The second uses the text form of the domain name (host name: IP address compared to the human nickname). The hostname is converted through the domain name Service,dns mechanism, which is described in detail later in this section

The third does not have a port number, which typically has a default port number of 80.

A process map for a browser to display a simple HTML resource in the server over HTTP

The steps are as follows:

1) The browser resolves the server host name from the URL;

2) The browser converts the hostname to the IP address of the server;

3) The browser resolves the port number (if any) from the URL;

4) The browser establishes a connection to the server TCP connection channel;

5) The browser sends an HTTP request message to the server;

6) The server sends an HTTP response message to the browser;

7) End the communication, close the connection, the browser displays the specific resources;

Speaking of which, I would like to write about the data communication when the so-called "three-time handshake", but the previous HTTP protocol has been introduced in the foundation, still do not know what to look for, in fact, the package of data

6. Protocol version

The HTTP protocol version we are using today is http1.1, which focuses on correcting structural flaws in HTTP design, clarifying semantics, introducing important performance optimizations, and removing some bad features

Http-ng (http2.0): A prototype recommendation for the successor structure of http1.1, with a focus on performance optimization and a more powerful remote execution framework for service logic

At present, http2.0 is still in the negotiations, the new technology may be applied to the following 7 kinds, do not exclude the possibility of significant changes

7. Structure components of the web

The Web application, in addition to the browser and server, there are several other important components (the previous blog has been introduced, so here is a general explanation of their functional usefulness)

7.1 Proxy: an HTTP intermediate entity located between the client and the server

Important components of web security, application integration, and performance optimization

For communication security reasons, the agent is used as a trusted intermediary for forwarding all web traffic, and the request response can be filtered, followed by detailed

7.2 Cache:HTTP warehouse, so that the common page resources can be kept closer to the client location

Web cache or proxy cache, you can save the commonly used allowed cache of the proxy, the next request if the same resources, you can directly enjoy the resource

HTTP defines a number of features for caching, makes caching more efficient, and regulates the expiration and privacy of cached resources, which are detailed later

7.3 Gateway: A special Web server that connects other applications

Gateways typically convert HTTP data to other protocols, accepting requests as if they were source servers for a resource, such as

An HTTP/FTP gateway accepts requests for Ftp-url from an HTTP request, but obtains resources through the FTP protocol, and the resulting resources are encapsulated into an HTTP message that is sent to the client

The details of the specific gateway are detailed in the following

7.4 Tunneling: A special HTTP application for blind forwarding of HTTP communication messages

Tunnels are commonly used to host encrypted Secure Sockets Layer (secure scokets layer,ssl) traffic over an HTTP connection so that SSL traffic can pass through firewalls that only allow web data to flow through

Tunnels can forward data on non-HTTP networks (Http/ssl tunnels are shown)

7.5 Agent Proxy: semi-intelligent Web client program that initiates automatic HTTP requests on behalf of users

Other types: Automatic user roaming on the Web using Agent agent, unattended to publish HTTP transactions and get content, such as: "Network Spider", "Network Robot" and so on

Automatic search engine "network spider" is agent agents, can be worldwide access to Web pages

Basically this content and the previous HTTP protocol essay has a lot of overlap, but more in-depth to introduce, these are just some of my study notes, from some books to extract the focus to do a summary,

The next period of time, I will organize more study notes, if there is a description is incorrect or omitted, hope to see friends can comment area proposed, I update, thank you ...

HTTP protocol Advanced (i) HTTP overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.