ihttp-0.2.0: Incremental HTTP iteratee

MaintainerErtugrul Soeylemez <es@ertes.de>




Iteratees for header parsing.



httpHeader :: forall m. Monad m => Int -> Iteratee ByteString m (Maybe (ByteString, ByteString))Source

Get the next header from the netLinesEmpty-splitted stream. The header's content is length-limited by the given argument. If it's longer, it's safely truncated in constant space. This iteratee throws an iteratee error, if the next lines are not a valid HTTP header or the stream ends prematurely. If the next line is an empty line, this iteratee returns Nothing.

httpHeaders :: forall m. Monad m => Int -> Int -> Iteratee ByteString m HeaderMapSource

Get the headers of an HTTP request from a netLinesEmpty-splitted byte stream. The first Int specifies the maximum length of individual headers. The second Int specifies the maximum number of headers. This iteratee throws an iteratee error on invalid input, of if the stream ends prematurely.

Excess data is truncated safely in constant space.


enumHeaders :: forall b m. Monad m => HeaderMap -> Enumerator ByteString m bSource

Enumerate a HeaderMap as a protocol string stream. You can use Data.Enumerator.Binary.iterHandle to send it. Note that this enumerator never generates continuation lines. It also does not enumerate the final empty line.