HTTP request and response

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

HTTP request and response

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which message does the browser send when you click a link to open a page?
A An HTTP request
B An HTTP response
2. Which device sends the HTTP response?
A The web browser
B The web server
3. What does a successful HTTP response contain?
A The address of the user's computer only
B The HTML of the requested page
4. The web server cannot find the page that was asked for. What does it send back?
A An error response such as 404 page not found
B No reply, so the browser sends the page itself
5. Which statement about HTTP is correct?
A The browser sends a request and the server sends a response
B The server sends a request and the browser sends a response

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1GET /index.html HTTP/1.1 AGET /shop.html HTTP/1.1
2HTTP/1.1 404 Not Found BHTTP/1.1 200 OK <html>...</html>
3The web server replies to a successful request with a response containing the page's HTML C404 means the page was NOT found. A successful response uses 200 OK and contains the page's HTML.
4The browser starts the exchange by sending a request that names the page it wants DAn HTTP request: the browser asks the web server for the page index.html
5The web server sends the HTTP request and the browser sends the HTTP response. EThe roles are swapped: the browser sends the request and the web server sends the response.
6HTTP/1.1 404 Not Found means the page was found and sent back. FAn HTTP error response: the web server cannot find the page that was requested

Definitions

HTTP request and response

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
___ /index.html HTTP/1.1
2.
HTTP/1.1 ___ OK
3.
HTTP/1.1 ___ Not Found
4.
Browser sends an HTTP _______ to the server
5.
browser -> server: HTTP request server -> browser: HTTP ________

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A browser sends HTTP request
B server receives the request
C server sends HTTP request
D browser displays the page
Question 2
A GIVE /about.html HTTP/1.1
B Host: www.school.com
C Accept: text/html
Question 3
A request = GET /shop.html
B page_exists = True
C status = 404
D send response with status
Question 4
A HTTP/1.1 200 Not Found
B Content-Type: text/html
C <h1>Page not found</h1>
Question 5
A browser sends request for page
B server looks for the page
C page is missing
D server sends 200 OK response

Answer Key

HTTP request and response
Section A: Quick Questions
Q1
A — An HTTP request
Q2
B — The web server
Q3
B — The HTML of the requested page
Q4
A — An error response such as 404 page not found
Q5
A — The browser sends a request and the server sends a response
Section B: Match the Pairs
Q1
GET /index.html HTTP/1.1 → An HTTP request: the browser asks the web server for the page index.html
Q2
HTTP/1.1 404 Not Found → An HTTP error response: the web server cannot find the page that was requested
Q3
The web server replies to a successful request with a response containing the page's HTML → HTTP/1.1 200 OK <html>...</html>
Q4
The browser starts the exchange by sending a request that names the page it wants → GET /shop.html HTTP/1.1
Q5
The web server sends the HTTP request and the browser sends the HTTP response. → The roles are swapped: the browser sends the request and the web server sends the response.
Q6
HTTP/1.1 404 Not Found means the page was found and sent back. → 404 means the page was NOT found. A successful response uses 200 OK and contains the page's HTML.
Section C: Definitions
Q1
HTTP request and response — The browser sends an HTTP request asking for a page. The web server sends back an HTTP response with the page's HTML, or an error such as 404 page not found.
Section D: Fill in the Blanks
Q1
GET /index.html HTTP/1.1
Q2
HTTP/1.1 200 OK
Q3
HTTP/1.1 404 Not Found
Q4
Browser sends an HTTP request to the server
Q5
browser -> server: HTTP request server -> browser: HTTP response
Section E: Spot the Error
Q1
C — The web server answers with an HTTP response. The request is what the browser sends, so line 3 should be 'server sends HTTP response'.
Q2
A — GIVE is not an HTTP method. A browser asks for a page with GET, so the line should be 'GET /about.html HTTP/1.1'.
Q3
C — The page exists, so the server sends 200 (OK), not the 404 error. The line should be 'status = 200'.
Q4
A — The status code and the message must match. 404 means Not Found, while 200 means OK. The line should be 'HTTP/1.1 404 Not Found'.
Q5
D — The page is missing, so the server sends an error response (404 page not found). A 200 OK response is only sent when the page is found.