Embercode
✕
How the Internet WorksQuick quiz

Cookies, caching and CORS

10 questions. Covers CORS and same-origin.

Questions 1 to 5 of 10

  1. 1. A login route sends this header. The login works in the server's own log, but a browser never keeps the cookie. Which part is the bug? ``python handler.send_header( "Set-Cookie", "session=MiHFJraq3J; HttpOnly; Path=/; SameSite=None", ) ``
  2. 2. Logout should end the login. After this route runs, replaying the old cookie value still gets Hello, maya from /me. What is the bug? ``python def logout(self): self.send_response(200) self.send_header("Set-Cookie", "session=; HttpOnly; Path=/; Max-Age=0") self.end_headers() self.wfile.write(b"logged out\n") ``
  3. 3. True or false: a cookie set with Max-Age=1800 ends the server-side login after 30 minutes.
  4. 4. True or false: a response with Cache-Control: no-cache is never stored by the browser.
  5. 5. A login cookie has SameSite=Lax. A form on evil.example sends a POST to bank.example. What does the browser do with the cookie?

5 question(s) left on this page.