-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | DEPRECATED A simple, liberal URL parser. -- -- DEPRECATED A simple, liberal URL parser. @package URLb @version 0.0.1 -- | URL parser, following RFC 3986 -- (http://tools.ietf.org/html/rfc3986). module Network.URLb -- | URL "...refers to the subset of URIs that, in addition to identifying -- a resource, provide a means of locating the resource by describing its -- primary access mechanism". -- -- A breakdown of URLs, per the diagram from RFC 3986: -- --
-- foo://example.com:8042/over/there?name=ferret#nose -- \_/ \______________/\_________/ \_________/ \__/ -- | | | | | -- scheme authority path query fragment -- | _____________________|__ -- / \ / \ -- urn:example:animal:ferret:nose ---- -- For the most part, URL parts are made of strings with percent encoding -- required of certain characters. The scheme is especially limited in -- the allowable data: -- --
-- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) ---- -- Note well that no percent encoding is allowed. -- -- The authority section, nominally denoting userinfo@host:port, -- is in fact quite flexible, allowing percent encoding for the hostname -- and userinfo section; only the port has a byte range restriction, to -- digits. -- -- Since this datatype represents the data in a URL and not its -- particular encoded form, we use ByteString liberally. data URL URL :: Scheme -> Maybe Authority -> ByteString -> ByteString -> ByteString -> URL scheme :: URL -> Scheme authority :: URL -> Maybe Authority path :: URL -> ByteString query :: URL -> ByteString fragment :: URL -> ByteString data Authority Authority :: ByteString -> ByteString -> Maybe Word16 -> Authority userinfo :: Authority -> ByteString host :: Authority -> ByteString port :: Authority -> Maybe Word16 newtype Scheme Scheme :: ByteString -> Scheme -- | Class for encoding items from this module as URLs. class Encode t encode :: Encode t => t -> ByteString -- | Class for parsing URL-related datatypes. class Parse t parser :: Parse t => Parser t -- |
-- *( unreserved / pct-encoded / sub-delims / ":" ) --userinfoOctet :: Word8 -> Bool userinfoP :: Parser ByteString -- |
-- *( unreserved / pct-encoded / sub-delims ) --regNameOctet :: Word8 -> Bool regNameP :: Parser ByteString percent :: Parser Word8 -- | Paths are quite sophisticated, with 5 productions to handle the -- different URI contexts in which they appear. However, for the purpose -- of URL parsing, we can assume that paths are always separated from the -- authority (even the empty authority) with a / and thus can -- work with a relatively simple subset of the productions in the RFC. -- --
-- path-rootless = segment-nz *( "/" segment ) -- -- ... -- -- segment-nz = 1*pchar -- -- ... -- -- pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ---- -- Although literal slash runs are not permitted by the RFC, equivalent -- content can be encoded with percent encoding. pathRootlessP :: Parser ByteString -- | To parse the authority and path: -- --