Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Session a
- run :: Session a -> Manager -> IO (Either HttpException a)
- withManager :: (Manager -> IO (Either HttpException a)) -> Session a
- requestLBSResponse :: Request -> Session (Response ByteString)
- requestLBSBody :: Request -> Session ByteString
- requestBSBody :: Request -> Session ByteString
- data Manager :: *
- data HttpException :: *
- = StatusCodeException Status ResponseHeaders CookieJar
- | InvalidUrlException String String
- | TooManyRedirects [Response ByteString]
- | UnparseableRedirect (Response ByteString)
- | TooManyRetries
- | HttpParserException String
- | HandshakeFailed
- | OverlongHeaders
- | ResponseTimeout
- | FailedConnectionException String Int
- | FailedConnectionException2 String Int Bool SomeException
- | ExpectedBlankAfter100Continue
- | InvalidStatusLine ByteString
- | InvalidHeader ByteString
- | InternalIOException IOException
- | ProxyConnectException ByteString Int (Either ByteString HttpException)
- | NoResponseDataReceived
- | TlsException SomeException
- | TlsNotSupported
- | ResponseBodyTooShort Word64 Word64
- | InvalidChunkHeaders
- | IncompleteHeaders
- | InvalidDestinationHost ByteString
- | HttpZlibException ZlibException
- | InvalidProxyEnvironmentVariable Text Text
- | ResponseLengthAndChunkingBothUsed
- | TlsExceptionHostPort SomeException ByteString Int
- data Request :: *
Documentation
A session on an HTTP manager.
withManager :: (Manager -> IO (Either HttpException a)) -> Session a Source
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 :: *
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: |
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 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