Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data CURL
- withLibcurl :: IO r -> IO r
- withCurl :: (CURL -> IO r) -> IO r
- curlPerform :: CURL -> String -> Int -> IO ByteString
- curlResponseCode :: CURL -> IO Int
Documentation
withLibcurl :: IO r -> IO r Source #
withCurl :: (CURL -> IO r) -> IO r Source #
Create curl handle.
Note: you can reuse CURL
handle for multiple requests.
:: CURL | CURL handle |
-> String | URL |
-> Int | Expected size of the output. |
-> IO ByteString |
Perform request.
The resulting ByteString
will be exactly of the size specified by size argument.
If response is smaller, the rest will be zeros; if larger the response will be truncated (not read further)!
It's your job to verify that transport was successful, e.g. if you know the expected hash of the download.
curlPerform
is thread-safe (underlying handle in CURL
is wrapped in MVar
).