Go Web programming: Web Basics

Source: Internet
Author: User
Tags domain name server domain server
This is a creation in Article, where the information may have evolved or changed.

Before you can develop a Web program with go, you must understand the HTTP protocol, and for those who have not, it is highly recommended to look at these two books: the HTTP authoritative guide and the graphical HTTP.

HTTP Overview

We usually surf the Internet, open the browser, enter the URL and press ENTER, the corresponding Web page is displayed. So how is this process going to be achieved?
Let's take a look at the following picture:

The process of a user accessing a Web site is clearly described. is divided into three steps:
1. Through the client is the browser input URL URLs, the client through the DNS protocol and DNS service network interaction, obtain the IP address of the domain name.
2. The browser then locates the corresponding IP server through the IP address and establishes the connection. The browser sends an HTTP request packet, the server processes the request packet, and returns the HTTP Response packet
3. After the browser receives the response package, draws the page, waits for all content to be received, disconnects the TCP connection with the server

DNS resolution

DNS is the acronym for the Domain Name System and is a computer that organizes domain hierarchies
and the network Service naming system, which is used for TCP/IP networking, which engages in the work of converting a hostname or domain name to an actual IP address.

DNS resolution process


Is the entire process of DNS resolution.
A more detailed DNS-as-a-system process is as follows:

    1. Enter the www.qq.com domain name in the browser, the operating system will first check whether the local Hosts file has this URL mapping relationship, if so, first call this IP address mapping, complete the domain name resolution.
    2. If the hosts do not have the mapping of this domain name, then find the local DNS parser cache, whether there is this URL mapping relationship, if any, directly return, complete the domain name resolution.
    3. If the hosts do not have a corresponding URL mapping relationship with the local DNS resolver cache, first find the preferred DNS server set in the TCP/IP parameter, where we call it a local DNS server, when the server receives the query, if the domain name to be queried is included in the local Configuration zone resource, The parsing result is returned to the client and the domain name resolution is completed, which is authoritative.
    4. If the domain name that you are querying is not resolved by the local DNS server zone, but the server has cached this URL mapping relationship, call this IP address mapping to complete the domain name resolution, which is not authoritative.
    5. If the local DNS server local zone file and cache resolution are invalidated, the query is based on the local DNS server's settings (whether to set forwarders), and if the forwarding mode is not used, local DNS sends the request to 13 root DNS, and the root DNS server will determine the domain name (. com) upon receipt of the request. Who is authorized to administer and returns an IP that is responsible for the top-level domain name server. After the local DNS server receives the IP information, it will contact the server responsible for the. com domain. After the server that is responsible for the. com domain receives the request, if it cannot resolve itself, it will find a management. com domain's next-level DNS server address (qq.com) to the local DNS server. When the local DNS server receives this address, it will find the qq.com domain server, repeat the above action, query until the www.qq.com host is found.
    6. If the use of the forwarding mode, this DNS server will forward the request to the first level of DNS server, by the top level of the server to resolve, the previous level of the server if it can not resolve, or find root DNS or transfer requests to the upper ancestor, in this cycle. Whether the local DNS server uses either forwarding or root hints, the result is returned to the local DNS server, which is then returned to the client.

DNS protocol

Reading combined with Wireshark analysis of DNS protocol can have a preliminary understanding of the DNS protocol message, in more detail should read the TCP/IP detailed Volume 1 protocol.

HTTP protocol

The detailed protocol reads "HTTP authoritative guide" and "Graphical http". Provide the download of these two books address: http://download.csdn.net/detail/uudou/9642228

Related Article

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.