Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
http-conduit was written as a companion to WAI. It too uses
conduit and blaze-builder pervasively, meaning we once again
get easy interop with aeson. A few extra comments for those not familiar with
http-conduit:
A Manager is present to keep track of open connections, so
that multiple requests to the same server use the same connection. You usually want to use the
withManager function to create and clean up this
Manager, since it is exception safe.
We need to know the size of our request body, which can’t be determined directly from
a Builder. Instead, we convert the Builder into a lazy
ByteString and take the size from there.
There are a number of different functions for initiating a request. We use
http, which allows us to directly access the data stream. There are other
higher level functions (such as httpLbs) that let you ignore the issues of
sources and get the entire body directly.