HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

ModuleHTTP-4000.5.0Haskell98

Network.HTTP.Base

Definitions of Request and Response types along with functions for normalizing them. It is assumed to be an internal module; user code should, if possible, import Network.HTTP to access the functionality that this module provides.

Additionally, the module exports internal functions for working with URLs, and for handling the processing of requests and responses coming back.

Contents
  1. Constants
  2. HTTP
  3. URL Encoding
  4. URI authority parsing
Synopsis
  • PackageHTTP-4000.5.0
  • Exports54
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceBase.hs

Constants

HTTP

datadata Request a

An HTTP Request. The Show instance of this type is used for message serialisation, which means no body data is output.

Constructors

Instances2Show, HasHeaders
datadata Response a

An HTTP Response. The Show instance of this type is used for message serialisation, which means no body data is output, additionally the output will show an HTTP version of 1.1 instead of the actual version returned by a server.

Instances2Show, HasHeaders

URL Encoding

URI authority parsing

Parse the authority part of a URL.

RFC 1732, section 3.1:

      //<user>:<password>@<host>:<port>/<url-path>
 Some or all of the parts "<user>:<password>@", ":<password>",
 ":<port>", and "/<url-path>" may be excluded.
valuereadTillEmpty2 :: BufferOp a -> IO (Result a) -> [a] -> IO (Result [a])

Read lines until an empty line (CRLF), also accepts a connection close as end of input, which is not an HTTP/1.1 compliant thing to do - so probably indicates an error condition.

'mkRequest method uri' constructs a well formed request for the given HTTP method and URI. It does not normalize the URI for the request _nor_ add the required Host: header. That is done either explicitly by the user or when requests are normalized prior to transmission.

A default user agent string. The string is "haskell-HTTP/$version" where $version is the version of this HTTP package.

The version of this HTTP package as a string, e.g. "4000.1.2". This may be useful to include in a user agent string so that you can determine from server logs what version of this package HTTP clients are using. This can be useful for tracking down HTTP compatibility quirks.

valuecatchIO :: IO a -> (IOException -> IO a) -> IO a

catchIO a h handles IO action exceptions throughout codebase; version-specific tweaks better go here.