Application layer protocol for the TCP/IP protocol family (DNS HTTP)

Source: Internet
Author: User
Tags http request response code domain name server

Domain Name Systems Dns:domain Name System

A distributed network directory service, which is mainly used for the mutual conversion between domain name and IP address.

Use UDP protocol 35 ports for communication.

How to work: in order to map a domain name to an IP address, the application invokes a program called a parser that transmits the domain name as a parameter to the program, and the parser encapsulates the domain name into a UDP packet, which is sent to the local domain name server, and the domain name server maps the domain name to the IP address. Encapsulates an IP address into a UDP packet, sends it back to the parser, and the parser returns the IP address to the caller. With this IP address, the application can establish a TCP connection with the destination or send a UDP packet.

DNS has two types of domain name resolution services: Forward Domain name resolution and reverse domain name resolution.

There are two ways to resolve a domain name: Recursive parsing and repeated parsing.

Recursive parsing: Requires the domain name server to complete the conversion of all domain name-address at once.

Repeated analysis: Every time you ask a server, no longer request another server.

Recursive resolution of the working method: the parser to query the default DNS server, if the server can not be resolved, then the server to another server to query until the resolution or resolution failed, the results will be returned to the end, and finally sent to the parser.

Repeated resolution of the work: the parser to query the default DNS server, if the server can not be resolved, then send back to the address of another DNS server, the parser to the DNS server to query, go down until the resolution or unable to obtain a new DNS server address. If the new DNS server address cannot be obtained, the resolution fails.

Reverse resolution: Use the pointer to ask. For example:

Zhongshan University domain name: sysu.edu.cn, corresponding IP network segment for 202.116.64.0/24, then the reverse resolution of the domain name is: 64.116.202.in-addr.arpa. The network segment is reserved, the host segment is ignored, and the IP segment address is expressed in reverse.

Internet domain name structure: the label in the domain name consists of English letters and numbers, each identifier is not more than 63 characters. A full domain name consisting of multiple labels is limited to a total of 255 characters.

-------------------------------------------------------------------------------------

Hypertext Transfer Protocol Http:hypertext Transfer Protocol

It is a kind of request/response protocol on the application layer, which realizes the communication between client and server, and is the main protocol of WWW publishing information.

The default connection port is TCP80.

HTTP locates Web server resources through URLs (Uniform Resource Locator, Uniform Resource Locator). A URL is a string that is used on the Internet to describe an information resource, including the server's domain name, directory, and file. For example:

Http://www.microsoft.com/windows/default.html

Meaning:/HTTP represents Hypertext Transfer Protocol

www.microsoft.com/represents the Web server domain name

windows/Representative Directory

Default.html is an HTML file under the file directory

The browser resolves the domain name in the URL to an IP address through the DNS server, sends an HTTP request to the Web server based on the IP address, and responds with an HTTP response when the Web server receives an HTTP request. The HTTP reply content conforms to the HTML (hypertext Markup Language, Hypertext Markup Language) format.

How HTTP Works:

<1>. Web client establishes a TCP connection to the Web server

<2>. Web client sends HTTP connection requests to Web server 80 port via browser

<3>. If the Web server allows access, the connection acknowledgement is returned, and both sides establish an HTTP connection

<4>. Web client sends HTTP page request

<5>. The Web server looks for the HTTP file and returns the hypertext for the file if it finds it. Web client browser docking received hypertext parsing, translated into a formatted page, displayed to the user

<6>. After the Web server sends the HTTP content, disconnect the HTTP connection

<7>. Both sides disconnect the TCP connection

HTTP has both request (HTTP request) and response (HTTP Response) messages.

Request message:

Requested format: Request Request-url HTTP version number

Http/1.0 has three types of requests:

<1>. Get request: Is the information of the resource specified by the request URL as an entity, and if the request Utl is just a data generation process, then ultimately in the response entity is the resource to which the result of the processing is directed, not the description of the processing process. Get is a request to send data to the server.

<2>. Head Request: Returns only the header information for the specified document, excluding the document body.

<3>. POST request: Used to make a request to the destination server that accepts the entity attached to the request and treats it as an additional new subkey for the resource specified by the request URL in the request queue. Post is a request to submit data to the server.

Response message:

The status line begins with the HTTP version number followed by a response code of 3 digits, as follows:

Type response code description information is OK. The request was successful. 201 OK. New Resource Establishment (POST). 202 the request was accepted, but the processing was not completed. 204 OK. But no content is returned. REDIRECT 301 The requested resource has been designated as a new fixed URL 302 The requested resource is temporarily located in the new URL 304 document without modification (conditional get) client 400 error request errors 401 not authorized, requires user authentication 403 unspecified reason for Prohibition 404 no Service Found Server 500 Internal Server error error 501 failed to implement 502 error gateway, gateway or upstream server to invalid response 503 servers temporarily invalidated

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.