HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehttp-common-0.8.3.4Haskell2010

Network.Http.Internal

If you're not http-streams or pipes-http and you're importing this, you're Doing It Wrong.

  • 15 types
  • 1 class
  • 17 values
datadata Request
#

A description of the request that will be sent to the server. Note unlike other HTTP libraries, the request body is not a part of this object; that will be streamed out by you when actually sending the request with sendRequest.

Request has a useful Show instance that will output the request line and headers (as it will be sent over the wire but with the \r characters stripped) which can be handy for debugging.

Note that the actual Host: header is not set until the request is sent, so you will not see it in the Show instance (unless you call setHostname to override the value inherited from the Connection).

Constructors

Instances4Eq, Show, HttpType, MonadState
newtypenewtype Boundary
#
Instances2Eq, Show
  • Eq BoundaryDefined in http-common-0.8.3.4 · Network.Http.Internal
  • Show BoundaryDefined in http-common-0.8.3.4 · Network.Http.Internal

Generate a random string to be used as an inter-part boundary in RFC 7578 multipart form data. You pass this value to Network.Http.Client.setContentMultipart and subsequently to Network.Http.Client.multipartFormBody.

valuepackBoundary :: String -> Boundary
#

If you want to fix the multipart boundary to a known value (for testing purposes) you can use this. The ideal such string, in case you are wondering, is "bEacHV0113YB@ll".

This isn't safe for use in production; you need to use an unpredictable value as the boundary separtor so prefer randomBoundary.

datadata Response
#

A description of the response received from the server. Note unlike other HTTP libraries, the response body is not a part of this object; that will be streamed in by you when calling receiveResponse.

Like Request, Response has a Show instance that will output the status line and response headers as they were received from the server.

Constructors

Instances2Show, HttpType
  • Show ResponseDefined in http-common-0.8.3.4 · Network.Http.Internal
  • HttpType ResponseDefined in http-common-0.8.3.4 · Network.Http.Internal

Lookup a header in the response. HTTP header field names are case-insensitive, so you can specify the name to lookup however you like. If the header is not present Nothing will be returned.

    let n = case getHeader p "Content-Length" of
               Just x' -> read x' :: Int
               Nothing -> 0

which of course is essentially what goes on inside the client library when it receives a response from the server and has to figure out how many bytes to read.

There is a fair bit of complexity in some of the other HTTP response fields, so there are a number of specialized functions for reading those values where we've found them useful.

newtypenewtype Headers
#

The map of headers in a Request or Response. Note that HTTP header field names are case insensitive, so if you call setHeader on a field that's already defined but with a different capitalization you will replace the existing value.

Instances2Eq, Show
  • Eq HeadersDefined in http-common-0.8.3.4 · Network.Http.Internal
  • Show HeadersDefined in http-common-0.8.3.4 · Network.Http.Internal
classclass HttpType τ where
#

Accessors common to both the outbound and return sides of an HTTP connection.

Most people do not need this; for most cases you just need to get a header or two from the response, for which you can use getHeader. On the other hand, if you do need to poke around in the raw headers,

import Network.Http.Types

will give you functions like lookupHeader and updateHeader to to work with.

Methods

Instances2HttpType