HTTP protocol Basics

Source: Internet
Author: User

Objective:

In the last blog post, the host communicates with each other by calling sockets, and the application layer protocol communicates based on the communication subnet.

  

One, version iterations:

HTTP(Hyper Text Transfer Protocol) is a Hypertext Transfer Protocol, and text that is developed in HTML programming languages is hyper-text. The initial http is just to accept HTML - formatted pages, just text, and cannot transfer non-text.

The http/0.9 Prototype version does not accept non-text transfers until http/1.0 adds a mime mechanism to transmit non-text, using MIME The mechanism is able to encode non-textual data into text data for transmission, allowing the user to open non-textual data (to avoid garbled characters) using the same encoding.

MIME(multipurpose Internet Mail extesion) is an early SMTP The mechanism of transmitting non-text protocol on the postal agreement.

at the same time, this is why the HTTP protocol can transmit non-textual data today.

Although http has been added to the MIME mechanism earlier, not all browsers support all media types, which requires the browser to call other plugins or other applications to open.

http can, by requesting a file's suffix, determine which browser's program is open and then embed it in the browser .

Second, standard replenishment

HTTP is an application-layer protocol that listens to tcp/80 ports By default and uses streaming data protocols to complete data exchange.

The HTTP protocol primarily completes the sending of documents across hosts. A complete http Protocol contains HTTP requests and http responses .

Requesting a site is equivalent to requesting a resource, but typically a site has several hyperlinks, which leads to requests for multiple resources behind a resource.

Third, accurate supply:

   The client initiates the Web request, the server accepts the request, and then responds to the client's encapsulation of the resource as an HTTP message response client, although it is easy to see In fact, this includes the following seven steps:

(1) establishing or processing the connection:

Establish virtual link traffic based on TCP, or close some client requests. http is an application-layer protocol that requires the Transport layer protocol to take effect before an http connection can be established , and the HTTP protocol itself is the one that supports access control

(2) Accept the request:

accepts a request for a resource from a request message in the network. Query the HTTP request message sent by the client , locate the request line , locate the request method , locate the resource Locator , and locate the protocol version number . ; Verify that the resources accessed by the user are allowed access, support this access method, and proceed to the next step if allowed.

in addition, Web The server has not only one response mode.

For example, Get/phptp/pig.jpg http/1.1

(3) Processing the request:

The request message is parsed, and information about the requested resource and the method of the request is learned.

(4) Access to resources

Gets the requested resource in the request message.

A Web server, a server that holds Web Resources, is responsible for providing the requestor with a static resource for the request, or dynamically running the generated resource, which is placed under the local file system path, which is often referred to as Docroot

For example, the default root directory is/var/www/html and the directory has php/1.php, and if you want to access it, the path you need to access is www.yyxx.com/php/ 1.php

(5) Building response messages

Package The response message and indicate the MIME Type

(6) Send Response message

TCP protocol- based acceptance sends a different dual channel, sending a response message by sending the recipient's own channel

(7) Record log

As the name implies, the methods, contents, and results of the resources accessed by the user are recorded on the server side

Iv. Expansion of Supplies:

the 1.web server responds to multiple IO models of the client :

Server concurrency response model ( Web I/O):

Single Process I/O structure: Initiates a process to process user requests and processes only one at a time, with multiple requests being serially responded

Multi-Process I/O fabric: Start multiple processes in parallel, each responding to a request

re-use I/O structure: A process responds to N requests

multiplexing Multi-process I/O fabric: Start multiple m processes, each responding to N requests

This is because there are so many I/O response mechanism, it is not the same way to accept and respond to client requests in different operating modes.

2. How to obtain a request for a resource:

Meta Data: Request headers

<method><URL><VERSION>

Host:www.xxyy.com The requested host name

Connetion:

3.web Server Resource mapping Relationship:

    A) Docroot

b) Alias

c) Virtual host Docroot

d) user home directory docroot

HTTP protocol Basics

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.