HTTP: A library for client-side HTTP

[ bsd3, library, network ] [ Propose Tags ] [ Report a vulnerability ]

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:

Flags

Manual Flags

NameDescriptionDefault
warn-as-error

Build with warnings-as-errors

Disabled
warp-tests

Test against warp

Disabled
Automatic Flags
NameDescriptionDefault
conduit10

Use version 1.0.x or below of the conduit package (for the test suite)

Disabled
network-uri

Get Network.URI from the network-uri package

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 3000.0.0, 3001.0.0, 3001.0.1, 3001.0.2, 3001.0.3, 3001.0.4, 3001.1.3, 3001.1.4, 3001.1.5, 4000.0.0, 4000.0.1, 4000.0.2, 4000.0.3, 4000.0.4, 4000.0.5, 4000.0.6, 4000.0.7, 4000.0.8, 4000.0.9, 4000.0.10, 4000.1.0, 4000.1.1, 4000.1.2, 4000.2.0, 4000.2.1, 4000.2.2, 4000.2.3, 4000.2.4, 4000.2.5, 4000.2.6, 4000.2.7, 4000.2.8, 4000.2.9, 4000.2.10, 4000.2.11, 4000.2.12, 4000.2.13, 4000.2.14, 4000.2.15, 4000.2.16, 4000.2.16.1, 4000.2.17, 4000.2.18, 4000.2.19, 4000.2.20, 4000.2.21, 4000.2.22, 4000.2.23, 4000.3.0, 4000.3.1, 4000.3.2, 4000.3.3, 4000.3.4, 4000.3.5, 4000.3.6, 4000.3.7, 4000.3.8, 4000.3.9, 4000.3.10, 4000.3.11, 4000.3.12, 4000.3.13, 4000.3.14, 4000.3.15, 4000.3.16, 4000.4.0, 4000.4.1
Change log CHANGES
Dependencies array (>=0.3.0.2 && <0.6), base (>=4.6.0.0 && <4.21), bytestring (>=0.9.1.5 && <0.13), mtl (>=2.0.0.0 && <2.4), network (>=2.4 && <3.3), network-uri (>=2.6 && <2.7), parsec (>=2.0 && <3.2), time (>=1.1.2.3 && <1.15), transformers (>=0.2.0.0 && <0.7), Win32 (>=2.2.0.0 && <2.14) [details]
Tested with ghc ==9.10.0, ghc ==9.8.2, ghc ==9.6.4, ghc ==9.4.8, ghc ==9.2.8, ghc ==9.0.2, ghc ==8.10.7, ghc ==8.8.4, ghc ==8.6.5, ghc ==8.4.4, ghc ==8.2.2, ghc ==8.0.2
License BSD-3-Clause
Author Warrick Gray <warrick.gray@hotmail.com>
Maintainer Ganesh Sittampalam <ganesh@earth.li>
Revised Revision 4 made by AndreasAbel at 2024-04-15T14:01:49Z
Category Network
Home page https://github.com/haskell/HTTP
Source repo head: git clone https://github.com/haskell/HTTP.git
Uploaded by GaneshSittampalam at 2022-05-17T00:28:32Z
Distributions Arch:4000.4.1, Debian:4000.3.14, Fedora:4000.4.1, FreeBSD:4000.2.20, LTSHaskell:4000.4.1, NixOS:4000.4.1, Stackage:4000.4.1, openSUSE:4000.4.1
Reverse Dependencies 200 direct, 541 indirect [details]
Downloads 281920 total (490 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-05-17 [all 1 reports]