hurl-2.3.0.1: Haskell URL resolver
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.URI.Fetch

Description

Retrieves documents for a URL, supporting multiple URL schemes that can be disabled at build-time for reduced dependencies.

Synopsis

Documentation

data Session Source #

Data shared accross multiple URI requests.

newSession :: IO Session Source #

Initializes a default Session object to support HTTPS & Accept-Language if HTTP is enabled.

fetchURL Source #

Arguments

:: Session

The session of which this request is a part.

-> [String]

The expected MIMEtypes in priority order.

-> URI

The URL to retrieve

-> IO (String, Either Text ByteString)

The MIMEtype & possibly text-decoded response.

Retrieves a URL-identified resource & it's MIMEtype, possibly decoding it's text.

fetchURL' :: Session -> [String] -> URI -> IO (URI, String, Either Text ByteString) Source #

As per fetchURL, but also returns the redirected URI.

fetchURLs :: Session -> [String] -> [URI] -> ((URI, String, Either Text ByteString) -> IO a) -> IO [(URI, a)] Source #

Concurrently fetch given URLs.

submitURL :: Session -> [String] -> URI -> Text -> String -> IO (URI, String, Either Text ByteString) Source #

See submitURL', preserved for backwards compatability. This is a little more cumbersome to use, & doesn't support file uploads. Was designed naively based on convenience of initial caller.

submitURL' :: Session -> [String] -> URI -> ByteString -> ByteString -> [(String, Either String FilePath)] -> IO (URI, String, Either Text ByteString) Source #

Uploads given key-value pairs to the specified URL using the specified HTTP method & encoding. The key-value pairs may specify filepaths, in which case the method must be POST and the encoding must be "multipart/form-data" for that data to get sent.

Unsupported encodings (values other than "application/x-www-form-urlencoded", "textplain", or "multipartform-data") omits the key-value pairs from the request.

mimeERR :: String Source #

Internal MIMEtypes for error reporting

htmlERR :: String Source #

Internal MIMEtypes for error reporting

dispatchByMIME :: Session -> String -> URI -> IO (Maybe String) Source #

appsForMIME :: Session -> String -> IO [Application] Source #

data Application Source #

Constructors

Application 

Fields

dispatchByApp :: Session -> Application -> String -> URI -> IO Bool Source #

saveDownload :: URI -> FilePath -> (URI, String, Either Text ByteString) -> IO URI Source #

write download to a file in the given directory.

downloadToURI :: (URI, String, Either Text ByteString) -> URI Source #

Convert a download into a data: URI

data LogRecord Source #

Constructors

LogRecord 

Fields

writeLog :: Handle -> Session -> IO () Source #