Copyright | (c) Galois Inc. 2007 2008 |
---|---|
License | BSD3 |
Maintainer | Iavor S. Diatchki |
Stability | Provisional |
Portability | Portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Network.URL
Description
Provides a convenient way for working with HTTP URLs. Based on RFC 1738. See also: RFC 3986
Synopsis
- data URL = URL {}
- data URLType
- 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.
Constructors
Absolute Host | Has a host |
HostRelative | Does not have a host |
PathRelative | Relative to another URL |
Instances
Show URLType Source # | |
Eq URLType Source # | |
Ord URLType Source # | |
Contains information about the connection to the host.
The type of known protocols.
Instances
Show Protocol Source # | |
Eq Protocol Source # | |
Ord Protocol Source # | |
Defined in Network.URL |
secure_prot :: Protocol -> Bool Source #
exportURL :: URL -> String Source #
Convert a URL to a list of "bytes". We represent non-ASCII characters using UTF8.
exportHost :: Host -> String Source #
Convert the host part of a URL to a list of "bytes".
decString :: Bool -> String -> Maybe String Source #
Decode a list of "bytes" to a string. Performs % and UTF8 decoding.
encString :: Bool -> (Char -> Bool) -> String -> String Source #
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 +.