http-client-session-0.1.1: A simple abstraction over the "http-client" connection manager

Safe HaskellNone
LanguageHaskell2010

HTTPClient.Session

Contents

Synopsis

Documentation

Reexports

data Manager :: *

Keeps track of open connections for keep-alive.

If possible, you should share a single Manager between multiple threads and requests.

Since 0.1.0

data HttpException :: *

Constructors

StatusCodeException Status ResponseHeaders CookieJar 
InvalidUrlException String String 
TooManyRedirects [Response ByteString]

List of encountered responses containing redirects in reverse chronological order; including last redirect, which triggered the exception and was not followed.

UnparseableRedirect (Response ByteString)

Response containing unparseable redirect.

TooManyRetries 
HttpParserException String 
HandshakeFailed 
OverlongHeaders 
ResponseTimeout 
FailedConnectionException String Int

host/port

Note that in old versions of http-client and http-conduit, this exception would indicate a failed attempt to create a connection. However, since (at least) http-client 0.4, it indicates a timeout occurred while trying to establish the connection. For more information on this, see:

https://github.com/snoyberg/http-client/commit/b86b1cdd91e56ee33150433dedb32954d2082621#commitcomment-10718689

FailedConnectionException2 String Int Bool SomeException

host/port/secure

ExpectedBlankAfter100Continue 
InvalidStatusLine ByteString 
InvalidHeader ByteString 
InternalIOException IOException 
ProxyConnectException ByteString Int (Either ByteString HttpException)

host/port

NoResponseDataReceived 
TlsException SomeException 
TlsNotSupported 
ResponseBodyTooShort Word64 Word64

Expected size/actual size.

Since 1.9.4

InvalidChunkHeaders

Since 1.9.4

IncompleteHeaders 
InvalidDestinationHost ByteString 
HttpZlibException ZlibException

Since 0.3

InvalidProxyEnvironmentVariable Text Text

Environment name and value

Since 0.4.7

ResponseLengthAndChunkingBothUsed

Detect a case where both the content-length header and transfer-encoding: chunked are used. Since 0.4.8.

Since 0.4.11 this exception isn't thrown anymore.

TlsExceptionHostPort SomeException ByteString Int

TLS exception, together with the host and port

Since: 0.4.24

data Request :: *

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 parseUrl.

The constructor for this data type is not exposed. Instead, you should use either the def method to retrieve a default instance, or parseUrl to construct from a URL, and then use the records below to make modifications. This approach allows http-client to add configuration options without breaking backwards compatibility.

For example, to construct a POST request, you could do something like:

initReq <- parseUrl "http://www.example.com/path"
let req = initReq
            { method = "POST"
            }

For more information, please see http://www.yesodweb.com/book/settings-types.

Since 0.1.0