Guest User

Untitled

a guest
Oct 14th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.95 KB | None | 0 0
  1. E 302: 網路概論作業 #2 繳交期限: 2018 十月 十八日, 星期四
  2. 蔡憶佳
  3.  
  4. Problem 1
  5. 本次作業的主要目的是學習與瞭解傳統應用程式層通訊協定所面臨的困境與發展難題。首先請仔細研讀 RFC 3986 (STD 66),這是 2005 年發表的「URI(Uniform Resource Identifier, 統一資源標誌)」語法。「統一資 源標誌」是用來標示實體或虛擬的資源,雖然在文件中並未指出用於哪裡,但一般都瞭解是用於「全球資訊 網 (World Wide Web,WWW)」。構成一個「統一資源標誌」的各部份元件名稱可由圖 ??的標誌範例中看到, 它由五大部份組成:scheme, authority, path, query, 與 fragment。各部份的詳細構成規格請參考 RFC 3986。
  6. Figure 1: 構成 URI 的各部份元件
  7. 在「全球資訊網」中傳遞訊息的通訊協定為「HTTP(Hyper Text Transfer Progocol)」,其 1.1 版本的規格可以 參考 RFC 2616。訊息分成兩大類:「要求 (request) 」與「回應 (response) 」。「要求 (request)」訊息的格式如 圖二中所示,由三大部份構成:request line, header lines , 與 entity body。這三部份是由兩個連續字元分隔 開,分別為「歸位 (CR)」、「換行 (LF)」字元。這兩個字元的原始意義是在早期終端機上模擬打字機的動作 當打字到最右側時使用者按下「輸入 (enter)」鍵時,游標回到最左側的動作 (歸位,carriage return),與游標 移至下一行的動作 (換行,line feed)。其中 carriage 這個字是因為打字機上放紙的滾筒位於一個可以左右滑 動的架子上,此架子稱為「滑架,carriage」。
  8. Figure 2: HTTP「要求」訊息格式
  9. 在圖 ??中所顯示的 request line 由兩個「空白 (SP)」字元分隔開三部份。第一部份為 Method,第二部份是 Request-URI,第三部份是 HTTP-Version。第二部份 Request-URI 中就是使用前面所提到的「統一資源標誌」 來標示所要要求的資源。請注意 HTTP 是基於早期的傳輸協定上,只能傳輸 US-ASCII 字元,也就是指由七 個位元表示的 128 個字符與控制碼,因此 HTTP 的訊息本身也只能由 US-ASCII 構成。
  10. ii
  11.  
  12. a. 在「統一資源標誌」中可能會有「空白」字元,例如檔案與資料夾名稱中是可以有「空白」字元。請說 明在 Request-URI 中傳遞的「統一資源標誌」中為何不能有「空白」字元?
  13. b. 要如何處理「統一資源標誌」中裡的「空白」字元使得可以在 Request-URI 中傳遞?
  14. c. 檔案與資料夾名稱中是可以有「=」、「@」、「&」、「#」與「?」等字元,針對這樣的檔案或資料夾,要如
  15. 何用「統一資源標誌」標示?
  16. d. 假設有一「統一資源標誌」如下所示,請問這個「標誌」會到哪一部主機上去取資料?
  17. ftp://cnn.example.com&story=breaking_news@163.13.128.1/top_story.htm
  18. e. 假設有一「統一資源標誌」如下所示, http://iaic.csie.tku.edu.tw:80/個別化智慧通訊實驗室/首頁.html 請探討要如何在 Request-URI 中傳遞?
  19. f. 在 Request-URI 中可以傳遞如下的「統一資源標誌」(e. 的答案可提供部分提示), http://資工系. 淡江大學. 台灣/個別化智慧通訊實驗室/首頁.html
  20. 但現在卻沒有這樣的網址,請探討要克服哪些問題才能在目前的「全球資訊網」中使用這樣的「統一 資源標誌」取得網頁?
  21. Problem 2
  22. Consider the following string of ASCII characters that were captured by Wireshark when the browser sent an HTTP GET message (i.e., this is the actual content of an HTTP GET message). The characters <cr><lf> are carriage return and line-feed characters (that is, the italized character string <cr> in the text below represents the single carriage-return character that was contained at that point in the HTTP header). Answer the following questions, indicating where in the HTTP GET message below you find the answer.
  23. GET /e1039/index.html HTTP/1.1<cr><lf>Host: iaic.csie.tku.edu.tw<cr><lf>User-Agent: Mozilla/ 5.0 (
  24. Windows;U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) <cr><lf> Accept:ext/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8,image/ png,*/*;q=0.5
  25. <cr><lf>Accept-Language: en-us,en;q=0.5<cr><lf>Accept-
  26. Encoding: zip,deflate<cr><lf>Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<cr><lf>
  27. Keep-Alive: 300<cr>
  28. <lf>Connection:keep-alive<cr><lf><cr><lf>
  29. a. What is the URL of the document requested by the browser?
  30. b. What version of HTTP is the browser running?
  31. c. Does the browser request a non-persistent or a persistent connection?
  32. d. What is the IP address of the host on which the browser is running?
  33. e. What type of browser initiates this message? Why is the browser type needed in an HTTP request mes- sage?
  34. iii
  35.  
  36. Problem 3
  37. The text below shows the reply sent from the server in response to the HTTP GET message in the question above. Answer the following questions, indicating where in the message below you find the answer.
  38. HTTP/1.1 200 OK<cr><lf>Date: Tue, 27 Oct 2015 12:39:45GMT<cr><lf>Server: Apache/2.0.52 (Fedora) <cr><lf>Last-Modified: Sat, 10 Dec2014 18:27:46 GMT<cr><lf>
  39. ETag: “526c3-f22-a88a4c80”<cr><lf>
  40. Accept-Ranges: bytes<cr><lf>Content-Length: 3874<cr><lf>
  41. Keep-Alive: timeout=max=100<cr><lf>Connection: Keep-Alive<cr><lf>
  42. Content-Type: text/html; charset=ISO-8859-1<cr><lf><cr><lf>
  43. <!doctype html public “-//w3c//dtd html 4.0 transitional//en”><lf><html><lf> <head><lf> <meta http-equiv=”Content-Type”
  44. content=”text/html; charset=iso-8859-1”><lf>
  45. <meta name=”GENERATOR” content=”Mozilla/4.79 [en] (Windows NT 5.0; U) Netscape]”><lf> <title>E1039 Computer Networking Homepage</title><lf></head><lf>
  46. <much more document text following here (not shown)>
  47. a. Was the server able to successfully find the document or not? What time was the document reply pro- vided?
  48. b. When was the document last modified?
  49. c. How many bytes are there in the document being returned?
  50. d. What are the first 5 bytes of the document being returned? Did the server agree to a persistent connection?
  51. Problem 4
  52. Obtain the HTTP/1.1 specification (RFC 2616). Answer the following questions:
  53. a. Explain the mechanism used for signaling between the client and server to indicate that a persistent connection is being closed. Can the client, the server, or both signal the close of a connection?
  54. b. What encryption services are provided by HTTP?
  55. c. Can a client open three or more simultaneous connections with a given server?
  56. d. Either a server or a client may close a transport connection between them if either one detects the con- nection has been idle for some time. Is it possible that one side starts closing a connection while the other side is transmitting data via this connection? Explain.
  57. e. In RFC 2616, a pipeline mechanism is used to increase the throughput of client-server communication, see section 8.1.2.2 Pipelining. A client that supports persistent connections MAY ”pipeline” its requests (i.e., send multiple requests without waiting for each response). A server MUST send its responses to those requests in the same order that the requests were received. However, the mechanism of “pipeline” may introduce the issue called ”Head of line blocking.” Explain.
  58. f. To alleviate the problem of “head of line blocking” in HTTP 1.1, two optimization approaches are used: 1. reducing the number of requests, and 2. opening multiple persistent connections simultaneously. The first approach has results in combining and inlining scripts, style sheets, and inlining pictures in the css codes. The second approach has inspired the use of “domain sharding.” technique. Please explain “domain sharding” in the context of HTTP 1.1.
  59. iv
  60.  
  61. Problem 5
  62. Please describe the following encoding schemes in detail and compare their efficiencies.
  63. a. Base64 encoding b. Quote Printable c. Percent encoding d. Punycode
  64. Problem 6
  65. The format of email addresses is local-part@domain where the local-part may be up to 64 characters long and the domain name may have a maximum of 253 characters ‒but the maximum 256 characters length of a forward or reverse path restricts the entire email address to be no more than 254 characters. A software developer is required to know what is a valid email address and what is an invalid email address. According to the Internet specification RFC 2822, there are several formats of valid email address, such as harry@s06.tku.edu.tw, harry@[163.13.1.211], “HarryPotter”@s06.tku.edu.tw or “HarryPotter”@[163.13.1.211].
  66. Some examples of invalid email addresses are:
  67. harry@tku@s06.tku.edu.tw, harry..potter@s06.tku.edu.tw , harry@-s99.tku.edu.tw, harry@s99.tku. edu.taiwan, and harry@[163.13.1211].
  68. A. Please read RFC 5321, RFC 5322, and RFC 3696 and all the related RFCs and describe the rules of local-part and domain of a valid email address.
  69. B. Use the rules to determine the validity of the following email addresses. If the address is not valid, please state the reason.
  70. (1) hermionegranger@s06.tku.edu.tw
  71. (2) hermione.granger@s06.tku.edu.tw
  72. (3) hermione..granger@s06.tku.edu.tw
  73. (4) hermione@granger@gryffindor@s99.tku.edu.tw
  74. (5) hogwarts.school.of.witchcraft.and.wizardry@mail.tku.edu.tw
  75. (6) albus.percival.wulfric.brian.dumbledore@mail.tku.edu.tw
  76. (7) albus.percival.wulfric.brian.dumbledore+hogwarts@mail.tku.edu.tw
  77. (8) hermione”jean”granger@s06.tku.edu.tw
  78. (9) hermionejean”granger\gryffindor@s06.tku.edu.tw
  79. (10) hermione\jean\”granger\\gryffindor@s06.tku.edu.tw
  80. (11) “Hogwarts.SchoolofWitchcraftandWizardry”@mail.tku.edu.tw
  81. (12) “gryffindor.@.Hogwarts.School.of.Witchcraft.and.Wizardry”@mail.tku.edu.tw
  82. (13) hermione.granger.s06.tku.edu.tw
  83. (14) hermione.@s06.tku.edu.tw
  84. (15) “gryffindor.(),:;<>[]\”.hogwarts@\\\”school\”.witchcraft.and.wizardry”@mail.tku.edu.tw
  85. (16) 0@a
  86. v
  87.  
  88. (17) ""@mail.tku.edu.tw
  89. (18) a"b(c)d,e:f;g<h>i[j\k]l@s06.tku.edu.tw
  90. (19) postbox@com
  91. (20) !#$%&’*+-/=?^_`{}|~@mail.tku.edu.tw
  92. (21) "()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}|~?^_`{}|~.a"@mail.tku.edu.tw
  93. vi
Add Comment
Please, Sign In to add comment