Safe Haskell | None |
---|---|
Language | Haskell2010 |
Automatic fetching and decoding of resources needed for Tor; specifically, this hides a lot of the HTTP GET cruft that would otherwise be sprinkled about the code.
Users should avoid using this module for long-term projects. It ended up both growing a little bit beyond what was intended, and also managed to be less generally useful than I had thought. Thus, I suspect this module will be overhauled in the not-too-distant future.
- data FetchItem
- class Fetchable a
- fetch :: Fetchable a => TorNetworkStack ls s -> String -> Word16 -> FetchItem -> IO (Either String a)
- readResponse :: TorNetworkStack ls s -> s -> IO (Either String ByteString)
Documentation
One of the things we can automatically fetch.
A set of types that are automatically fetchable by this subsystem.
parseBlob
fetch :: Fetchable a => TorNetworkStack ls s -> String -> Word16 -> FetchItem -> IO (Either String a) Source
Fetch the given item from the given host and port, using the given network stack, returning either the error that occurred fetching that item or the item. The String used for the host will be directly passed to the network stack's connect function without further processing, so you should think about whether that means you need to address resolution or not.
readResponse :: TorNetworkStack ls s -> s -> IO (Either String ByteString) Source
Read the response to a GET request. This returns the parsed interior of a GET response, rather than the whole response, so one of the possible errors you might receive is an HTTP response parsing error.