Download presentation
Presentation is loading. Please wait.
1
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017
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
3
HTTP message Two types: request, response HTTP request message
ASCII (human-readable format) 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
5
HTTP message HTTP response message Status line HTTP/1.1 200 OK
Header lines Date: Thu, 28 Jan :53:26 GMT Server: Apache Last-Modified: Thu, 03 Dec :37:20 Content-Length: 2217 Connection: close Content-Type: text/html Data <HEADER> <TITLE>The World Wide Web Project</TITLE> </HEADER> <BODY> …
6
HTTP response status codes
200 OK Request succeeded, requested resource in this message later 301 Moved Permanently Requested resource moved, new location specified in this message later (Location:) 404 Not Found Requested resource not found on this server 451 Unavailable For Legal Reason Requested resource cannot be served for legal reasons 503 Service Unavailable The server is currently unavailable (due to overloading or maintenance)
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
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
9
Practice 1 Y:\Win32\WiresharkPortable
Visit Question 1 (12 marks) What is the HTTP version? What language(s), if any, does your browser indicate that it can accept from the server? What are the IP addresses of your computer and the server? What is the status code returned from the server for the HTML file? When was the HTML file last modified at the server? How many bytes of content are returned to your browser?
10
Practice 2 Question 2 (10 marks)
Inspect the contents of the HTTP request Is there any “If-Modified-Since” line in the request? Does the server explicitly return the contents of the file? How can you tell? Visit again Inspect the contents of the second HTTP request Is there any “If-Modified-Since” line in the request? If so, what information follows the “If-Modified-Since” header? What is the status code returned from the server? Does the server explicitly return the contents of the file? Explain.
11
Practice 3 Open a new incognito or private window in your browser
Google Chrome: Ctrl+Shift+N Mozilla Firefox: Ctrl+Shift+P Visit again Question 3 (4 marks) Does the server explicitly return the content of the file when the browser is in incognito mode? Explain this behavior? Does the browser cache the content in incognito mode? Assuming yes to (b), when will the browser clear the content cached when operating in incognito mode?
12
Practice 4 Visit Select an HTTP message → Right-click on the TCP layer → Protocol Preferences → Uncheck Allow subdissector to reassemble TCP stream Question 4 (4 marks) How many HTTP requests are sent by your browser? How many data-containing TCP segments were needed to carry the single HTTP response? What is the status code of the response? Are there any HTTP status lines in packets marked as “Continuation”?
13
Practice 5 Visit Question 5 (4 marks) How many HTTP requests were sent by your browser to retrieve the two images? What IP address(es) was the requests sent to? Does your browser download the two images serially or in parallel? Explain.
14
Practice 6 Visit Username: ICE-9 Password: Dashwood Question 6 (4 marks) What is the status code of the response to the first HTTP request? What new field is included in the second HTTP request?
15
Practice 7 Visit Look for the request to retrieve the image file Question 7 What is the status code of the response to the request? What does that mean? Where has the image file been moved to? Normally a second request would be made to retrieve a moved resource from its new location. Why cannot you see the second request in this case?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.