Altered RFC rules to make it work.
parent
43d8ae9c0b
commit
57fdd3f9d9
|
@ -540,18 +540,26 @@ qcontent = CU.singleton <$> qtext <|> quoted_pair
|
|||
|
||||
-- | `quoted_string`
|
||||
-- |
|
||||
-- | WARNING: this rule was changed in order to take into account the new `qtext` rule,
|
||||
-- | which now accepts the space character. This new rule, as implemented, still allows
|
||||
-- | for multiple line returns in the quoted string.
|
||||
-- |
|
||||
-- |
|
||||
-- | Original RFC5322 rule:
|
||||
-- | quoted-string = `[CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]`
|
||||
-- |
|
||||
-- | Implemented rule:
|
||||
-- | quoted-string = `[CFWS] DQUOTE *([CRLF] qcontent) [FWS] DQUOTE [CFWS]`
|
||||
quoted_string :: forall e. Parser e String
|
||||
quoted_string = do s <- tryMaybe cfws
|
||||
_ <- char '"'
|
||||
m <- A.many $ do xs <- tryMaybe fws
|
||||
m <- A.many do l <- tryMaybe crlf
|
||||
c <- qcontent
|
||||
pure $ maybe "" id xs <> c
|
||||
pure $ maybe "" id l <> c
|
||||
_ <- char '"'
|
||||
e <- tryMaybe cfws
|
||||
pure $ maybe "" id s <> "\"" <> A.fold m <> "\"" <> maybe "" id e
|
||||
|
||||
|
||||
-- | TODO: For now, `local_part` only checks that
|
||||
-- | (a) the first character is a letter,
|
||||
-- | (b) the last character is either a letter or a digit.
|
||||
|
|
Loading…
Reference in New Issue