Lesson 4.3

Keep-alive - the close decision

Why HTTP/1.1 leaves the socket open by default, how the parser computes a single close-or-keep verdict, and the frozen rule for which connection header a response emits.

30 minsrc/request.js, src/parser.js, src/response.js
  • State the keep-alive versus close default for HTTP/1.1 and HTTP/1.0 and how a connection header overrides each.
  • Compute req._closeAfter in the parser at the moment the header block completes.
  • Emit the connection header only when it carries information the client cannot assume.
Locked

This chapter is part of the framework capstone. Chapters 1 and 2 are free to build - unlock the rest to keep going.

Unlock the depth