-
Notifications
You must be signed in to change notification settings - Fork 335
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
Remove ParseOptions::syntax_violation_callback? #462
Comments
This feature is as per "validation errors" in the URL spec: https://url.spec.whatwg.org/#validation-error
I imagine this was originally implemented in rust-url for completeness with the URL spec, which does not seem to imply this is an optional feature for parser implementations? Servo might eventually wish to log these as warnings in some (e.g. developer) console output? When and if someone gets around to (re-)writing a conformance checker (URL, HTML, Atom, etc.) in rust, they will most certainly want this. For rust-url as a general purpose URL parsing library, certain application domains may want to be less lenient, effectively turning certain validation errors into application errors or to filter URLs, as a security precaution, quality heuristic, or for other reasons. There is currently some testing, though I agree that its not particularly complete. The lack of current visible usage seems a limited argument for ripping it out. Is there some indication that keeping the feature is going to cost the project, for example with some imminent and extensive refactoring of the parser? |
The specification says that implementations are “encouraged to report them somewhere” so doing nothing is a conforming implementation.
I think that might be non-conforming? “A validation error does not mean that the parser terminates. ” No parser rewrite is planned, but #463 would be an opportunity to remove stuff. My question was rather: what motivated you to work on #433? |
I interpret the quote differently: Its "User agents, especially conformance checkers", or in other words applications of the URL parser implementation, that are "encouraged to report them somewhere." But the spec doesn't make a super clear distinction between Parser (producing violation errors) and User-Agent or other application (ignoring or consuming them), so I think I can also understand your interpretation. Broadly, my motivation for #433 is for programmatic usage along the lines I highlighted for "application domains" above. In one case I have a service that receives URLs and I use rust-url to correctly handle IDNA domains and to resolve relative URLs to a given base. However, I need to log a warning if URLs with internal whitespace or other |
We didn't remove it in 2.0. |
It’s non-trivial API surface, it’s not tested, and I’m not sure it’s worth supporting. #433 was the only evidence that anyone was using it. @dekellum, can you say more about what you used this for? If you think it should not be removed, why?
The text was updated successfully, but these errors were encountered: