Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMP2322 Lab 2 HTTP Steven Lee Jan. 29, 2016. HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):

Similar presentations


Presentation on theme: "COMP2322 Lab 2 HTTP Steven Lee Jan. 29, 2016. HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):"— Presentation transcript:

1 COMP2322 Lab 2 HTTP Steven Lee Jan. 29, 2016

2 HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser): requests, receives and displays Web objects, can be HTML files, images, videos, … – Server (Web server): responds requests with objects Stateless – Server maintains no information about past client requests 2

3 HTTP message Two types: request, response HTTP request message – ASCII (human-readable format) 3 Request line GET /hypertext/WWW/TheProject.html HTTP/1.1 Header lines Host: info.cern.ch User-agent: Mozilla/5.0 Connection: keep-alive Accept-language: en-US End of message (extra carriage return \r, line feed \n)

4 HTTP methods GET (HTTP/1.0+) POST (HTTP/1.0+) HEAD (HTTP/1.0+) – Requests the header only, without the response body PUT (HTTP/1.1+) – Uploads the file in the entity body to the path specified in the URL field DELETE (HTTP/1.1+) – Deletes the file specified in the URL field 4

5 HTTP message HTTP response message 5 Status line HTTP/1.1 200 OK Header lines Date: Thu, 28 Jan 2016 09:53:26 GMT Server: Apache Last-Modified: Thu, 03 Dec 1992 08:37:20 Content-Length: 2217 Connection: close Content-Type: text/html Data The World Wide Web Project …

6 HTTP response status codes 200 OK – Request succeeded, requested object later in this message 301 Moved Permanently – Requested object moved, new location specified later in this message (Location:) 404 Not Found – Requested document not found on this server 500 Internal Server Error – An unexpected condition was encountered 503 Service Unavailable – The server is currently unavailable (due to overloading or maintenance) 6

7 Content Explore several aspects of the HTTP protocol with Wireshark – Basic HTTP GET/response interaction – The HTTP CONDITIONAL GET/response interaction – Retrieving long documents – HTML documents with embedded objects – HTTP authentication 7

8 Web cache A mechanism for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce bandwidth usage, server load, and perceived lag Clear cache – Google Chrome: Ctrl+Shift+Delete → Clear browsing data – Mozilla Firefox: Ctrl+Shift+Delete → Clear Now – Internet Explorer: Use Chrome or Firefox 8

9 Practice 1 Y:\Win32\WiresharkPortable Visit http://www4.comp.polyu.edu.hk/~comp2322/HTTP-1.htmlhttp://www4.comp.polyu.edu.hk/~comp2322/HTTP-1.html Question 1 (2 marks for each part in a question) a)What version(s) of HTTP are your browser and the server running? b)What language(s) (if any) does your browser indicate that it can accept from the server? c)What are the IP addresses of your computer and the server? d)What is the status code returned from the server to your browser? e)When was the HTML file that you retrieved last modified at the server? f)How many bytes of content are returned to your browser? 9

10 Practice 2 Clear web cache Visit http://www4.comp.polyu.edu.hk/~comp2322/HTTP-2.htmlhttp://www4.comp.polyu.edu.hk/~comp2322/HTTP-2.html Visit this address again Question 2 – Inspect the contents of the first HTTP GET request a)Do you see an “If-Modified-Since” line in the HTTP GET? b)Did the server explicitly return the contents of the file? How can you tell? – Inspect the contents of the second HTTP GET request c)Do you see an “If-Modified-Since” line in the HTTP GET? If so, what information follows the “If-Modified-Since” header? d)What is the status code and phrase returned from the server’s response to this second HTTP GET? e)Did the server explicitly return the contents of the file? Explain. 10

11 Practice 3 Open a new incognito or private window in your browser – Google Chrome: Ctrl+Shift+N – Mozilla Firefox: Ctrl+Shift+P Visit http://www4.comp.polyu.edu.hk/~comp2322/HTTP- 2.htmlhttp://www4.comp.polyu.edu.hk/~comp2322/HTTP- 2.html Visit this address again Question 3 a)Did the server explicitly return the contents of the file in response to the first HTTP GET request? b)How about for the second HTTP GET request? c)Please explain this behavior. When does the browser clear all the cache when browsing in incognito or private mode? 11

12 Practice 4 Clear web cache Visit http://www4.comp.polyu.edu.hk/~comp2322/HTTP-3.htmlhttp://www4.comp.polyu.edu.hk/~comp2322/HTTP-3.html Select an HTTP message → Right-click on the TCP layer → Protocol Preferences → Uncheck Allow subdissector to reassemble TCP stream Question 4 a)How many HTTP GET request messages were sent by your browser? b)How many data-containing TCP segments were needed to carry the single HTTP response? c)What is the status code and phrase associated with the response to the HTTP GET request? d)Are there any HTTP status lines in the transmitted data associated with a TCP-induced “Continuation”? 12

13 Practice 5 Clear web cache Visit http://www4.comp.polyu.edu.hk/~comp2322/HT TP-4.html http://www4.comp.polyu.edu.hk/~comp2322/HT TP-4.html Question 5 a)How many HTTP GET request messages were sent by your browser? To which Internet addresses were these GET requests sent? b)Can you tell whether your browser downloaded the two images serially, or whether they were downloaded from the two websites in parallel? Explain. 13

14 Practice 6 Clear web cache Visit http://www4.comp.polyu.edu.hk/~comp2322/HTTP- 5.phphttp://www4.comp.polyu.edu.hk/~comp2322/HTTP- 5.php Username: wireshark-students Password: network Question 6 a)What is the status code and phrase of the server’s response to the initial HTTP GET message from your browser? b)When your browser sends the HTTP GET message for the second time, what new field is included in the HTTP GET message? 14

15 In last December, the Internet Engineering Steering Group (IESG) approved a new HTTP status code. Question 7 – What is the new status code and what is it for? 15


Download ppt "COMP2322 Lab 2 HTTP Steven Lee Jan. 29, 2016. HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):"

Similar presentations


Ads by Google