An HTTP client engine

Version on this page:0.4.20
LTS Haskell 9.14:
Stackage Nightly 2017-11-24:
Latest on Hackage:
MIT licensed by Michael Snoyman
Maintained by

Module documentation for 0.4.20


Full tutorial docs are available at:

An HTTP client engine, intended as a base layer for more user-friendly packages.

This codebase has been refactored from http-conduit.

Note that, if you want to make HTTPS secure connections, you should use http-client-tls in addition to this library.

Below is a series of cookbook recipes. A number of recipes exist elsewhere, including Network.HTTP.Client and Network.HTTP.Conduit. The goal is to expand this list over time.

Proxy environment variable

Use the following approach to get proxy settings from the http_proxy and https_proxy environment variables.

{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Client

main :: IO ()
main = do
    let settings = managerSetProxy
            (proxyEnvironment Nothing)
    man <- newManager settings
    let req = ""
            -- Note that the following settings will be completely ignored.
            { proxy = Just $ Proxy "localhost" 1234
    httpLbs req man >>= print


  • Code cleanup/delete dead code
  • Compat with Win32 2.6 #309

  • Support for Windows system proxy settings #274

  • Revert socks5 and socks5h support from #262; the support was untested and did not work as intended.


  • Added socks5 and socks5h support #262


  • http-client should allow to log requests and responses #248


  • Derive ‘Eq’ for ‘ResponseTimeout’ #239

  • Doc improvements

  • Add missing colon in Host header #235

  • Minor doc updates

  • The closeConnection method for tls connections should not be called multiple times #225


  • Expose makeConnection and socketConnection as a stable API #223


  • Enable rawConnectionModifySocketSize to expose openSocketConnectionSize #218


  • Enable managerModifyRequest to modify redirectCount #208

  • Doc fix


  • Remove instance Default Request
  • Modify instance IsString Request to use parseRequest instead of parseUrlThrow
  • Clean up the HttpException constructors
  • Rename checkStatus to checkResponse and modify type
  • Fix the ugly magic constant workaround for responseTimeout
  • Remove getConnectionWrapper
  • Add the HttpExceptionRequest wrapper so that all exceptions related to a request are thrown with that request's information


  • Added length validation for RequestBodyStream #205


  • Initial implementation of #193
    • Deprecate parseUrl
    • Add parseUrlThrow, parseRequest, and parseRequest_


  • Changed the order of connecting a socket and tweaking a socket, such that the socket tweaking callback now happen before connecting.
  • add setRequestIgnoreStatus #201
  • Added missing Host: HTTP header for https CONNECT #192
  • Fix: Redirects will be followed in httpRaw' when reusing a dead connection #195


  • Add support for including request method in URL
  • requestManagerOverride
  • RequestBodyIO

  • Incorrect idle connection count in HTTP manager #185


  • Enable managerModifyRequest to modify checkStatus #179

  • Fix compilation for GHC 7.4

  • Fix compilation for GHC < 7.10


  • Make sure we never read from or write to closed socket #170


  • Don't error out when response body flushing fails #169


  • Use a new TlsExceptionHostPort exception to indicate the host and port of the server we were trying to connect to when a TLS exception occurred. See commercialhaskell/stack#1010


  • Case insensitive cookie domains #158


  • ProxyConnectException now returns Right HttpException. #155


  • Support no_proxy environment variable. #140 #145


  • Expose brReadSome


  • Move HasHttpManager from http-conduit to http-client #147
  • Chunked request bodies use less TCP packets #149



  • Case insensitive proxy environment variables #135


  • Proxy auth for HTTPS #132


  • Support proxy authentication in environment variables #129


  • Ignore empty http_proxy #128


  • Support for auth via url #124


  • Added IsString RequestBody instance #126

  • Fix getUri to insert "?" to uriQuery when necessary. #123

  • Disable custom timeout code #116


  • Ignore the 'Content-Length' header if the body contains chunked data #115


  • Expect: 100-continue #114


  • Add RequestBody smart constructors streamFile and streamFileObserved, the latter with accompanying type StreamFileStatus.

  • Automatically call withSocketsDo everywhere #107


  • Add the ResponseLengthAndChunkingBothUsed exception constructor #108

  • Improved timeout implementation for high contention cases #98

  • Fix for shared connections in proxy servers #103


Separate tests not requiring internet access. #93


Add onRequestBodyException to Request to allow for recovering from exceptions when sending the request. Most useful for servers which terminate the connection after sending a response body without flushing the request body.


Add openSocketConnectionSize and increase default chunk size to 8192.


Add managerModifyRequest field to ManagerSettings.


Add requestVersion field to Request.


The reaper thread for a manager will go to sleep completely when there are no connection to manage. See:


  • Provide the responseOpenHistory/withResponseHistory API. See:


  • Hide the Part constructor, and allow for additional headers. See:
Used by 298 packages:
alerta, amazonka-s3-streaming, amazonka-test, antigate, apiary-authenticate, apiary-http-client, api-builder, atlassian-connect-core, aur, aur-api, authenticate-oauth, aws-lambda, aws-performance-tests, azure-servicebus, bake, ballast, batchd, bet, bitx-bitcoin, bloodhound, bloodhound-amazonka-auth, bluemix-sdk, cabal-rpm, cayley-client, cerberus, chatwork, cielo, circlehs, clarifai, clit, codex, coinbase-exchange, colorless-http-client, configuration-tools, consul-haskell, couch-simple, cryptsy-api, DAV, debug-me, dhall, discogs-haskell, discord-rest, docker, dockercook, DOH, dozens, ekg-bosun, ekg-elastic, ekg-elasticsearch, elm-get, elm-package, eventstore, exherbo-cabal, extralife, fb, fbmessenger-api, feed-collect, flowdock, flowdock-rest, fluid-idl-http-client, free-http, funbot, gdax, giphy-api, git-annex, github, github-release, github-tools, gli, gogol, gogol-core, google-cloud, google-maps-geocoding, google-static-maps, google-translate, grakn, habit, hackage-proxy, hackernews, hackmanager, hail, hailgun, halma-telegram-bot, harvest-api, haskell-neo4j-client, hastily, hipbot, hipchat-hs, hjsonschema, hledger-web, hoggl, hopenpgp-tools, hsebaysdk, hslogstash, hsoz, hsudoku, http-client-auth, http-client-conduit, http-client-extra, http-client-lens, http-client-multipart, http-client-openssl, http-client-request-modifiers, http-client-session, http-client-streams, http-client-tls, http-conduit, http-conduit-browser, http-conduit-downloader, http-dispatch, http-proxy, http-response-decoder, http-reverse-proxy, https-everywhere-rules, http-test, hup, hurriyet, hutton, hw-kafka-avro, hzulip, ihaskell, imm, influxdb, inspector-wrecker, io-streams-http, iron-mq, katip-elasticsearch, kawhi, keter, keysafe, koofr-client, kraken, language-puppet, latest-npm-version, legion-discovery-client, libinfluxdb, libjenkins, liblastfm, librato, lightning-haskell, listenbrainz-client, list-t-http-client, log-elasticsearch, log-postgres, ltiv1p1, luis-client, lxd-client, mackerel-client, madlang, magicbane, mailchimp, mailchimp-subscribe, mailgun, mandrill, marmalade-upload, marvin, medium-sdk-haskell, mellon-web, MicrosoftTranslator, mighttpd2, mime-mail-ses, minio-hs, mollie-api-haskell, monad-http, mondo, monzo, morte, nakadi-client, nationstates, netease-fm, network-api-support, network-bitcoin, nicovideo-translator, oanda-rest-api, oauthenticated, octane, octohat, oidc-client, opensource, openweathermap, orchestrate, pagerduty, pandoc, paranoia, paypal-adaptive-hoops, paypal-rest-client, pdf-slave-server, pia-forward, pinboard, pipes-http, pipes-s3, playlists-http, pocket, pokitdok, psc-ide, pubnub, purescript, pursuit-client, pusher-http-haskell, push-notify, push-notify-general, pushover, quickbooks, quiver-http, rakuten, ratel, ratel-wai, rattletrap, reddit, req, req-conduit, rest-client, riemann, rlwe-challenges, rss2irc, scholdoc, scrape-changes, sensei, sensu-run, servant-checked-exceptions, servant-client, servant-github, servant-haxl-client, servant-multipart, servant-pushbullet-client, servant-quickcheck, servant-rawm, servant-smsc-ru, shelduck, simple-download, skemmtun, slack-notify-haskell, slack-web, smsaero, snaplet-influxdb, soap, soap-openssl, soap-tls, solr, sproxy2, sqsd-local, ssh-tunnel, stack, stackage-build-plan, stackage-cabal, stackage-curator, stackage-install, stackage-metadata, stackage-upload, stack-hpc-coveralls, staversion, streaming-utils, strive, swagger-petstore, swagger-test, syncthing-hs, telegram-api, telegram-bot, textlocal, themoviedb, tpb, trasa-client, tweet-hs, twfy-api-client, twilio, twitter-conduit, vault-tool, vault-tool-server, vimeta, VKHS, wai-app-file-cgi, wai-devel, wai-middleware-auth, wai-middleware-consul, wai-middleware-crowd, wai-middleware-hmac-client, wai-middleware-rollbar, wai-slack-middleware, web3, webapi, webdriver, webdriver-snoy, webfinger-client, web-push, werewolf-slack, wrecker, wreq, wreq-sb, xmltv, yahoo-finance-api, yaml-rpc, yeller, yesod-auth, yesod-auth-oauth2, yesod-bin, yesod-platform, zendesk-api, ziptastic-client
comments powered byDisqus