- Parsers that don’t parse anything
- Parsing given a content length
- Parsing a chunked body
- Function server
- UTF-8 responses
- Echo example
- Exercise 1: Introducing I/O
- Exercise 2: Keeping state
In this lesson we fill in the final pieces to complete the
Request parser, and then we begin putting it to work. We’re going to touch the sockets again; this time in addition to writing to sockets we’ll be reading from them.
The function we left unwritten in the last lesson was:
parserForBodyEncoding :: Either String (Maybe BodyEncoding) -> Parser (Maybe MessageBody)
There are four cases to consider when we write a function whose argument is the result of the body encoding analysis function we wrote in the last lesson:
- The analysis failed and produced an error message.
- There is no body to parse.
Content-Lengthheader indicated some number of bytes to read.
Transfer-Encodingheader indicated that the body is chunked.