计算机网络系列(6)之应用层HTTP

来源:互联网 发布:sql server 2005登录 编辑:程序博客网 时间:2024/06/07 21:44

1. HTTP
HTTP (hypertext transfer protocol) is an application to support the request/reply messages between a web server and its clients.

1.1. HTTP 1.0
Each HTTP 1.0 session can transfer only one file.

1.2. HTTP 1.1
Each HTTP 1.1 session can transfer several files.
Pipeline

2. Uniform resource locator (URL)
Every file on the web is give a unique uniform resource locator (URL) for unique identification.

3. HTTP messages
Each HTTP message must have pre-defined format and meaning, so that browser and web server can understand and handle TPP messages.

3.1. HTTP request
见Q3

3.2. HTTP response
见Q3

4. Web pages

4.1. Static web pages
A static web page contains fixed contents that do not change until someone modifies it.

4.2. Dynamic web pages
A dynamic web page displays different contents each time is requested. Execute a program at the server side so that this program can add the up-to-date contents to a web page.

4.3. Active web pages
An active web page contains a computer program that is executed at the browser side to produce outputs.

5. Cookies
A web site can use cookies to identify users. Then it can analyze their activities on this web site and act accordingly.

6. Web 2.0
Web 2.0 refers to web services which facilitates sharing and collaboration among users.

7. Questions
Q1: A browser sends an HTTP request to a web server but this HTTP request is lost. What should the browser do?
Do nothing, TCP can solve that problem.

Q2: Given two reasons to explain why HTTP 1.1. is more efficient than HTTP1.0.
pipeline
each one connection can support several requests (lower overhead)

Q3: A browser uses HTTP 1.1 to request an HTML file (named IT_baby.html) with 2000 bytes from a web server with domain name www.abc.com Draw diagram to show the contents of the HTTP messages involved.

这里写图片描述

Q4: For each of the following protocol, draw a diagram to show the sequence that TCP connections are opened/closed and HTTP messages are exchanged.

case1: HTTP 1.0

这里写图片描述

case2: HTTP 1.1 without pipelining

这里写图片描述

case3: HTTP 1.1 with pipelining

这里写图片描述

Q5: The speed of a web server depends on three factors. a) Internet connection speed b) CPU speed and c) I/O speed.

case1: Explain why the above factors would affect the speed of a web server.
Internet connection speed, data transmission speed, CPU speed, Active web pages, I/O speed, data access rate

case2: If you want to speed up a web server, what would you do?
Internet connection speed, CPU speed, I/O speed.

case3: Which factors would be relatively important for static pages, dynamic web pages and active web pages?
Internet connection speed, Internet connection speed, CPU speed.

8. 总结
重点1:HTTP1.0 和 HTTP1.1的主要区别在于,HTTP1.1 一个连接可以进行多个请求,HTTP1.1 有流水线传输数据的功能。

重点2:HTTP request和response的格式,request: Get+Host+Aceept-encoding;response: Http+content-encoding+content length

重点3:http1.1的pipeline的流程

原创粉丝点击