Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Validity.URI
Description
Synopsis
- dangerousURIToString :: URI -> String
- dangerousDetailedURIToString :: URI -> String
- dangerousURIToString :: URI -> String
- dangerousDetailedURIToString :: URI -> String
- validateUserInfo :: String -> Validation
- validateHost :: String -> Validation
- validatePort :: String -> Validation
- validateScheme :: String -> Validation
- validatePath :: String -> Validation
- validateQuery :: String -> Validation
- validateFragment :: String -> Validation
- charIsALPHA :: Char -> Bool
- validateSchemeChar :: Char -> Validation
- charIsDIGIT :: Char -> Bool
- validateUserInfoChar :: Char -> Validation
- charIsUnreserved :: Char -> Bool
- charIsPossiblyPartOfPercentEncoding :: Char -> Bool
- charIsSubDelim :: Char -> Bool
- stringIsIPLiteral :: String -> Bool
- stringIsRegName :: String -> Bool
- isRegNameChar :: Char -> Bool
- validatePortChar :: Char -> Validation
- charIsReserved :: Char -> Bool
- charIsGenDelim :: Char -> Bool
- charIsHEXDIG :: Char -> Bool
Helper functions
dangerousURIToString :: URI -> String Source #
Render a URI to a String
, for use in testing
This uses uriToString id
as the docs specify.
It potentially exposes passwords, so only use it if you know what you're
doing.
Export everything for testing, **You probably do not want to use any of the functions below**.
dangerousURIToString :: URI -> String Source #
Render a URI to a String
, for use in testing
This uses uriToString id
as the docs specify.
It potentially exposes passwords, so only use it if you know what you're
doing.
validateUserInfo :: String -> Validation Source #
Validate the uriUserInfo
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
userinfo = *( unreserved pct-encoded sub-delims / ":" )
validateHost :: String -> Validation Source #
Validate the uriRegName
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
RFC 3986, section 3.2.2
host = IP-literal IPv4address reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]" IPvFuture = "v" 1*HEXDIG "." 1*( unreserved sub-delims ":" )
reg-name = *( unreserved pct-encoded sub-delims )
validatePort :: String -> Validation Source #
Validate the uriPort
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
RFC 3986, section 3.2.3
port = *DIGIT
NOTE: The spec does not specify a maximum length of ports so we do not validate this either.
validateScheme :: String -> Validation Source #
Validate the uriScheme
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
RFC 3986, section 3.1
scheme = ALPHA *( ALPHA DIGIT "+" "-" "." )
validatePath :: String -> Validation Source #
Validate the uriPath
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
validateQuery :: String -> Validation Source #
Validate the uriQuery
part of an URI
NOTE: Watch out with using this validation separately, it may not reject enough.
validateFragment :: String -> Validation Source #
charIsALPHA :: Char -> Bool Source #
validateSchemeChar :: Char -> Validation Source #
charIsDIGIT :: Char -> Bool Source #
charIsUnreserved :: Char -> Bool Source #
charIsSubDelim :: Char -> Bool Source #
stringIsIPLiteral :: String -> Bool Source #
stringIsRegName :: String -> Bool Source #
isRegNameChar :: Char -> Bool Source #
validatePortChar :: Char -> Validation Source #
charIsReserved :: Char -> Bool Source #
charIsGenDelim :: Char -> Bool Source #
charIsHEXDIG :: Char -> Bool Source #