6.3 HTTP

A user visits a website what happened this process?

1.DNS resolution process
2.TCP / ip three-way handshake / connections to the server
3.HTTP request packet sends a request to the server

  1. HTTP response message to the content you want
  2. tcp / ip four wave disconnected

DNS resolution process

From right to left to resolve

The root domain = 13 in Taiwan and the world's only
top-level domain .com .cn
second-level domain xxx.com
three domain names www.XXX.com

you

Installation dig need to install packages

dig + domain name resolution process can be viewed

[root@m01 ~]# dig baidu.com

; <<>> DiG 9.9.4-RedHat-9.9.4-73.el7_6 <<>> baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5649
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;baidu.com.         IN  A

;; ANSWER SECTION:
baidu.com.      5   IN  A   220.181.38.148
baidu.com.      5   IN  A   123.125.114.144

;; Query time: 2 msec
;; SERVER: 10.0.0.254#53(10.0.0.254)
;; WHEN: Mon Jun 03 19:30:07 CST 2019
;; MSG SIZE  rcvd: 59

View detailed parsing
dig + trace baidu .com

Type dns records

A record corresponding to the domain name ip
CNAME record alias record
MX record messages using

HTTP Hypertext Transfer Protocol

Visit the Web site to resolve user requests

http request packet content

1. Request the start line
request method get post upload download
2. To request access to the site head
3. blank line
4. Request Content: When only upload only content

View content curl -v request

[root@m01 ~]# curl -v baidu.com
* About to connect() to baidu.com port 80 (#0)
*   Trying 220.181.38.148...
* Connected to baidu.com (220.181.38.148) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: baidu.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Mon, 03 Jun 2019 12:19:43 GMT
< Server: Apache
< Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT
< ETag: "51-47cf7e6ee8400"
< Accept-Ranges: bytes
< Content-Length: 81
< Cache-Control: max-age=86400
< Expires: Tue, 04 Jun 2019 12:19:43 GMT
< Connection: Keep-Alive
< Content-Type: text/html
< 
<html>
<meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
</html>
* Connection #0 to host baidu.com left intact

Guess you like

Origin blog.csdn.net/weixin_34301132/article/details/90796799