----------------------------------------------------------------- ---------------------------------------------------------------- Mohamed G. Gouda CS 356 Spring 2019 Midterm 1 ----------------------------------------------------------------- (1) Using web caching may or may not speed-up requesting and getting web pages in HTTP. Describe a situation wwhere web caching is guaranteed to speed-up requesting and getting a web page "wp" in HTTP. ----------------------------------------------------------------- (2) Six messages, M1 to M6, need to be exchanged between DNS servers in order to resolve the host name of the web server (www.products.ab.com) into an IP address. Describe message M5. ---------------------------------------------------------------- (3) In the following HTTP scenario, a client c requests and gets from a server s a web page that consists of an HTML file named and refers to an image named . Both file and image are stored in server s: c --> s : SYN c <-- s : SYN-ACK c <-- s : ACK c --> s : GET file c --> s : GET image c <-- s : image c <-- s : file This scenario has errors. Write down the correct scenario. ----------------------------------------------------------------- Solutions: ----------------------------------------------------------------- (1) If the web page "wp" remains unchanged, then web caching is guaranteed to speed-up requesting and getting "wp" in HTTP. ------------------------------------------------------------------ (2) Message M5 : (from local DNS server to ab.com server) (IP address of (www.products.ab.com)?) ------------------------------------------------------------------ (3) c --> s : SYN c <-- s : SYN-ACK c --> s : ACK c --> s : GET file c <-- s : file c --> s : GET image c <-- s : image -------------------------------------------------------------------- ------------------------------------------------------------------ Mohamed G. Gouda CS 356 Spring 2019 Midterm 1A ------------------------------------------------------------------ (1) Describe two distinct scenarios of the cookie protocol between a client c and a server s. Each one of these scenarios ends with c sending to s an HTTP request message that has no "cookie header line" and s replying by sending to c an HTTP response message that has a "set-cookie header line". ------------------------------------------------------------------ (2) Consider the case where a server s sends to a client c a response message that has a "set-cookie header line" whose cookie value is CV. State the condition that the cooie value CV needs to satisfy. ------------------------------------------------------------------ (3) An HTTP client C needs to get a web page whose URL is: http://www.x.com/y This page is stored in an HTTP server s that executes on top of a TCP port i in a server host sh. For c to communicate with s (and get the web page), c needs to know: 1. TCP port i in host sh, and 2. the IP address of host sh. How does c know port i in sh and the IP address of sh. ----------------------------------------------------------------- Solutions: ----------------------------------------------------------------- (1) Scenario 1: 1. At the beginning, the cookie file of c has no s-cookie 2. Then c sends to s a rqst msg that has no cookie header line 3. Finally s replies by sending to c a response msg that has a set-cookie header line Scenario 2: 0. At the beginning, the cookie file of c has an s-cookie 1. Then c discards the s-cookie from its cookie file 2. Same as Step 2 in Scenario 1 3. Same as Step 3 in Scenario 1 ----------------------------------------------------------------- (2) The cookie value CV needs to be distinct from the cookie values that were generated in any set-cookie header line sent by server s to any client in the past. ----------------------------------------------------------------- (3) TCP port i in host sh is well-known by all HTTP clients to be port 80. The name of server host sh where the needed web page is stored is (www.x.com). To get the IP address of sh, client c forwards the name (www.x.com) to its local DNS server, and eventually c receives from its local DNS server the IP address of sh. -----------------------------------------------------------------