Lesson 9: Parsing requests

Contents
  • Encoding vs parsing
  • Attoparsec
  • Alternative
  • A parser of requests
  • Parser naming
  • Request line
  • Header fields
  • Miscellania

So far we’ve been writing fairly useless HTTP servers. staticResponseServer (and its staticResponseServer_slow variant which we wrote in the previous lesson) never even reads the request messages that are sent to it; it always just replies with the same response. If we want our server to do something useful, we’re going to have to figure out how to read messages – not just write them – so that we can figure out exactly what the client is requesting from us. This means parsing the request message.

Sign up for access to the full page, plus the complete archive and all the latest content.