Git Product home page Git Product logo

Comments (5)

bitemyapp avatar bitemyapp commented on June 3, 2024

/me waves from afar

from email-validate-hs.

Porges avatar Porges commented on June 3, 2024

The reason for this is that the email-address RFC (5322, section 3.4.1) specifies a really loose definition for domain names, so things that the email-address RFC says are valid might not really be a valid domain.

To fix this I've added a parser for domain names that is run on the result of the domain-name parse to ensure that it really is valid by the domain name RFC(s). (Note that this is not yet in a shipped version—since the change is not technically backwards-compatible & I haven't quite decided what to do with it yet...)

The reason it's not simply using the domain name parser instead is that the email-address parser performs some canonicalization as a "side-effect" of parsing—it strips out comments and something called 'folding whitespace' (collectively 'CFWS'). These are valid in the input email address but not in the resulting domain name.

Specifically, if one wanted to re-write the whole domainName parser to not use an inner parse, would that be possible in some way while giving correct results?

It would be possible to fold in the domain name parsing with the email-address version to come up with a parser that handles the CFWS, but I haven't done this yet as it was easier to show that the domain-name handling is correct when done in this manner.

To remedy this I should really just write the combined version, add some quickcheck properties to check that it does the same thing as the two-stage parse, then delete the old one 😄

from email-validate-hs.

Porges avatar Porges commented on June 3, 2024

I think I'll have some time tonight to look at this.

from email-validate-hs.

Porges avatar Porges commented on June 3, 2024

Made the change, want to add a few more tests & I'll push it tomorrow.

from email-validate-hs.

Porges avatar Porges commented on June 3, 2024

Finally pushed this...

from email-validate-hs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.