-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defered validation error reporting in IPv4 parser #706
Comments
Thank you, great report. The IPv4 and IPv6 parsers should not be invoked directly. You always want to use the host parser. Perhaps we want to stress this some more somehow. And yeah, I think doing away with the variable and reporting the validation error potentially a few more times is the way to go. This last bit seems like a "good first issue" for someone with some experience editing algorithms written in English. |
Looking at this again, I don't think we can report validation errors directly in the ipv4-number-parser as it is also used in Step 4 of ends-in-a-number-checker. Doing so would cause the same validation error to be emitted twice in an edge case such as
Agreed. I was pretty sure that was the case, but I wasn't sure if the IPv4 parser was exported for other specs. Feel free to mark as "good first issue". If nobody wants to pick it up, I'd be happy to submit a patch. |
ab0e820 didn't consider the impact on the validation error infrastructure. This also makes some minor additional changes: * Modernizes the "Host parsing" section. * Clarifies that the IPv4 parser cannot be invoked directly. * Clarifies that the IPv6 parser can, but you should still not do it. Fixes #706.
ab0e820 didn't consider the impact on the validation error infrastructure. This also makes some minor additional changes: * Modernizes the "Host parsing" section. * Clarifies that the IPv4 parser cannot be invoked directly. * Clarifies that the IPv6 parser can, but you should still not do it. Fixes #706.
After #619, the IPv4 parser now only returns an IPv4 address or failure. Previously, it returned it's input instead of failure in many cases. The only call to the IPv4 parser is now guarded by the ends-in-a-number-checker, which makes the following note outdated:
The IPv4 parser essentially pauses validation error reporting in Step 1 and resumes reporting in Step 7. Step 3.1 sets
validationError
totrue
, but fails to report it if the parser returns failure before Step 7.Step 3.1 should probably be changed to "validation error". This would leave the loop in Step 6 as the only place where
validationError
is set totrue
.Is the IPv4 parser designed to be used without first running ends-in-a-number-checker? Does the use of
validationError
still make sense?Removing the last use of
validationError
and directly reporting a validation error in ipv4-number-parser Step 4.1 and 5.1 would report a validation error for each part instead of a single validation error for the entire address. I don't know if that is desirable or not.The text was updated successfully, but these errors were encountered: