計算機網路和網際網路 — Application layer

Computer Networks and Internet —Application layer

R4 Cheng
3 min readDec 2, 2020

Content:

+ HTTP

+ FTP

+ E-mail

+ DNS

+ Reference

HTTP (HyperText Transfer Protocol)

Attributes

  1. HTTP functions as a request–response protocol in the client–server computing model
  2. high speed
  3. 可傳輸任意類型的數據,正在傳輸的類型以 Content-Type 標記
  4. 無連接:每次連接僅處理一個 request ,收到 client ack 即斷開連接
  5. 無狀態(stateless):協議對於事務處理沒有記憶能力,即每次處理都必須重傳 (不會紀錄 client’s request)
  6. Non-persistent HTTP(HTTP/1.0) vs. Persistent HTTP (HTTP/1.1)

HTTP message

  • two types of HTTP messages: request, response
  • HTTP request message (ASCII):
https://drive.google.com/drive/folders/1qGWvoR6cvZgb_AfKCPQXvk9mEOQQVjlU

Connection: close => 連線完後結束連線

  • HTTP response message:

consists of:

  • status line: 標示 request 成功或失敗
  • header lines: (metadata) A description of the information in the response.
  • The actual information requested: 回傳的資料
https://drive.google.com/drive/folders/1qGWvoR6cvZgb_AfKCPQXvk9mEOQQVjlU

Connection close => Server已經關閉連線

Last-Modified => 此 Object 最後一次修改是何時

Content-Type =>

Content-Length => 6821 bytes

User-server interaction: authorization

  • Include authorization in header line of each request

Cookies: keeping “state”

  • Server 在 client 端藏 cookie header line and back-end database at website
  • Cookie can bring: authorization, shopping carts, recommendations, user session state (Web email)

Same-origin policy 同源政策

  • 簡單來說,相同 Domain 就是同源,不同 Domain 就是不同源。

Proxy

  • Proxy = The Forward Proxy

=> proxy services to a client

  • The reverse proxy

=> does the exact opposite of what a forward proxy does. A reverse proxy accepts requests from external clients on behalf of servers stationed behind it. In most cases, reverse proxy servers also act as load balancers for the servers behind it.

While a forward proxy proxies in behalf of clients (or requesting hosts), a reverse proxy proxies in behalf of servers.

HTTP/1

  • was first cocumented as version 1.1 in 1997
  • Ad of 2021, about 30% of websites only support HTTP/1.

HTTP/1.0 和 HTTP/1.1 的區別

  • HTTP/1.0 ( = non-persistent HTTP) => 當 client 和 server 連接 (TCP) 後,只能獲得一個 web 資源 [RFC1945]
  • HTTP/1.1 ( = persistent HTTP) => 當 client 和 server 連接 (TCP) 後,能獲得多個 web 資源 (Multiple objects can be sent) [RFC2616]。可以把大資料切成小塊,減少失敗傳輸的機率

=> persistent with pipelining (default)

HTTP/2

  • 2015年5月以 RFC 7540 正式發表

HTTP/2 和 HTTP/1.1 的區別

HTTP/2 leaves all of HTTP/1.1’s high-level semantics, such as

  • methods
  • status codes
  • header fields
  • and URIs etc.

What is new is how the data is framed and transported between the client and the server.

HTTP/3

  • IETF 的 QUIC Work Group 在2018年把 QUIC 重新命名為 HTTP/3

QUIC: Quick UDP Internet Connection

  • It uses UDP instead of TCP for the underlying transport protocol.
  • 除了支援 HTTP,也支援 SMTPDNSSSH
  • 加密機制: TLS 1.3
  • 連線交握和金鑰的交換,只需要花1個 RTT 的時間 (vs. TCP/IP 三向交握 + TLS 的傳輸時間, 3 個 RTT 的時間)

HTTP/3 improve from HTTP/2

  1. Reduce connection establishment latency (減少建立連線所需的時間)
  2. Improve congestion control (增進網路壅塞控管)
  3. Forward error correction (前向錯誤更正)
  4. Connection migration (移動中 WIFI 與 4G網路切換時不需要重新建立連線)

FTP (Application layer) (2020.6.10)

  1. client/server mode
  2. RFC959
  3. Default server port: port 21 (control connection), port 20 (data connection)

Client browses remote directory by sending commends over control connection

E-mail (Application layer) (2020.6.18)

Three major components:

  1. user agents
  2. mail servers
  3. protocol: e.p. SMTP

SMTP (Simple Mail Transfer Protocol)

  1. 雙向
  2. port 25

Mail access protocols

sender =[SMTP]=> sender’s mail server =[SMTP]=> receiver’s mail server =[Mail access protocol]=> receiver

常見 protocol: POP3, IMAP (比POP3複雜), HTTP

DNS (Domain Name System) (2020.6.18)

  • A distributed database
  • Top-level domain (TLD) servers, Authoritative DNS servers, Local name servers (strictly not belong to hierarchy)
  • two types queries: recursive query, iterated query

Reference

[1] 黃能富教授 — 計算機網路概論

[2] 黃能富教授計算機網路概論講義 (私人連結)

[3] Chester ChuHTTP/3 傳輸協議 — QUIC 原理簡介 (2019)

[4] John V. Forward Proxy vs. Reverse Proxy | JSCAPE (2012)

--

--

R4 Cheng
R4 Cheng

Written by R4 Cheng

「0」が過去で「1」が未来「今」は何処にもない

No responses yet