The HTTP package supports client-side web programming in Haskell. It lets you set up HTTP connections, transmitting requests and processing the responses coming back, all from within the comforts of Haskell. It's dependent on the network package to operate, but other than that, the implementation is all written in Haskell.
A basic API for issuing single HTTP requests + receiving responses is provided. On top of that, a session-level abstraction is also on offer (the 'BrowserAction' monad); it taking care of handling the management of persistent connections, proxies, state (cookies) and authentication credentials required to handle multi-step interactions with a web server.
The representation of the bytes flowing across is extensible via the use of a type class, letting you pick the representation of requests and responses that best fits your use. Some pre-packaged, common instances are provided for you ('ByteString', 'String').
Here's an example use:
> > do > rsp <- Network.HTTP.simpleHTTP (getRequest "http://www.haskell.org/") > -- fetch document and return it (as a 'String'.) > fmap (take 100) (getResponseBody rsp) > > do > (_, rsp) > <- Network.Browser.browse $ do > setAllowRedirects True -- handle HTTP redirects > request $ getRequest "http://www.haskell.org/" > return (take 100 (rspBody rsp))
Note: This package does not support HTTPS connections. If you need HTTPS, take a look at the following packages:
<http://hackage.haskell.org/package/http-streams http-streams>
<http://hackage.haskell.org/package/http-client http-client> (in combination
with <http://hackage.haskell.org/package/http-client-tls http-client-tls>)
<http://hackage.haskell.org/package/req req>
<http://hackage.haskell.org/package/wreq wreq>.
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
4000.3.16-bp156.4.4 info | GA Release | 2024-02-21 | 15 SP6 |
|
|
4000.3.16-bp155.3.14 info | GA Release | 2023-05-22 | 15 SP5 |
|
|
4000.3.16-bp154.2.11 info | GA Release | 2022-05-09 | 15 SP4 |
|
|
4000.3.14-bp153.1.20 info | GA Release | 2021-04-08 | 15 SP3 |
|
|
4000.3.14-bp152.3.2 info | GA Release | 2020-06-16 | 15 SP2 |
|
|
4000.3.12-bp151.2.2 info | GA Release | 2019-07-17 | 15 SP1 |
|
|
4000.3.12-bp151.1.9 info | GA Release | 2019-05-31 | 15 SP1 |
|
|
4000.3.7-bp150.2.4 info | GA Release | 2018-08-01 | 15 |
|
|
4000.3.7-bp150.2.6 info | GA Release | 2018-07-31 | 15 |
|
|
4000.3.7-bp150.2.5 info | GA Release | 2018-07-30 | 15 |
|
|
4000.3.3-6.5 info | 5585 | 2016-09-14 | 12 GA-SP5 |
|
|
4000.3.3-6.17 info | 5585 | 2016-09-14 | 12 GA-SP5 |
|
|
4000.3.3-3.1 info | openSUSE-2016-291 | 2016-07-04 | 12 GA-SP5 |
|
|