Networking - HTTP
Please answer the quiz and click the "Test" button at the bottom right.
Given the following request message for some HTML page, answer the questions below.
GET ../../6.031/www/fa17/classes/24-sockets-networking/ HTTP/1.1
Host: web.mit.edu
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Keep-Alive: 300
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Question 1
What is wrong in the request?
- You can't perform a
GET
request for an HTML pages - An HTML page is requested, but the client doesn't accept HTML content type
- The Host header must start with
http://
- The specified resource must be an absolute path (starts with
/
)
Question 2
For how long the client persists the TCP connection over which requests and responses will be transferred?
- Forever, as she uses keep-alive connection type
- For 300 minutes, as specified in
Keep-Alive
header - For 300 seconds, as specified in
Keep-Alive
header - The connection is terminated immediately after a successful response from the server.
Question 3
The server uses HTTP/2. Choose the correct statement:
- The request will fail since the client uses
HTTP/1.1
- The client and server might use different versions of the HTTP protocol
- The request will succeed if the client will emit the HTTP version from the first line
- The client should send a
GETVERSION
request to get the server HTTP version
Question 4
Assume the above request was responded with an HTML page consisting of some text and three images.
Consider the following statement:
For this page, the client will send one request message and receive four response messages.
- True, this is the expected behavior in HTTP/1.1
- True, as she uses the
Keep-Alive
header - False, the text including the three images will be sent on the same response of the original message
- False, the browser will perform other three HTTP requests, one per image
Question 5
Assume the server response status code is 408
. Choose the most likely root cause for this response.
- The client sent a
HEAD
request - The client machine is overloaded
- The server is down
- The server already served this resource to this client
Question 6
Assume the server response status code is 500. How can you advise the client?
- Perform the request with
Connection: close
header. - Nothing can help as this code indicates a server side error, the client can try again later.
- Check the resource path.
- Send the request over HTTPS.
Question 7
Assume the RES bash variable contains the response status of some request. Which condition will catch all possible failures (both client and server)?
- response_code != 200
- response_code > 200
- response_code < 500
- response_code >= 400