-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | HTTP client package with conduit interface and HTTPS support.
--   
--   This package uses conduit for parsing the actual contents of the HTTP
--   connection. It also provides higher-level functions which allow you to
--   avoid directly dealing with streaming data. See
--   <a>http://www.yesodweb.com/book/http-conduit</a> for more information.
--   
--   The <tt>Network.HTTP.Conduit.Browser</tt> module has been moved to
--   <a>http://hackage.haskell.org/package/http-conduit-browser/</a>
@package http-conduit
@version 1.9.5.2

module Network.HTTP.Conduit.Internal

-- | Extract a <a>URI</a> from the request.
getUri :: Request m' -> URI

-- | Validate a <a>URI</a>, then add it to the request.
setUri :: Failure HttpException m => Request m' -> URI -> m (Request m')

-- | Add a <a>URI</a> to the request. If it is absolute (includes a host
--   name), add it as per <a>setUri</a>; if it is relative, merge it with
--   the existing request.
setUriRelative :: Failure HttpException m => Request m' -> URI -> m (Request m')

-- | Redirect loop
httpRedirect :: (MonadBaseControl IO m, MonadResource m, Monad m1) => Int -> (Request m1 -> m (Response (ResumableSource m1 ByteString), Maybe (Request m1))) -> (forall a. m1 a -> m a) -> Request m1 -> m (Response (ResumableSource m1 ByteString))

-- | Apply 'Request'\'s <a>checkStatus</a> and return resulting exception
--   if any.
applyCheckStatus :: (MonadResource m, MonadBaseControl IO m) => (Status -> ResponseHeaders -> CookieJar -> Maybe SomeException) -> Response (ResumableSource m ByteString) -> m (Maybe SomeException)

-- | This applies <a>receiveSetCookie</a> to a given Response
updateCookieJar :: Response a -> Request m -> UTCTime -> CookieJar -> (CookieJar, Response a)

-- | This corresponds to the algorithm described in Section 5.3 "Storage
--   Model" This function consists of calling <a>generateCookie</a>
--   followed by <a>insertCheckedCookie</a>. Use this function if you plan
--   to do both in a row. <a>generateCookie</a> and
--   <a>insertCheckedCookie</a> are only provided for more fine-grained
--   control.
receiveSetCookie :: SetCookie -> Request m -> UTCTime -> Bool -> CookieJar -> CookieJar

-- | Turn a SetCookie into a Cookie, if it is valid
generateCookie :: SetCookie -> Request m -> UTCTime -> Bool -> Maybe Cookie

-- | Insert a cookie created by generateCookie into the cookie jar (or not
--   if it shouldn't be allowed in)
insertCheckedCookie :: Cookie -> CookieJar -> Bool -> CookieJar

-- | This applies the <a>computeCookieString</a> to a given Request
insertCookiesIntoRequest :: Request m -> CookieJar -> UTCTime -> (Request m, CookieJar)

-- | This corresponds to the algorithm described in Section 5.4 "The Cookie
--   Header"
computeCookieString :: Request m -> CookieJar -> UTCTime -> Bool -> (ByteString, CookieJar)

-- | This corresponds to the eviction algorithm described in Section 5.3
--   "Storage Model"
evictExpiredCookies :: CookieJar -> UTCTime -> CookieJar


-- | This module handles building multipart/form-data. Example usage:
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   import Network
--   import Network.HTTP.Conduit
--   import Network.HTTP.Conduit.MultipartFormData
--   
--   import Data.Text.Encoding as TE
--   
--   import Control.Monad
--   
--   main = withSocketsDo $ withManager $ \m -&gt; do
--       req1 &lt;- parseUrl "http://random-cat-photo.net/cat.jpg"
--       res &lt;- httpLbs req1 m
--       req2 &lt;- parseUrl "http://example.org/~friedrich/blog/addPost.hs"
--       flip httpLbs m =&lt;&lt;
--           (formDataBody [partBS "title" "Bleaurgh"
--                         ,partBS "text" $ TE.encodeUtf8 "矢田矢田矢田矢田矢田"
--                         ,partFileSource "file1" "/home/friedrich/Photos/MyLittlePony.jpg"
--                         ,partFileRequestBody "file2" "cat.jpg" $ RequestBodyLBS $ responseBody res]
--               req2)
--   </pre>
module Network.HTTP.Conduit.MultipartFormData

-- | A single part of a multipart message.
data Part m m'
Part :: Text -> Maybe String -> Maybe MimeType -> m (RequestBody m') -> Part m m'

-- | Name of the corresponding &lt;input&gt;
partName :: Part m m' -> Text

-- | A file name, if this is an attached file
partFilename :: Part m m' -> Maybe String

-- | Content type
partContentType :: Part m m' -> Maybe MimeType

-- | Action in m which returns the body of a message.
partGetBody :: Part m m' -> m (RequestBody m')
partBS :: (Monad m, Monad m') => Text -> ByteString -> Part m m'
partLBS :: (Monad m, Monad m') => Text -> ByteString -> Part m m'

-- | Make a <a>Part</a> from a file, the entire file will reside in memory
--   at once. If you want constant memory usage use <a>partFileSource</a>
partFile :: (MonadIO m, Monad m') => Text -> FilePath -> Part m m'

-- | Stream <a>Part</a> from a file.
partFileSource :: (MonadIO m, MonadResource m') => Text -> FilePath -> Part m m'

-- | <a>partFileSourceChunked</a> will read a file and send it in chunks.
--   
--   Note that not all servers support this. Only use
--   <a>partFileSourceChunked</a> if you know the server you're sending to
--   supports chunked request bodies.
partFileSourceChunked :: (Monad m, MonadResource m') => Text -> FilePath -> Part m m'

-- | Construct a <a>Part</a> from form name, filepath and a
--   <a>RequestBody</a>
--   
--   <pre>
--   partFileRequestBody "who_calls" "caller.json" $ RequestBodyBS "{\"caller\":\"Jason J Jason\"}"
--   </pre>
--   
--   <pre>
--   -- empty upload form
--   partFileRequestBody "file" mempty mempty
--   </pre>
partFileRequestBody :: (Monad m, Monad m') => Text -> FilePath -> RequestBody m' -> Part m m'

-- | Construct a <a>Part</a> from action returning the <a>RequestBody</a>
--   
--   <pre>
--   partFileRequestBodyM "cat_photo" "haskell-the-cat.jpg" $ do
--       size &lt;- fromInteger &lt;$&gt; withBinaryFile "haskell-the-cat.jpg" ReadMode hFileSize
--       return $ RequestBodySource size $ CB.sourceFile "haskell-the-cat.jpg" $= CL.map fromByteString
--   </pre>
partFileRequestBodyM :: Monad m' => Text -> FilePath -> m (RequestBody m') -> Part m m'

-- | Add form data to the <a>Request</a>.
--   
--   This sets a new <a>requestBody</a>, adds a content-type request header
--   and changes the method to POST.
formDataBody :: (MonadIO m, Monad m') => [Part m m'] -> Request m' -> m (Request m')

-- | Add form data to request without doing any IO. Your form data should
--   only contain pure parts (<a>partBS</a>, <a>partLBS</a>,
--   <a>partFileRequestBody</a>). You'll have to supply your own boundary
--   (for example one generated by <a>webkitBoundary</a>)
formDataBodyPure :: Monad m => ByteString -> [Part Identity m] -> Request m -> Request m

-- | Add form data with supplied boundary
formDataBodyWithBoundary :: (Monad m, Monad m') => ByteString -> [Part m m'] -> Request m' -> m (Request m')

-- | Generate a boundary simillar to those generated by WebKit-based
--   browsers.
webkitBoundary :: IO ByteString
webkitBoundaryPure :: RandomGen g => g -> (ByteString, g)

-- | Combine the <a>Part</a>s to form multipart/form-data body
renderParts :: (Monad m, Monad m') => ByteString -> [Part m m'] -> m (RequestBody m')
renderPart :: (Monad m, Monad m') => ByteString -> Part m m' -> m (RequestBody m')
instance Show (Part m m')


-- | This module contains everything you need to initiate HTTP connections.
--   If you want a simple interface based on URLs, you can use
--   <a>simpleHttp</a>. If you want raw power, <a>http</a> is the
--   underlying workhorse of this package. Some examples:
--   
--   <pre>
--   -- Just download an HTML document and print it.
--   import Network.HTTP.Conduit
--   import qualified Data.ByteString.Lazy as L
--   
--   main = simpleHttp "http://www.haskell.org/" &gt;&gt;= L.putStr
--   </pre>
--   
--   This example uses interleaved IO to write the response body to a file
--   in constant memory space.
--   
--   <pre>
--   import Data.Conduit.Binary (sinkFile)
--   import Network.HTTP.Conduit
--   import qualified Data.Conduit as C
--   
--   main :: IO ()
--   main = do
--        request &lt;- parseUrl "http://google.com/"
--        withManager $ \manager -&gt; do
--            response &lt;- http request manager
--            responseBody response C.$$+- sinkFile "google.html"
--   </pre>
--   
--   The following headers are automatically set by this module, and should
--   not be added to <a>requestHeaders</a>:
--   
--   <ul>
--   <li>Cookie</li>
--   <li>Content-Length</li>
--   <li>Transfer-Encoding</li>
--   </ul>
--   
--   Note: In previous versions, the Host header would be set by this
--   module in all cases. Starting from 1.6.1, if a Host header is present
--   in <tt>requestHeaders</tt>, it will be used in place of the header
--   this module would have generated. This can be useful for calling a
--   server which utilizes virtual hosting.
--   
--   Use <a>cookieJar</a> If you want to supply cookies with your request:
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   import Network.HTTP.Conduit
--   import Network
--   import Data.Time.Clock
--   import Data.Time.Calendar
--   import qualified Control.Exception as E
--   
--   past :: UTCTime
--   past = UTCTime (ModifiedJulianDay 56200) (secondsToDiffTime 0)
--   
--   future :: UTCTime
--   future = UTCTime (ModifiedJulianDay 562000) (secondsToDiffTime 0)
--   
--   cookie :: Cookie
--   cookie = Cookie { cookie_name = "password_hash"
--                   , cookie_value = "abf472c35f8297fbcabf2911230001234fd2"
--                   , cookie_expiry_time = future
--                   , cookie_domain = "example.com"
--                   , cookie_path = "/"
--                   , cookie_creation_time = past
--                   , cookie_last_access_time = past
--                   , cookie_persistent = False
--                   , cookie_host_only = False
--                   , cookie_secure_only = False
--                   , cookie_http_only = False
--                   }
--   
--   main = withSocketsDo $ do
--        request' &lt;- parseUrl "http://example.com/secret-page"
--        let request = request' { cookieJar = Just $ createCookieJar [cookie] }
--        E.catch (withManager $ httpLbs request)
--                (\(StatusCodeException s _ _) -&gt;
--                  if statusCode==403 then putStrLn "login failed" else return ())
--   </pre>
--   
--   Any network code on Windows requires some initialization, and the
--   network library provides withSocketsDo to perform it. Therefore,
--   proper usage of this library will always involve calling that function
--   at some point. The best approach is to simply call them at the
--   beginning of your main function, such as:
--   
--   <pre>
--   import Network.HTTP.Conduit
--   import qualified Data.ByteString.Lazy as L
--   import Network (withSocketsDo)
--   
--   main = withSocketsDo
--        $ simpleHttp "http://www.haskell.org/" &gt;&gt;= L.putStr
--   
--   Cookies are implemented according to RFC 6265.
--   </pre>
--   
--   Note that by default, the functions in this package will throw
--   exceptions for non-2xx status codes. If you would like to avoid this,
--   you should use <a>checkStatus</a>, e.g.:
--   
--   <pre>
--   import Data.Conduit.Binary (sinkFile)
--   import Network.HTTP.Conduit
--   import qualified Data.Conduit as C
--   import Network
--   
--   main :: IO ()
--   main = withSocketsDo $ do
--        request' &lt;- parseUrl "http://www.yesodweb.com/does-not-exist"
--        let request = request' { checkStatus = \_ _ -&gt; Nothing }
--        res &lt;- withManager $ httpLbs request
--        print res
--   </pre>
module Network.HTTP.Conduit

-- | Download the specified URL, following any redirects, and return the
--   response body.
--   
--   This function will <a>throwIO</a> an <a>HttpException</a> for any
--   response with a non-2xx status code (besides 3xx redirects up to a
--   limit of 10 redirects). It uses <a>parseUrl</a> to parse the input.
--   This function essentially wraps <a>httpLbs</a>.
--   
--   Note: Even though this function returns a lazy bytestring, it does
--   <i>not</i> utilize lazy I/O, and therefore the entire response body
--   will live in memory. If you want constant memory usage, you'll need to
--   use the <tt>conduit</tt> package and <a>http</a> directly.
--   
--   Note: This function creates a new <a>Manager</a>. It should be avoided
--   in production code.
simpleHttp :: MonadIO m => String -> m ByteString

-- | Download the specified <a>Request</a>, returning the results as a
--   <a>Response</a>.
--   
--   This is a simplified version of <a>http</a> for the common case where
--   you simply want the response data as a simple datatype. If you want
--   more power, such as interleaved actions on the response body during
--   download, you'll need to use <a>http</a> directly. This function is
--   defined as:
--   
--   <pre>
--   httpLbs = <a>lbsResponse</a> &lt;=&lt; <a>http</a>
--   </pre>
--   
--   Even though the <a>Response</a> contains a lazy bytestring, this
--   function does <i>not</i> utilize lazy I/O, and therefore the entire
--   response body will live in memory. If you want constant memory usage,
--   you'll need to use <tt>conduit</tt> packages's <a>Source</a> returned
--   by <a>http</a>.
--   
--   Note: Unlike previous versions, this function will perform redirects,
--   as specified by the <a>redirectCount</a> setting.
httpLbs :: (MonadBaseControl IO m, MonadResource m) => Request m -> Manager -> m (Response ByteString)

-- | The most low-level function for initiating an HTTP request.
--   
--   The first argument to this function gives a full specification on the
--   request: the host to connect to, whether to use SSL, headers, etc.
--   Please see <a>Request</a> for full details. The second argument
--   specifies which <a>Manager</a> should be used.
--   
--   This function then returns a <a>Response</a> with a <a>Source</a>. The
--   <a>Response</a> contains the status code and headers that were sent
--   back to us, and the <a>Source</a> contains the body of the request.
--   Note that this <a>Source</a> allows you to have fully interleaved IO
--   actions during your HTTP download, making it possible to download very
--   large responses in constant memory. You may also directly connect the
--   returned <a>Source</a> into a <a>Sink</a>, perhaps a file or another
--   socket.
--   
--   An important note: the response body returned by this function
--   represents a live HTTP connection. As such, if you do not use the
--   response body, an open socket will be retained until the containing
--   <tt>ResourceT</tt> block exits. If you do not need the response body,
--   it is recommended that you explicitly shut down the connection
--   immediately, using the pattern:
--   
--   <pre>
--   responseBody res $$+- return ()
--   </pre>
--   
--   As a more thorough example, consider the following program. Without
--   the explicit response body closing, the program will run out of file
--   descriptors around the 1000th request (depending on the operating
--   system limits).
--   
--   <pre>
--   import Control.Monad          (replicateM_)
--   import Control.Monad.IO.Class (liftIO)
--   import Data.Conduit           (($$+-))
--   import Network                (withSocketsDo)
--   import Network.HTTP.Conduit
--   
--   main = withSocketsDo $ withManager $ \manager -&gt; do
--       req &lt;- parseUrl "http://localhost/"
--       mapM_ (worker manager req) [1..5000]
--   
--   worker manager req i = do
--       res &lt;- http req manager
--       responseBody res $$+- return () -- The important line
--       liftIO $ print (i, responseStatus res)
--   </pre>
--   
--   Note: Unlike previous versions, this function will perform redirects,
--   as specified by the <a>redirectCount</a> setting.
http :: (MonadResource m, MonadBaseControl IO m) => Request m -> Manager -> m (Response (ResumableSource m ByteString))

-- | Define a HTTP proxy, consisting of a hostname and port number.
data Proxy
Proxy :: ByteString -> Int -> Proxy

-- | The host name of the HTTP proxy.
proxyHost :: Proxy -> ByteString

-- | The port number of the HTTP proxy.
proxyPort :: Proxy -> Int

-- | When using one of the <a>RequestBodySource</a> /
--   <a>RequestBodySourceChunked</a> constructors, you must ensure that the
--   <tt>Source</tt> can be called multiple times. Usually this is not a
--   problem.
--   
--   The <a>RequestBodySourceChunked</a> will send a chunked request body,
--   note that not all servers support this. Only use
--   <a>RequestBodySourceChunked</a> if you know the server you're sending
--   to supports chunked request bodies.
data RequestBody m
RequestBodyLBS :: ByteString -> RequestBody m
RequestBodyBS :: ByteString -> RequestBody m
RequestBodyBuilder :: Int64 -> Builder -> RequestBody m
RequestBodySource :: Int64 -> (Source m Builder) -> RequestBody m
RequestBodySourceChunked :: (Source m Builder) -> RequestBody m

-- | All information on how to connect to a host and what should be sent in
--   the HTTP request.
--   
--   If you simply wish to download from a URL, see <tt>parseUrl</tt>.
--   
--   The constructor for this data type is not exposed. Instead, you should
--   use either the <a>def</a> method to retrieve a default instance, or
--   <tt>parseUrl</tt> to construct from a URL, and then use the records
--   below to make modifications. This approach allows http-conduit to add
--   configuration options without breaking backwards compatibility.
--   
--   For example, to construct a POST request, you could do something like:
--   
--   <pre>
--   initReq &lt;- parseUrl "http://www.example.com/path"
--   let req = initReq
--               { method = "POST"
--               }
--   </pre>
--   
--   For more information, please see
--   <a>http://www.yesodweb.com/book/settings-types</a>.
data Request m

-- | The default value for this type.
def :: Default a => a

-- | HTTP request method, eg GET, POST.
method :: Request m -> Method

-- | Whether to use HTTPS (ie, SSL).
secure :: Request m -> Bool

-- | SSL client certificates
clientCertificates :: Request m -> [(X509, Maybe PrivateKey)]
host :: Request m -> ByteString
port :: Request m -> Int

-- | Everything from the host to the query string.
path :: Request m -> ByteString
queryString :: Request m -> ByteString

-- | Custom HTTP request headers
--   
--   As already stated in the introduction, the Content-Length and Host
--   headers are set automatically by this module, and shall not be added
--   to requestHeaders.
--   
--   Moreover, the Accept-Encoding header is set implicitly to gzip for
--   convenience by default. This behaviour can be overridden if needed, by
--   setting the header explicitly to a different value. In order to omit
--   the Accept-Header altogether, set it to the empty string "". If you
--   need an empty Accept-Header (i.e. requesting the identity encoding),
--   set it to a non-empty white-space string, e.g. " ". See RFC 2616
--   section 14.3 for details about the semantics of the Accept-Header
--   field. If you request a content-encoding not supported by this module,
--   you will have to decode it yourself (see also the <a>decompress</a>
--   field).
--   
--   Note: Multiple header fields with the same field-name will result in
--   multiple header fields being sent and therefore it's the
--   responsibility of the client code to ensure that the rules from RFC
--   2616 section 4.2 are honoured.
requestHeaders :: Request m -> RequestHeaders
requestBody :: Request m -> RequestBody m

-- | Optional HTTP proxy.
proxy :: Request m -> Maybe Proxy

-- | Optional SOCKS proxy.
socksProxy :: Request m -> Maybe SocksConf

-- | Optional resolved host address.
--   
--   Since 1.8.9
hostAddress :: Request m -> Maybe HostAddress

-- | If <tt>True</tt>, a chunked and/or gzipped body will not be decoded.
--   Use with caution.
rawBody :: Request m -> Bool

-- | Predicate to specify whether gzipped data should be decompressed on
--   the fly (see <tt>alwaysDecompress</tt> and
--   <tt>browserDecompress</tt>). Default: browserDecompress.
decompress :: Request m -> ContentType -> Bool

-- | How many redirects to follow when getting a resource. 0 means follow
--   no redirects. Default value: 10.
redirectCount :: Request m -> Int

-- | Check the status code. Note that this will run after all redirects are
--   performed. Default: return a <tt>StatusCodeException</tt> on non-2XX
--   responses.
checkStatus :: Request m -> Status -> ResponseHeaders -> CookieJar -> Maybe SomeException

-- | Number of microseconds to wait for a response. If <tt>Nothing</tt>,
--   will wait indefinitely. Default: 5 seconds.
responseTimeout :: Request m -> Maybe Int

-- | A user-defined cookie jar. If <a>Nothing</a>, no cookie handling will
--   take place, "Cookie" headers in <a>requestHeaders</a> will be sent
--   raw, and <a>responseCookieJar</a> will be empty.
--   
--   Since 1.9.0
cookieJar :: Request m -> Maybe CookieJar

-- | Wraps the calls for getting new connections. This can be useful for
--   instituting some kind of timeouts. The first argument is the value of
--   <tt>responseTimeout</tt>. Second argument is the exception to be
--   thrown on failure.
--   
--   Default: If <tt>responseTimeout</tt> is <tt>Nothing</tt>, does
--   nothing. Otherwise, institutes timeout, and returns remaining time for
--   <tt>responseTimeout</tt>.
--   
--   Since 1.8.8
getConnectionWrapper :: Request m -> forall n. (MonadResource n, MonadBaseControl IO n) => Maybe Int -> HttpException -> n (ConnRelease n, ConnInfo, ManagedConn) -> n (Maybe Int, (ConnRelease n, ConnInfo, ManagedConn))

-- | A simple representation of the HTTP response created by
--   <tt>lbsConsumer</tt>.
data Response body

-- | Status code of the response.
responseStatus :: Response body -> Status

-- | HTTP version used by the server.
responseVersion :: Response body -> HttpVersion

-- | Response headers sent by the server.
responseHeaders :: Response body -> ResponseHeaders

-- | Response body sent by the server.
responseBody :: Response body -> body

-- | Cookies set on the client after interacting with the server. If
--   cookies have been disabled by setting <a>cookieJar</a> to
--   <tt>Nothing</tt>, then this will always be empty.
responseCookieJar :: Response body -> CookieJar

-- | Keeps track of open connections for keep-alive. If possible, you
--   should share a single <a>Manager</a> between multiple threads and
--   requests.
data Manager

-- | Create a <a>Manager</a>. You must manually call <a>closeManager</a> to
--   shut it down.
--   
--   Creating a new <a>Manager</a> is an expensive operation, you are
--   advised to share a single <a>Manager</a> between requests instead.
newManager :: ManagerSettings -> IO Manager

-- | Close all connections in a <a>Manager</a>. Afterwards, the
--   <a>Manager</a> can be reused if desired.
--   
--   Note that this doesn't affect currently in-flight connections, meaning
--   you can safely use it without hurting any queries you may have
--   concurrently running.
closeManager :: Manager -> IO ()

-- | Create a new manager, use it in the provided function, and then
--   release it.
--   
--   This function uses the default manager settings. For more control, use
--   <a>withManagerSettings</a>.
withManager :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m) => (Manager -> ResourceT m a) -> m a

-- | Create a new manager with provided settings, use it in the provided
--   function, and then release it.
withManagerSettings :: (MonadIO m, MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m) => ManagerSettings -> (Manager -> ResourceT m a) -> m a

-- | Settings for a <tt>Manager</tt>. Please use the <a>def</a> function
--   and then modify individual settings.
data ManagerSettings

-- | Number of connections to a single host to keep alive. Default: 10.
managerConnCount :: ManagerSettings -> Int

-- | Check if the server certificate is valid. Only relevant for HTTPS.
managerCheckCerts :: ManagerSettings -> CertificateStore -> ByteString -> [X509] -> IO CertificateUsage

-- | Load up the certificate store. By default uses the system store.
managerCertStore :: ManagerSettings -> IO CertificateStore

-- | Default timeout (in microseconds) to be applied to requests which do
--   not provide a timeout value.
--   
--   Default is 5 seconds
--   
--   Since 1.9.3
managerResponseTimeout :: ManagerSettings -> Maybe Int

-- | Check certificates using the operating system's certificate checker.
defaultCheckCerts :: CertificateStore -> ByteString -> [X509] -> IO CertificateUsage
data Cookie
Cookie :: ByteString -> ByteString -> UTCTime -> ByteString -> ByteString -> UTCTime -> UTCTime -> Bool -> Bool -> Bool -> Bool -> Cookie
cookie_name :: Cookie -> ByteString
cookie_value :: Cookie -> ByteString
cookie_expiry_time :: Cookie -> UTCTime
cookie_domain :: Cookie -> ByteString
cookie_path :: Cookie -> ByteString
cookie_creation_time :: Cookie -> UTCTime
cookie_last_access_time :: Cookie -> UTCTime
cookie_persistent :: Cookie -> Bool
cookie_host_only :: Cookie -> Bool
cookie_secure_only :: Cookie -> Bool
cookie_http_only :: Cookie -> Bool
data CookieJar
createCookieJar :: [Cookie] -> CookieJar
destroyCookieJar :: CookieJar -> [Cookie]

-- | Convert a URL into a <a>Request</a>.
--   
--   This defaults some of the values in <a>Request</a>, such as setting
--   <a>method</a> to GET and <a>requestHeaders</a> to <tt>[]</tt>.
--   
--   Since this function uses <a>Failure</a>, the return monad can be
--   anything that is an instance of <a>Failure</a>, such as <a>IO</a> or
--   <a>Maybe</a>.
parseUrl :: Failure HttpException m => String -> m (Request m')

-- | Add a Basic Auth header (with the specified user name and password) to
--   the given Request. Ignore error handling:
--   
--   applyBasicAuth <a>user</a> <a>pass</a> $ fromJust $ parseUrl url
applyBasicAuth :: ByteString -> ByteString -> Request m -> Request m

-- | Add a proxy to the Request so that the Request when executed will use
--   the provided proxy.
addProxy :: ByteString -> Int -> Request m -> Request m

-- | Convert a <a>Response</a> that has a <a>Source</a> body to one with a
--   lazy <a>ByteString</a> body.
lbsResponse :: Monad m => Response (ResumableSource m ByteString) -> m (Response ByteString)

-- | If a request is a redirection (status code 3xx) this function will
--   create a new request from the old request, the server headers returned
--   with the redirection, and the redirection code itself. This function
--   returns <a>Nothing</a> if the code is not a 3xx, there is no
--   <tt>location</tt> header included, or if the redirected response
--   couldn't be parsed with <a>parseUrl</a>.
--   
--   If a user of this library wants to know the url chain that results
--   from a specific request, that user has to re-implement the
--   redirect-following logic themselves. An example of that might look
--   like this:
--   
--   <pre>
--   myHttp req man = do
--      (res, redirectRequests) &lt;- (`runStateT` []) $
--           'httpRedirect'
--               9000
--               (\req' -&gt; do
--                  res &lt;- http req'{redirectCount=0} man
--                  modify (\rqs -&gt; req' : rqs)
--                  return (res, getRedirectedRequest req' (responseHeaders res) (responseCookieJar res) (W.statusCode (responseStatus res))
--                  )
--               'lift'
--               req
--      applyCheckStatus (checkStatus req) res
--      return redirectRequests
--   </pre>
getRedirectedRequest :: Request m -> ResponseHeaders -> CookieJar -> Int -> Maybe (Request m)

-- | Always decompress a compressed stream.
alwaysDecompress :: ContentType -> Bool

-- | Decompress a compressed stream unless the content-type is
--   'application/x-tar'.
browserDecompress :: ContentType -> Bool

-- | Add url-encoded parameters to the <a>Request</a>.
--   
--   This sets a new <a>requestBody</a>, adds a content-type request header
--   and changes the <a>method</a> to POST.
urlEncodedBody :: Monad m => [(ByteString, ByteString)] -> Request m' -> Request m
data HttpException
StatusCodeException :: Status -> ResponseHeaders -> CookieJar -> HttpException
InvalidUrlException :: String -> String -> HttpException

-- | List of encountered responses containing redirects in reverse
--   chronological order; including last redirect, which triggered the
--   exception and was not followed.
TooManyRedirects :: [Response ByteString] -> HttpException

-- | Response containing unparseable redirect.
UnparseableRedirect :: (Response ByteString) -> HttpException
TooManyRetries :: HttpException
HttpParserException :: String -> HttpException
HandshakeFailed :: HttpException
OverlongHeaders :: HttpException
ResponseTimeout :: HttpException

-- | host/port
FailedConnectionException :: String -> Int -> HttpException
ExpectedBlankAfter100Continue :: HttpException
InvalidStatusLine :: ByteString -> HttpException
InvalidHeader :: ByteString -> HttpException
InternalIOException :: IOException -> HttpException

-- | host/port
ProxyConnectException :: ByteString -> Int -> (Either ByteString HttpException) -> HttpException
NoResponseDataReceived :: HttpException
TlsException :: SomeException -> HttpException

-- | Expected size/actual size.
--   
--   Since 1.9.4
ResponseBodyTooShort :: Word64 -> Word64 -> HttpException

-- | Since 1.9.4
InvalidChunkHeaders :: HttpException
