Portability | Portable |
---|---|
Stability | Provisional |
Maintainer | Iavor S. Diatchki |
Safe Haskell | Safe-Infered |
Provides a convenient way for working with HTTP URLs. Based on RFC 1738. See also: RFC 3986
- data URL = URL {}
- data URLType
- = Absolute Host
- | HostRelative
- | PathRelative
- data Host = Host {}
- data Protocol
- 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
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
Different types of URL.
Absolute Host | Has a host |
HostRelative | Does not have a host |
PathRelative | Relative to another URL |
Contains information about the connection to the host.
The type of known protocols.
secure_prot :: Protocol -> BoolSource
exportURL :: URL -> StringSource
Convert a URL to a list of "bytes". We represent non-ASCII characters using UTF8.
exportHost :: Host -> StringSource
Convert the host part of a URL to a list of "bytes".
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 +.
exportParams :: [(String, String)] -> StringSource