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
- Packagehttp-common-0.8.3.4
- Exports33
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceInternal.hs
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
RequestqMethod :: !MethodqHost :: !Maybe ByteStringqPath :: !ByteStringqBody :: !EntityBodyqExpect :: !ExpectModeqHeaders :: !HeadersqBoundary :: !Boundary
Instances4Eq, Show, HttpType, MonadState
Eq RequestDefined in http-common-0.8.3.4 · Network.Http.InternalShow RequestDefined in http-common-0.8.3.4 · Network.Http.InternalHttpType RequestDefined in http-common-0.8.3.4 · Network.Http.InternalMonadState Request RequestBuilderDefined in http-common-0.8.3.4 · Network.Http.RequestBuilder
Instances3Eq, Ord, Show
Eq EntityBodyDefined in http-common-0.8.3.4 · Network.Http.InternalOrd EntityBodyDefined in http-common-0.8.3.4 · Network.Http.InternalShow EntityBodyDefined in http-common-0.8.3.4 · Network.Http.Internal
Instances3Eq, Ord, Show
Eq ExpectModeDefined in http-common-0.8.3.4 · Network.Http.InternalOrd ExpectModeDefined in http-common-0.8.3.4 · Network.Http.InternalShow ExpectModeDefined 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.
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.
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
ResponsepStatusCode :: !StatusCodepStatusMsg :: !ByteStringpTransferEncoding :: !TransferEncodingpContentEncoding :: !ContentEncodingpContentLength :: !Maybe Int64pHeaders :: !Headers
Instances1Show
Show ContentEncodingDefined in http-common-0.8.3.4 · Network.Http.Internal
Get the HTTP response status code.
Get the HTTP response status message. Keep in mind that this is not normative; whereas getStatusCode values are authoritative.
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 -> 0which 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.
HTTP Methods, as per RFC 2616
Set a header field to the specified value. This will overwrite any existing value for the field. Remember that HTTP fields names are case insensitive!
Remove a header from the map. If a field with that name is not present, then this will have no effect.
Given a list of field-name,field-value pairs, construct a Headers map.
Get the headers as a field-name,field-value association list.
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
getHeaders :: τ -> HeadersGet the Headers from a Request or Response.y
Constructors
Instances2Show, Exception
Show HttpParseExceptionDefined in http-common-0.8.3.4 · Network.Http.InternalException HttpParseExceptionDefined in http-common-0.8.3.4 · Network.Http.Internal