From 91337d0f574de661fb15f80e9dd76fa95d3c666c Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Mon, 24 Jul 2023 15:05:59 +0200 Subject: [PATCH] Comments. --- src/DomainParser.purs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DomainParser.purs b/src/DomainParser.purs index f10a8eb..75640e5 100644 --- a/src/DomainParser.purs +++ b/src/DomainParser.purs @@ -19,14 +19,21 @@ import Parsing (Parser, fail, runParser) import Parsing.String.Basic (alphaNum, letter) import Parsing.String (char, string, eof) --- From RFC 1035: ::= | " " +-- | From RFC 1035: ::= | " " +-- | +-- | 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 = PC.try (string " ") <|> sub_eof sub_eof :: Parser String String sub_eof = do sub <- subdomain - -- TODO: non standard (RFC 1035). PC.optional (char '.') eof if S.length sub > 255