Closed Bug 1190948 Opened 10 years ago Closed 10 years ago

backslash slash in URL like https:\/\/www.mozilla.org\/en-US\/

Categories

(Firefox :: File Handling, defect)

defect
Not set
trivial

Tracking

()

RESOLVED DUPLICATE of bug 652186

People

(Reporter: charliea, Unassigned)

Details

Could a URL like https:\/\/www.mozilla.org\/en-US\/ be changed to https://www.mozilla.org/en-US/ when entered into the URL bar in Firefox?
What does the spec say? https://url.spec.whatwg.org/
Flags: needinfo?(charliea)
When inserted in the URL bar, Google Chrome converts https:\/\/www.mozilla.org\/en-US\/ to https:////www.mozilla.org//en-US// which then is converted to https://www.mozilla.org/en-US/
Flags: needinfo?(charliea)
OK, but is that what the URL Standard says should happen? https://url.spec.whatwg.org/
Flags: needinfo?(charliea)
(In reply to Mats Palmgren (:mats) from comment #3) > OK, but is that what the URL Standard says should happen? > https://url.spec.whatwg.org/ Using "\" is a syntax violation. A syntax violation indicates a non-fatal mismatch between input and syntax requirements. User agents, especially conformance checkers are encouraged to report them somewhere. Note: A syntax violation does not mean that the parser terminates. Termination of a parser is always stated explicitly. E.g., through a return statement. https://url.spec.whatwg.org/#syntax-violation This webpage does not refer to what should happen if a URL has a "\".
https:\/\/www.mozilla.org\/en-US\/ I think it's clear that we read "https" as the scheme when we see the ":" https://url.spec.whatwg.org/#scheme-state The next code point is "\" so we take step 9 there and enter "non-relative path state": https://url.spec.whatwg.org/#scheme-state there, 3.1 says "\" is a syntax violation so it's ignored and we continue in this state with the (first) "/" which we percent-encode in 3.3, then continue like that until EOF. So we essentially percent-encode "//www.mozilla.org/en-US/" here which gives us the following result from this algorithm: scheme = https path = %2F%2Fwww.mozilla.org%2Fen-US%2F (Note that we have no host part.) Anne, is that reading correct?
Flags: needinfo?(annevk)
No, "https" is a special scheme. So likely you go down step 7 since there's no base URL for the address bar. https://url.spec.whatwg.org/#special-authority-slashes-state which makes you go to https://url.spec.whatwg.org/#special-authority-ignore-slashes-state. That makes you ignore "/" and "\" until you see something else, etc. So this is a bug. And it's also known.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(charliea)
Flags: needinfo?(annevk)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.