network-minihttp-0.2: A ByteString based library for writing HTTP(S) servers and clients.

Network.MiniHTTP.URL

Description

This module contains a structure for representing web URLs. We don't try to be a fully general URI parser (so no mailto: etc), but it's a lot better than Network.URI for dealing with HTTP(S)

Synopsis

Documentation

data URL Source

A web URL

Constructors

URL 

Fields

urlScheme :: Scheme
 
urlUser :: Maybe ByteString
 
urlPassword :: Maybe ByteString
 
urlHost :: Host
 
urlPort :: Int

defaults based on the scheme

urlPath :: ByteString

does not include leading /

urlArguments :: Map ByteString ByteString
 
urlFragment :: Maybe ByteString

doesn't include '#'

Instances

data RelativeURL Source

This is a relative URL. It just copies (and renames) the last three members of URL. However, it's good to keep these two different types of URL apart in the type system.

Constructors

RelativeURL 

data Scheme Source

The transport layer to be used

Constructors

HTTP 
HTTPS 

Instances

data Host Source

The host where the resource can be found

Instances

toRelative :: URL -> RelativeURLSource

Extract a relative URL from a URL

parse :: ByteString -> Maybe URLSource

Parse a URL

parseRelative :: ByteString -> Maybe RelativeURLSource

Parse a relative URL

parseArguments :: ByteString -> Maybe (Map ByteString ByteString)Source

Parse just an arguments map. Can be useful for POST requests. Warning: it occurs to be that the arguments in a POST request might include unescaped '#' symbols. In a URL that would be illegal, but the parser may need to be reworked for that.

serialise :: URL -> ByteStringSource

Convert a URL to a ByteString. It's the same as show, except for the type of the return.

serialiseArguments :: Map ByteString ByteString -> ByteStringSource

Serialise just an arguments map. Can be useful for POST requests.