HTTP protocol Description

Source: Internet
Author: User

Introduction to the principle of HTTP protocol

Master user access to the site process:
1) DNS service for Domain name resolution (DNS resolution principle-recursive query/iterative query)
2) client to establish network connection with Enterprise Web server (TCP three handshake process/three handshake state transition)
3) The user requests the website sends the corresponding page information---the HTTP request message sends (the client sends)
) Follow the detailed request process according to the site architecture hierarchy
4) The website responds to the user request, sends the corresponding page information---HTTP response message Send (server issue)
5) client to disconnect from the corporate Web server (TCP four wave/four wave state transition)

2.1 HTTP Protocol Principle Introduction

HTTP protocol, full name hypertext Transfer Protocol, Chinese name Hypertext Transfer Protocol
One of the important applications of HTTP is the WWW service
www, full name World Wide Web, often referred to as the Web, the Chinese translation of "www"
The default port for the WWW Service Application of the HTTP protocol is 80
Another encrypted WWW service application HTTPS has a default port of 443
Description: General Internet company, open port, only two (80 and 443)

2.2 HTTP protocol Message structure detailed description

HTTP request message Structure
Request Line:
A request method:
Get---Get the data content of the requested file information (get)
Post---Inform the service of the data that needs to be saved (submit)
B Request File Information
Description: When the requested file content is not specified, the default request is the home file index.html
C Description of what HTTP protocol version the request message uses
HTTP protocol Release Notes
1.0: Specifies that the browser and the server only maintain a brief connection (TCP short connection)
1.1: Specifies that the browser and the server only maintain a long-term connection (TCP long connection)

Request Header content:

Blank Line

Request Body Content:
Description: When the Get method is used, there is no request principal content, and when the Post method is used, the information to be submitted is placed in the request body

2.3 HTTP Response message structure

Start line:
A HTTP protocol version
HTTP protocol Release Notes
1.0: Specifies that the browser and the server only maintain a brief connection (TCP short connection)
1.1: Specifies that the browser and the server only maintain a long-term connection (TCP long connection)
b HTTP Response Status code information
Tell the result of the request
---Normal response request message
301---jump, permanent jump
302---jump, temporary jump
403---Set the specified page to deny access; * * * * There is another situation??? )
404---Can't find the file I want to request (unable to find the requested page information)
---a problem with the back-end server of the website (most of it is a site problem)
Description: Learn more about many HTTP status codes, HTTP authoritative guide
C HTTP Status Description information
The Curl command allows you to simulate browser functionality in a Linux system, access the website
-I---Display response message start line and response header information

Response header:

Blank Line


Response message body:
Description: Is the request message, the content of the request file, the client browser will recognize the response message body content, to parse

The above Information Command view method:
Curl-v www.oldboyedu.com <-Use the-v parameter of the Curl command to view Access site request and response information
wget--debug www.oldboyedu.com <-Use the wget parameter of the--debug command to view Access site request and response information

2.4 HTTP request and corresponding message description

2.5 HTTP Terminology Introduction Description

2.5.1 Media Resource Type
Description: Defines the type of file resource that the corresponding Web service can recognize;
? If there is a corresponding request file type in the media resource type, it will help you to parse
? If the media resource type does not respond to the request file type, the file is transferred to the client and resolves itself

Introduction to 2.5.2 URL and URI concepts
URL, all called uniform Resource location, Chinese translation as Uniform Resource Locator
URI, all called uniform Resource Identifier, Chinese translation as Uniform Resource Identifier

  https://search.jd.com     /     Search?keyword=10tb&enc=utf-8&suggest=3.his.0      URL                                        URI

2.5.3 Static Web Resources
Web pages in pure HTML (can contain images, video JS (front-End Function implementation), CSS (style), etc.) are often referred to as "static Web pages"
Feature Description:
1) Each page has a fixed URL address, and the URL is usually in. html,. htm,. shtml and other common forms as suffixes,
And the address does not contain a question mark "? "or" & "and other special symbols.
2) A static Web page is a file entity that is actually stored on the server, and each page is a separate file
3) Static resources do not need to interact with the database, so the site interactive performance is poor
4) The content of the webpage is fixed, so it is easy to be indexed by search engine (easy to be found by users) (advantages)
5) the Web program resolves on the user's browser, and when the client requests data from the server,
The server will return data directly from the disk file system (without any parsing)

2.5.4 Dynamic Web Resources
The so-called Dynamic Web page is relative to the static Web page, that is, the URL suffix of the Dynamic Web page is not. Common extension forms for static Web pages such as HTML,. htm,. xml,. shtml,. js,. CSS, etc.
Feature description
1) dynamic resources need to interact with the database, so the site interactive performance is good
Omitted...

  5)网页程序在服务端解析,当客户端向服务器请求数据时,     服务器会直接从磁盘文件系统上返回数据(会做数据解析后返回)     ![](http://i2.51cto.com/images/blog/201801/14/38df26e40f991374aa0fe36be68d5a48.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

2.5.5 Pseudo-static resources (understanding/real enterprise developers are responsible for pseudo-static resource writing)
1) Web content is fixed, so it is easy to be indexed by search engines
2) the Web program resolves on the user's browser, and when the client requests data from the server,
The server will return data directly from the disk file system (without any parsing)
3) Dynamic resources need to interact with the database, so the website interactive performance is excellent
4) The Web application is resolved on the server side, when the client requests data from the
The server will return data directly from the disk file system (which will be returned after parsing the data)

2.6 Methods for HTTP requests

2.7 How can I prove that a website is valuable?
IP度量值:(参考值)   根据访问的用户源IP地址进行统计,判断有多少用户进行访问?说明:有可能统计数值不准确a 由于有NAT映射问题,会把局域网多台主机不同的源IP地址映射为一个相同的公网源IP地址b 由于家用拨号网络,没有固定的外网IP地址数据计算方法:01)利用awk数组方法结合nginx访问日志(分享讲解awk多维数组)02)通过程序代码进行统计    <script>        var _hmt = _hmt || [];        (function() {          var hm = document.createElement("script");          hm.src = "https://hm.baidu.com/hm.js?9aa800f882f575237396648643111698";          var s = document.getElementsByTagName("script")[0];           s.parentNode.insertBefore(hm, s);        })();    </script>    说明:通过代码实现IP度量值统计记录03)借助第三方工具进行统计
2.8 PV Metric: (reference value)
page view:页面访问量    数据计算方法:01)利用awk数组方法结合nginx访问日志(分享讲解awk多维数组)02)通过程序代码进行统计    <script>        var _hmt = _hmt || [];        (function() {          var hm = document.createElement("script");          hm.src = "https://hm.baidu.com/hm.js?9aa800f882f575237396648643111698";          var s = document.getElementsByTagName("script")[0];           s.parentNode.insertBefore(hm, s);        })();    </script>    说明:通过代码实现IP度量值统计记录03)借助第三方工具进行统计UV度量值:记录一个独立访客数;利用cookie进行统计记录cookie: 记录客户端访问信息,cookie信息一般会保存在客户端session:记录客户端访问信息,session信息一般会保存在服务端
2.9 Data calculation methods:
01)利用awk数组方法结合nginx访问日志(分享讲解awk多维数组)02)通过程序代码进行统计    <script>        var _hmt = _hmt || [];        (function() {          var hm = document.createElement("script");          hm.src = "https://hm.baidu.com/hm.js?9aa800f882f575237396648643111698";          var s = document.getElementsByTagName("script")[0];           s.parentNode.insertBefore(hm, s);        })();    </script>    说明:通过代码实现IP度量值统计记录03)借助第三方工具进行统计最终度量统计信息获取,利用第三方统计网站获取http://alexa.chinaz.com/alexa_more.aspx
2.10 Website Concurrency Concepts

A understanding: The maximum number of user requests that a Web server can receive per second.
B Understanding: The maximum number of user requests that a Web server can respond to per second.
C Understanding: The maximum number of connections that a Web server can handle per unit time. Recommended

HTTP protocol Description

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.