-
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
"/\\example.com" is treated as an unsafe protocol-relative url, not a path, by most browsers #59
Comments
Can you quantify "many" browsers and provide a repro (e.g. with Confirmed that the current spec (as implemented by jsdom/whatwg-url) will treat such input as an invalid URL and fail to parse it entirely. |
Yeah, this is defined by the parser. What is the problem? |
The parser currently rejects this input whereas browsers do not, it seems. |
It does? Step 7 of https://url.spec.whatwg.org/#scheme-state handles this, no? |
Oh, you're right, I forgot to input a base URL when parsing it. The spec seems OK here (and matches Chrome, although not Firefox or IE11). A good case for the test suite. https://jsbin.com/rilorigufo/edit?html,console,output in case anyone wants to test. |
I don't see how you get to step 7 of scheme state for a url with no ":" in Here's my manual walkthrough of the algorithm: base URL: "http://foobar.com" Begin: |
You're right, but at the end you're wrong. "Parse error" is just an indication of something being wrong, it's not something that's returned. |
So parse error "falls through" rather than terminating the algorithm. I guess, "It's the Web, always return SOMETHING." Thanks, I was confused about that for sure. |
I think it’s unfortunate that Hixie chose to use the term parse error for this when he originally set the conventions for it in the parsing algorithm in the HTML spec. In talking about parsing behavior it makes discussion of concepts like “parse errors” and “errors in parsing” ambiguous. And specs shouldn’t coin terms that are inherently ambiguous. It would have been less misleading and confusing if to begin with it has just been named parse warning or parsing conformance violation or something instead. |
I would be okay with renaming this "report a parse error" or "report a violation" or some such. Perhaps best to do that as a new issue? |
Raised #60 |
I'd be fine with "report a parse error and continue." where the "and continue" is the more important bit of clarification for the casual reader. |
Am I missing the place where this is described by the parsing algorithm? Seems it should be between:
https://url.spec.whatwg.org/#no-scheme-state
and
https://url.spec.whatwg.org/#path-or-authority-state
The text was updated successfully, but these errors were encountered: