Comments.
This commit is contained in:
parent
f1f30c8bcd
commit
91337d0f57
@ -19,14 +19,21 @@ import Parsing (Parser, fail, runParser)
|
|||||||
import Parsing.String.Basic (alphaNum, letter)
|
import Parsing.String.Basic (alphaNum, letter)
|
||||||
import Parsing.String (char, string, eof)
|
import Parsing.String (char, string, eof)
|
||||||
|
|
||||||
-- From RFC 1035: <domain> ::= <subdomain> | " "
|
-- | From RFC 1035: <domain> ::= <subdomain> | " "
|
||||||
|
-- |
|
||||||
|
-- | Accepting an optional '.' at the end of the subdomain doesn't conform
|
||||||
|
-- | to the (prefered) syntax of a domain as described in RFC 1035.
|
||||||
|
-- | However, this last '.' character should be acceptable in most applications,
|
||||||
|
-- | specially when an "absolute" name (example.com.) has to be differenciated from a "relative" name (www).
|
||||||
|
-- |
|
||||||
|
-- | PS: both "absolute" and "relative" are from filesystem's terminology,
|
||||||
|
-- | but I assume the reader to be more familiar with file-systems than DNS terminology.
|
||||||
domain :: Parser String String
|
domain :: Parser String String
|
||||||
domain = PC.try (string " ") <|> sub_eof
|
domain = PC.try (string " ") <|> sub_eof
|
||||||
|
|
||||||
sub_eof :: Parser String String
|
sub_eof :: Parser String String
|
||||||
sub_eof = do
|
sub_eof = do
|
||||||
sub <- subdomain
|
sub <- subdomain
|
||||||
-- TODO: non standard (RFC 1035).
|
|
||||||
PC.optional (char '.')
|
PC.optional (char '.')
|
||||||
eof
|
eof
|
||||||
if S.length sub > 255
|
if S.length sub > 255
|
||||||
|
Loading…
Reference in New Issue
Block a user