Bitpath

Lesson 2 · Unit 03

HTTP

Requests and responses as plain text: methods, status codes, cookies

13 exercisesabout 3 min

What you practise

  • A request and a response as plain text, methods and what safe and idempotent mean, status code families, headers that matter (Host, Content-Type, Authorization, Cookie), statelessness and cookies

Try a question from this lesson

Pick one

A browser opens a TCP connection to port 80 and sends exactly this text. What is it asking for?

GET /about HTTP/1.1
Host: example.com
Accept: text/html

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

The reply is text too

A response starts with a status line: the version, a three-digit code and a short phrase.

Then come headers describing the body, one blank line, and the body itself. The blank line is how the receiver knows the headers have ended.

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 512

<html>...

Concept

Methods make promises

A method says what kind of action a request is.

Safe means it changes nothing on the server. Idempotent means that doing it twice leaves the same result as doing it once, so it can be retried without worry.

GET is both. POST is neither.

GET     read            safe
PUT     replace         idempotent
DELETE  remove          idempotent
POST    create or act   neither

10 more exercises in the app

  • 2× fill the blanks
  • 1× match the pairs
  • 5× multiple choice
  • 1× true or false
  • 1× type the answer

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy