Lesson 3.1

One data event is not one request

What TCP actually guarantees about a read, why curl hides the problem, and the accumulator-plus-cursor rewrite that lets your parser resume where a read left off instead of dropping the fragment.

35 minsrc/parser.js
  • State exactly what TCP guarantees about a read, and the three things a 'data' chunk can be.
  • Explain why rescanning the accumulated buffer from byte 0 on every read is O(N^2), and how a forward cursor makes it O(N).
  • Make the parser resumable through the header block terminator so a request split at any byte parses identically to one delivered whole.
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