http-client

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

https://github.com/snoyberg/http-client

Version on this page:0.4.20@rev:2
LTS Haskell 22.17:0.7.17
Stackage Nightly 2024-04-18:0.7.17
Latest on Hackage:0.7.17

See all snapshots http-client appears in

MIT licensed by Michael Snoyman
Maintained by [email protected]
This version can be pinned in stack with:http-client-0.4.20@sha256:b3a500be1a20d527aa0192d3cc7a24a138fde3b36daaa97553332f10d52481a7,4880

Module documentation for 0.4.20

http-client

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

This codebase has been refactored from http-conduit.

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)
            defaultManagerSettings
    man <- newManager settings
    let req = "http://httpbin.org"
            -- Note that the following settings will be completely ignored.
            { proxy = Just $ Proxy "localhost" 1234
            }
    httpLbs req man >>= print

Changes

0.4.20

  • Expose brReadSome

0.4.19

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

0.4.18

0.4.17

  • Case insensitive proxy environment variables #135

0.4.16

  • Proxy auth for HTTPS #132

0.4.15

  • Support proxy authentication in environment variables #129

0.4.14

  • Ignore empty http_proxy #128

0.4.13

  • Support for auth via url #124

0.4.12

  • Added IsString RequestBody instance #126

0.4.11.3

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

0.4.11.2

0.4.11.1

  • Disable custom timeout code #116

0.4.11

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

0.4.10

  • Expect: 100-continue #114

0.4.9

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

0.4.8.1

  • Automatically call withSocketsDo everywhere #107

0.4.8

  • Add the ResponseLengthAndChunkingBothUsed exception constructor #108

0.4.7.2

  • Improved timeout implementation for high contention cases #98

0.4.7.1

  • Fix for shared connections in proxy servers #103

0.4.7

0.4.6.1

Separate tests not requiring internet access. #93

0.4.6

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.

0.4.5

Add openSocketConnectionSize and increase default chunk size to 8192.

0.4.4

Add managerModifyRequest field to ManagerSettings.

0.4.3

Add requestVersion field to Request.

0.4.2

The reaper thread for a manager will go to sleep completely when there are no connection to manage. See: https://github.com/snoyberg/http-client/issues/70

0.4.1

0.4.0