url-2.1.2: A library for working with URLs.Source codeContentsIndex
Network.URL
PortabilityPortable
StabilityProvisional
MaintainerIavor S. Diatchki
Description
Provides a convenient way for working with HTTP URLs. Based on RFC 1738. See also: RFC 3986
Synopsis
data URL = URL {
url_type :: URLType
url_path :: String
url_params :: [(String, String)]
}
data URLType
= Absolute Host
| HostRelative
| PathRelative
data Host = Host {
protocol :: Protocol
host :: String
port :: Maybe Integer
}
data Protocol
= HTTP Bool
| FTP Bool
| RawProt String
secure :: Host -> Bool
secure_prot :: Protocol -> Bool
exportURL :: URL -> String
importURL :: String -> Maybe URL
exportHost :: Host -> String
add_param :: URL -> (String, String) -> URL
decString :: Bool -> String -> Maybe String
encString :: Bool -> (Char -> Bool) -> String -> String
ok_host :: Char -> Bool
ok_url :: Char -> Bool
ok_param :: Char -> Bool
ok_path :: Char -> Bool
exportParams :: [(String, String)] -> String
importParams :: String -> Maybe [(String, String)]
Documentation
data URL Source
A type for working with URL. The parameters are in application/x-www-form-urlencoded format: http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
Constructors
URL
url_type :: URLType
url_path :: String
url_params :: [(String, String)]
data URLType Source
Different types of URL.
Constructors
Absolute HostHas a host
HostRelativeDoes not have a host
PathRelativeRelative to another URL
data Host Source
Contains information about the connection to the host.
Constructors
Host
protocol :: Protocol
host :: String
port :: Maybe Integer
data Protocol Source
The type of known protocols.
Constructors
HTTP Bool
FTP Bool
RawProt String
secure :: Host -> BoolSource
Does this host use a "secure" protocol (e.g., https).
secure_prot :: Protocol -> BoolSource
Is this a "secure" protocol. This works only for known protocols, for RawProt values we return False.
exportURL :: URL -> StringSource
Convert a URL to a list of "bytes". We represent non-ASCII characters using UTF8.
importURL :: String -> Maybe URLSource
Convert a list of "bytes" to a URL.
exportHost :: Host -> StringSource
Convert the host part of a URL to a list of "bytes".
add_param :: URL -> (String, String) -> URLSource
Add a (key,value) parameter to a URL.
decString :: Bool -> String -> Maybe StringSource
Decode a list of "bytes" to a string. Performs % and UTF8 decoding.
encString :: Bool -> (Char -> Bool) -> String -> StringSource
Convert a string to bytes by escaping the characters that do not satisfy the input predicate. The first argument specifies if we should replace spaces with +.
ok_host :: Char -> BoolSource
ok_url :: Char -> BoolSource
Characters that may appear in the textual representation of a URL
ok_param :: Char -> BoolSource
ok_path :: Char -> BoolSource
Characters that can appear non % encoded in the path part of the URL
exportParams :: [(String, String)] -> StringSource
importParams :: String -> Maybe [(String, String)]Source
Produced by Haddock version 2.6.0