See rfc2396 for more info.
- type Scheme = String
- type RegName = String
- type Port = Int
- type Query = String
- type Fragment = String
- type Hash = String
- type UserInfo = String
- type PathSegment = String
- type Parameters = [(String, Maybe String)]
- data Domain = Domain [String]
- data IPv4 = IPv4 Int Int Int Int
- data Path = Path [PathSegment]
- data Host
- data Authority = Authority UserInfo Host (Maybe Port)
- data Uri = Uri Bool Scheme Authority Path Query Fragment
- relative :: Uri :-> Bool
- scheme :: Uri :-> Scheme
- userinfo :: Uri :-> String
- authority :: Uri :-> Authority
- host :: Uri :-> String
- domain :: Uri :-> Maybe Domain
- ipv4 :: Uri :-> Maybe IPv4
- regname :: Uri :-> Maybe RegName
- port :: Uri :-> Maybe Port
- path :: Uri :-> FilePath
- segments :: Uri :-> [PathSegment]
- query :: Uri :-> Query
- fragment :: Uri :-> Fragment
- pathAndQuery :: Uri :-> String
- queryParams :: Uri :-> Parameters
- params :: String :<->: Parameters
- extension :: FilePath :-> Maybe String
- remap :: (Uri, Uri) -> Uri -> Maybe Uri
- encode :: String -> String
- decode :: String -> String
- encoded :: String :<->: String
- mkUri :: Uri
- mkScheme :: Scheme
- mkPath :: Path
- mkAuthority :: Authority
- mkQuery :: Query
- mkFragment :: Fragment
- mkUserinfo :: UserInfo
- mkHost :: Host
- mkPort :: Maybe Port
- toUri :: String -> Uri
- parseUri :: String -> Either ParseError Uri
- parseAbsoluteUri :: String -> Either ParseError Uri
- parseAuthority :: String -> Either ParseError Authority
- parsePath :: String -> Either ParseError Path
- parseHost :: String -> Either ParseError Host
- mimetype :: FilePath -> Maybe String
- normalize :: FilePath -> FilePath
- jail :: FilePath -> FilePath -> Maybe FilePath
- (/+) :: FilePath -> FilePath -> FilePath
URI datatype.
type PathSegment = StringSource
type Parameters = [(String, Maybe String)]Source
Accessing parts of URIs.
scheme :: Uri :-> SchemeSource
Access the scheme part of the URI. A scheme is probably the protocol indicator like http, ftp, etc.
userinfo :: Uri :-> StringSource
Access the userinfo part of the URI. The userinfo contains an optional username and password or some other credentials.
domain :: Uri :-> Maybe DomainSource
Access domain part of the URI, returns Nothing
when the host is a
regname or IP-address.
ipv4 :: Uri :-> Maybe IPv4Source
Access IPv4-address part of the URI, returns Nothing
when the host is a
domain or regname.
regname :: Uri :-> Maybe RegNameSource
Access regname part of the URI, returns Nothing
when the host is a
domain or IP-address.
path :: Uri :-> FilePathSource
Access the path part of the URI. The query will be properly decoded when reading and encoded when writing.
segments :: Uri :-> [PathSegment]Source
Access the path part of the URI as a list of path segments. The segments will still be URI-encoded.
Access the query part of the URI, the part that follows the ?. The query will be properly decoded when reading and encoded when writing.
fragment :: Uri :-> FragmentSource
Access the fragment part of the URI, the part that follows the #. The fragment will be properly decoded when reading and encoded when writing.
More advanced labels and functions.
pathAndQuery :: Uri :-> StringSource
Access the path and query parts of the URI as a single string. The string will will be properly decoded when reading and encoded when writing.
queryParams :: Uri :-> ParametersSource
Fetch the query parameters form a URI.
params :: String :<->: ParametersSource
Generic lens to parse/print a string as query parameters.
remap :: (Uri, Uri) -> Uri -> Maybe UriSource
Map one URI to another using a URI mapping scheme. A URI mapping scheme is simply a pair of URIs of which only the host part, port number and path will be taken into account when mapping.
Encoding/decoding URI encoded strings.
Creating empty URIs.
mkAuthority :: AuthoritySource
Constructors for making empty Authority
.
Constructors for making empty Fragment
.
Constructors for making empty UserInfo
.
Parsing URIs.
Parse string into a URI and ignore all failures by returning an empty URI when parsing fails. Can be quite useful in situations that parse errors are unlikely.
parseAbsoluteUri :: String -> Either ParseError UriSource
Parse string into a URI and only accept absolute URIs.
parseAuthority :: String -> Either ParseError AuthoritySource
Parse string into an authority.
Filename related utilities.
mimetype :: FilePath -> Maybe StringSource
Try to guess the correct mime type for the input file based on the file extension.
normalize :: FilePath -> FilePathSource
Normalize a path by removing or merging all dot or dot-dot segments and double slashes.
Jail a filepath within a jail directory.