計算機網絡自頂向下方法 第二章 Wireshark實驗:HTTP 答案

https://github.com/jzplp/Computer-Network-A-Top-Down-Approach-Answer

1.基本HTTP GET/response交互

  • 實驗圖像 
    GET /wireshark-labs/HTTP-wireshark-file1.html HTTP/1.1\r\n
    Accept: text/html, application/xhtml+xml, image/jxr, */*\r\n
    Accept-Language: zh-CN\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko\r\n
    Accept-Encoding: gzip, deflate\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: Keep-Alive\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file1.html]
    [HTTP request 1/1]
    [Response in frame: 15]
    HTTP/1.1 200 OK\r\n
    Server:   \r\n
    Date: Mon, 02 Dec 2019 13:44:52 GMT\r\n
    Content-Type: text/html; charset=UTF-8\r\n
    Content-Length: 128\r\n
    Connection: keep-alive\r\n
    Last-Modified: Mon, 02 Dec 2019 06:59:01 GMT\r\n
    ETag: "80-598b31d50a6e7"\r\n
    Accept-Ranges: bytes\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.556109000 seconds]
    [Request in frame: 11]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file1.html]
    File Data: 128 bytes
    
    <html>\n
    Congratulations.  You've downloaded the file \n
    http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file1.html!\n
    </html>\n
  1. 您的瀏覽器是否運行HTTP版本1.0或1.1?服務器運行什麼版本的HTTP?
    瀏覽器和服務器都運行 HTTP/1.1

  2. 您的瀏覽器會從接服務器接受哪種語言(如果有的話)?
    Accept-Language: zh-CN

  3. 您的計算機的IP地址是什麼? gaia.cs.umass.edu服務器地址呢?
    計算機IP 192.168.2.239
    gaia.cs.umass.edu服務器IP 128.119.245.12

  4. 服務器返回到瀏覽器的狀態代碼是什麼?
    200 OK

  5. 服務器上HTML文件的最近一次修改是什麼時候?
    Last-Modified: Mon, 02 Dec 2019 06:59:01 GMT

  6. 服務器返回多少字節的內容到您的瀏覽器?
    Content-Length: 128

  7. 通過檢查數據包內容窗口中的原始數據,你是否看到有協議頭在數據包列表窗口中未顯示? 如果是,請舉一個例子。
    應該沒有

2.HTTP條件Get/response交互

  • 實驗圖像 Image text
    GET /wireshark-labs/HTTP-wireshark-file2.html HTTP/1.1\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: keep-alive\r\n
    Upgrade-Insecure-Requests: 1\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\r\n
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: zh-CN,zh;q=0.9\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html]
    [HTTP request 1/2]
    [Response in frame: 312]
    [Next request in frame: 420]
    HTTP/1.1 200 OK\r\n
    Server:   \r\n
    Date: Mon, 02 Dec 2019 14:14:09 GMT\r\n
    Content-Type: text/html; charset=UTF-8\r\n
    Content-Length: 371\r\n
    Connection: keep-alive\r\n
    Last-Modified: Mon, 02 Dec 2019 06:59:01 GMT\r\n
    ETag: "173-598b31d509f17"\r\n
    Accept-Ranges: bytes\r\n
    \r\n
    [HTTP response 1/2]
    [Time since request: 0.527297000 seconds]
    [Request in frame: 289]
    [Next request in frame: 420]
    [Next response in frame: 428]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html]
    File Data: 371 bytes
    \n
    <html>\n
    \n
    Congratulations again!  Now you've downloaded the file lab2-2.html. <br>\n
    This file's last modification date will not change.  <p>\n
    Thus  if you download this multiple times on your browser, a complete copy <br>\n
    will only be sent once by the server due to the inclusion of the IN-MODIFIED-SINCE<br>\n
    field in your browser's HTTP GET request to the server.\n
    \n
    </html>\n
    GET /wireshark-labs/HTTP-wireshark-file2.html HTTP/1.1\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: keep-alive\r\n
    Cache-Control: max-age=0\r\n
    Upgrade-Insecure-Requests: 1\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\r\n
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: zh-CN,zh;q=0.9\r\n
    If-None-Match: "173-598b31d509f17"\r\n
    If-Modified-Since: Mon, 02 Dec 2019 06:59:01 GMT\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html]
    [HTTP request 2/2]
    [Prev request in frame: 289]
    [Response in frame: 428]
    HTTP/1.1 304 Not Modified\r\n
    Server:   \r\n
    Date: Mon, 02 Dec 2019 14:14:14 GMT\r\n
    Connection: keep-alive\r\n
    ETag: "173-598b31d509f17"\r\n
    \r\n
    [HTTP response 2/2]
    [Time since request: 0.560527000 seconds]
    [Prev request in frame: 289]
    [Prev response in frame: 312]
    [Request in frame: 420]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html]
  1. 檢查第一個從您瀏覽器到服務器的HTTP GET請求的內容。您在HTTP GET中看到了“IF-MODIFIED-SINCE”行嗎?
    沒看到

  2. 檢查服務器響應的內容。服務器是否顯式返回文件的內容? 你是怎麼知道的?
    服務器顯式返回了文件內容,在實體部分可以看到

  3. 現在,檢查第二個HTTP GET請求的內容。 您在HTTP GET中看到了“IF-MODIFIED-SINCE:”行嗎? 如果是,“IF-MODIFIED-SINCE:”頭後面包含哪些信息?
    If-Modified-Since: Mon, 02 Dec 2019 06:59:01 GMT\r\n
    包含了本地保存的文件的在服務器上的最後修改時間

  4. 針對第二個HTTP GET,從服務器響應的HTTP狀態碼和短語是什麼?服務器是否明確地返回文件的內容?請解釋。
    304 Not Modified
    服務器沒有明確返回文件內容,因爲文件後來沒有被修改。

3.檢索長文件

  • 實驗圖像 Image text
    GET /wireshark-labs/HTTP-wireshark-file3.html HTTP/1.1\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: keep-alive\r\n
    Upgrade-Insecure-Requests: 1\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\r\n
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: zh-CN,zh;q=0.9\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file3.html]
    [HTTP request 1/1]
    [Response in frame: 23]
Frame 23: 782 bytes on wire (6256 bits), 782 bytes captured (6256 bits) on interface 0
Ethernet II, Src: PhicommS_cc:6b:be (68:db:54:cc:6b:be), Dst: IntelCor_c2:8c:e7 (1c:1b:b5:c2:8c:e7)
Internet Protocol Version 4, Src: 128.119.245.12, Dst: 192.168.2.239
Transmission Control Protocol, Src Port: 80, Dst Port: 60903, Seq: 4023, Ack: 460, Len: 728
[4 Reassembled TCP Segments (4750 bytes): #20(1460), #21(1460), #22(1102), #23(728)]
    [Frame: 20, payload: 0-1459 (1460 bytes)]
    [Frame: 21, payload: 1460-2919 (1460 bytes)]
    [Frame: 22, payload: 2920-4021 (1102 bytes)]
    [Frame: 23, payload: 4022-4749 (728 bytes)]
    [Segment count: 4]
    [Reassembled TCP length: 4750]
    [Reassembled TCP Data: 485454502f312e3120323030204f4b0d0a5365727665723a…]
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
    Server:   \r\n
    Date: Mon, 02 Dec 2019 14:37:48 GMT\r\n
    Content-Type: text/html; charset=UTF-8\r\n
    Content-Length: 4500\r\n
    Connection: keep-alive\r\n
    Last-Modified: Mon, 02 Dec 2019 06:59:01 GMT\r\n
    ETag: "1194-598b31d5031b6"\r\n
    Accept-Ranges: bytes\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.572555000 seconds]
    [Request in frame: 16]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file3.html]
    File Data: 4500 bytes
Line-based text data: text/html (98 lines)
  1. 您的瀏覽器發送多少HTTP GET請求消息?哪個數據包包含了美國權利法案的消息?
    只發送了一個HTTP GET請求消息。
    返回的四個TCP數據包都包含了美國權利法案的消息。

  2. 哪個數據包包含響應HTTP GET請求的狀態碼和短語? 返回的第一個TCP數據包包含響應HTTP GET請求的狀態碼和短語

  3. 響應中的狀態碼和短語是什麼?
    200 OK

  4. 需要多少包含數據的TCP段來執行單個HTTP響應和權利法案文本?
    需要4個TCP數據包

4.具有嵌入對象的HTML文檔

  • 實驗圖像 
  1. 您的瀏覽器發送了幾個HTTP GET請求消息? 這些GET請求發送到哪個IP地址?
    3個HTTP GET請求消息。都發送到 128.119.245.12

  2. 瀏覽器從兩個網站串行還是並行下載了兩張圖片?請說明。
    串行,因爲有Connection: Keep-Alive

5.HTTP認證

  • 實驗圖像 
    GET /wireshark-labs/protected_pages/HTTP-wireshark-file5.html HTTP/1.1\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: keep-alive\r\n
    Upgrade-Insecure-Requests: 1\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\r\n
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: zh-CN,zh;q=0.9\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/protected_pages/HTTP-wireshark-file5.html]
    [HTTP request 1/1]
    [Response in frame: 70]
    HTTP/1.1 401 Unauthorized\r\n
    Date: Tue, 03 Dec 2019 16:39:11 GMT\r\n
    Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_perl/2.0.11 Perl/v5.16.3\r\n
    WWW-Authenticate: Basic realm="wireshark-students only"\r\n
    Content-Length: 381\r\n
        [Content length: 381]
    Keep-Alive: timeout=5, max=100\r\n
    Connection: Keep-Alive\r\n
    Content-Type: text/html; charset=iso-8859-1\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.263216000 seconds]
    [Request in frame: 66]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/protected_pages/HTTP-wireshark-file5.html]
    File Data: 381 bytes
    GET /wireshark-labs/protected_pages/HTTP-wireshark-file5.html HTTP/1.1\r\n
    Host: gaia.cs.umass.edu\r\n
    Connection: keep-alive\r\n
    Authorization: Basic d2lyZXNoYXJrLXN0dWRlbnRzOm5ldHdvcms=\r\n
    Upgrade-Insecure-Requests: 1\r\n
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36\r\n
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: zh-CN,zh;q=0.9\r\n
    \r\n
    [Full request URI: http://gaia.cs.umass.edu/wireshark-labs/protected_pages/HTTP-wireshark-file5.html]
    [HTTP request 1/1]
    [Response in frame: 195]
    HTTP/1.1 200 OK\r\n
    Date: Tue, 03 Dec 2019 16:39:20 GMT\r\n
    Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_perl/2.0.11 Perl/v5.16.3\r\n
    Last-Modified: Tue, 03 Dec 2019 06:59:03 GMT\r\n
    ETag: "84-598c73b444ac9"\r\n
    Accept-Ranges: bytes\r\n
    Content-Length: 132\r\n
        [Content length: 132]
    Keep-Alive: timeout=5, max=100\r\n
    Connection: Keep-Alive\r\n
    Content-Type: text/html; charset=UTF-8\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.266665000 seconds]
    [Request in frame: 192]
    [Request URI: http://gaia.cs.umass.edu/wireshark-labs/protected_pages/HTTP-wireshark-file5.html]
    File Data: 132 bytes
  1. 對於您的瀏覽器的初始HTTP GET消息,服務器響應(狀態碼和短語)是什麼響應?
    401 Unauthorized

  2. 當您的瀏覽器第二次發送HTTP GET消息時,HTTP GET消息中包含哪些新字段?
    Authorization: Basic d2lyZXNoYXJrLXN0dWRlbnRzOm5ldHdvcms=

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章