Sixth application layer (DNS and HTTP protocol details)

Source: Internet
Author: User

Preface

This is the computer network based on the last blog, the general from the physical layer to the top of the application layer to do a general understanding, and spent a quick 1 months, at the end of this chapter will give you I study the course of video materials, I hope to help all want to learn to improve their skills of students, I see a lot of powerful blog posts are locked, I hope the Master degree can help just grow and want to work to improve the technology of people. So after I have a good time, will certainly help those who are confused, because they have been confused, go a lot of detours.

--wh

First, review

        

1, the OSI architecture is divided into 7 layers: Physical layer, link layer, network layer, transport layer, Session layer, presentation layer, application layer.

2, the architecture of TCP/IP is divided into 4 layers: network interface layer (physical layer, link layer), Internetwork layer (Network layer IP), Transport layer (UDP/TCP), application layer (Session layer, presentation layer, application layer)

3, the principle of architecture: Physical layer, link layer, network layer, Transport layer, application layer (Session Layer + presentation layer + Application layer)

I write the process is in accordance with the 3rd order, the relationship between the three don't confuse, the relationship is

OSI seven-layer protocol architecture: Advantages: Clear concept, complete theory, shortcomings but not practical

TCP/IP protocol family Four layer, disadvantage: too simple, but is widely used,

Combined with the pros and cons of the above two, there is a 5-layer protocol of the principle of architecture, that is, concise and the concept can be described clearly.

What is the function and function of each layer in the front 4 layers? The previous explanation is very clear.

Physical layer (i) physical Layer (ii)

Link layer (a) Link layer (ii) Link layer (iii)

Network Layer (i)

Transport Layer (i) three-time handshake, four-time wave

Second, the application layer

1. Concept

is located in the top layer of computer network architecture, the front four layers do all the things is for his service, he is also the ultimate goal of the design and establishment of computer networks, popular speaking, is that we develop application software, in this layer, for example, QQ, browser access to the Web, and so you see the application software are in this layer, However, these software in the process of operation, also need to rely on some specific protocol to complete the corresponding functions, such as the browser through the Web site access to the page, how it is done, this is what we have to learn.

2. There are two kinds of application software in application layer. client/server and peer -to architecture

Client/server (Client/server)

This type is what we are familiar with the client, the server model, the client request server, the server responds to the client as a way to "communicate"

P2p

Also known as peer architecture. Peer equivalent to each person's computer can be a server, but also when the client, not only limited to the client access to the server, your own computer can access the content of other people's computers, the other can also access the content on your computer, so as to achieve a shared state.

Iii. Examples of application layer protocols.

      1. DNS protocol

Domain Name System. It can also be called a domain name resolution protocol. When we visit a Web page in a browser, the usual degree is identified by a series of meaningful English characters that we are familiar with, such as www.baidu.com, www.sohu.com, and so on. But we learned the previous knowledge, the computer is not through these strings to find the corresponding computer, but through the 32-bit binary, which is our IP address to find. So there is the DNS protocol. His role is to resolve the domain name to the corresponding IP address. Because let us people to remember those IP address, it is difficult to remember to live, so we will find a way to change the IP address for the current domain name, in the visit, just to the domain name to the corresponding IP address on the line, the domain name is also very fastidious, which is divided into a lot of layers of domain names, is unique. This is not detailed here, as long as we know that the domain name through DNS can find the corresponding IP address on the line

How does the DNS protocol work?

1. Access to Web pages via domain name

2, the computer will first send the domain name to a server to resolve the domain name

2.1 There are a lot of servers on their servers, can parse a variety of domain names, such as the special parsing. org, parsing. com, parsing. Net. And so on, the main one has a root name server,

2.2 The process of domain name resolution (finding an IP address on the server) has two algorithms, iterative queries, and recursive queries. It's usually a combination of two types of queries.

2.3 The computer to find one of the resolving domain name of the server (possibly. com), if not find the corresponding IP address, then will go to the root name server, root name server know all the sub-server, so he must know that the domain name of the corresponding IP address in that sub-server, So tell the first query server to go to another server to find, found, and then return it to the computer, and later in another computer also through the domain access, then the first server will have the original domain name IP address of the cache, you do not have to find the root server.

3, found, you can find the server we want to visit.

        

              

      2. HTTP protocol

          The Uniform Resource Locator URL.

URL: Uniform Resource Locator, as can be seen in the following format, is used to locate the resources we need on the server location.

Format:< Protocol >://< host >:< ports >/< paths >

Protocol: HTTP

Host: Domain/IP address, the principle of the same, the end will be converted to an IP address, through this to find the target server

PORT: What port number is required to access the destination host at the transport layer.

Path: Pinpoint the location of the resources we need,

The protocol and port numbers are usually omitted because these degrees are the default, and the paths are omitted when you access the home page. For example www.baidu.com this default into Baidu's homepage complete writing http://www.baidu.com:80/index.htm

          Hypertext Transfer Protocol HTTP.

Role: How to request documents to the server, the server how to send the document to the browser, in layman's point, is that we want the server to access the Web resources, how the server to the Web page to us.

Client to server: Request message server to client: Response message

What do you mean? When you access your server through a URL, a request message is sent to tell the server what it needs, and when the server knows it returns a response message to the client with some Web page information. It is through this to achieve the purpose of transmitting web resources, now to look specifically at the request message and Response message format.

Format the same, the content is different, the format of the city

Request Line Response Line

Request Head Response Body

Request Data Response Data

Request Message Format

              

Response message Format

              

By visiting www.solu.com to see what the request message and response message we sent

Request message:

              

              

1, get/http://www.sohu.com http/1.1 request line, but here is separated, the way of the request URL version

2, Host: hostname www.solu.com

3, User-agent: Use what proxy server, this is Firefox, that is, Firefox

4. Accept: What types of data can be received

5, Accept-language: The user wants to want the first version, one line down, first Chinese, then English

6, Accept-encoding: Notify the server can send data compression format

7. Cookies: A technology on the browser side that logs user information on the server, but also saves a copy in the browser.

8, Connection: The way of connection, there are two kinds of, non-persistent connection and persistent connection, non-persistent connection, a request/response corresponds to a TCP connection, received a ring should be connected to shut down, and then send the request on the establishment of a TCP connection, persistent connection is the opposite, here is the use of continuous connection

9, Upgrade-insecure-requests: This directive is used to allow the browser to automatically upgrade requests from HTTP to HTTPS, for a large number of HTTP resources containing HTTP Web pages directly to HTTPS without error. To be concise, is equivalent to a transition between HTTP and HTTPS, this can be put in a place, do not know it's okay.

Above 2 to 9 is the request header, because the general request message degree will not have the request data, so after 9 there is no content, generally if you want to send data past the degree will be through the domain name plus? Then send the data to the past

Response message

                

Here is a simple look at the response line in the status code, the response body content too much, suddenly explain not clear

The status code consists of three digits and can be divided into 5 categories of 33

1XX: Indicates a notification message, such as a request received or being processed

2XX: Indicates success, that is, the server received your request, and successfully processed, generally favorite to see is 200

200: This request was successful.

3xx: Indicates a redirect, the server tells the browser to complete the request you must take further action, that is, to visit another webpage,

4XX: Indicates a customer error, such as the wrong syntax in the request or the inability to complete

404 Error: The resource is not found, that is, your URL is written with errors, so that the correct resources are not located

5XX: Server error, such as server failure, or internal exception can not complete your request

500 error: There is a problem in the code written by the server.

There are many in the status code, is interested in Baidu can check a check.

V. Summary

So far, the real end, maybe the HTTP is very simple, but the content of the HTTP protocol is too much, can only take an important little explanation, interested students can go online to find HTTP books to watch, recommend an HTTP authoritative guide, I have an electronic version, the resource connection will be below, You can download it yourself. I will take the time to finish reading the book and then write it as a post.

Computer network tutorial Video resource link password: 9WR2

      

HTTP authoritative guide Password: k07z

If it fails, please add me qq:526745683 to ask for resources, annotated blog Park. Thank you

Sixth application layer (DNS and HTTP protocol details)

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.