Closed
Bug 242525
Opened 20 years ago
Closed 7 years ago
isPlainHostName() fails if host is FQDN ("localhost.")
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: benc, Unassigned)
Details
(Whiteboard: [necko-backlog][good first bug][proxy])
Attachments
(1 file, 5 obsolete files)
936 bytes,
patch
|
bagder
:
review-
emk
:
feedback-
|
Details | Diff | Splinter Review |
263 "function isPlainHostName(host) {\n" + 264 " return (host.search('\\\\.') == -1);\n" + 265 "}\n" + I suspect all the domain name parsing functions of PAC have this problem. If the host is an FQDN, like "localhost." (vs. "localhost"), then the single "." makes the hostname look like it actually has more than two labels. One solution might be to say: if you find a ".", but it is the last character, that is okay. The other might be to append a trailing dot at the top of the function, then re-write all functions to assume they are processing properly terminated FQDN's.
At http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html#isPlainHostName , the function isPlainHostName is described as "True iff there is no domain name in the hostname (no dots)." I can only see this being a problem with 'localhost'. If you had a machine named 'bill', referring to it as 'bill.' would be incorrect. localhost info: http://www.dns.net/dnsrd/rfc/rfc1912.html#4.1%20Boot%20file d
d. In the general case, that might be true, because using a hostname as an FQDN happens sometimes because the meaning of the hostname is inherently ambiguous. However, for the specific case, "localhost." is a valid FQDN.
Updated•8 years ago
|
Whiteboard: [necko-backlog][good first bug]
Comment 3•7 years ago
|
||
Hi, Can I work on this bug? I've just setup the dev environment for Firefox.
Comment 4•7 years ago
|
||
please go ahead
Updated•7 years ago
|
Whiteboard: [necko-backlog][good first bug] → [necko-backlog][good first bug][proxy]
Comment 5•7 years ago
|
||
(In reply to George Veneel Dogga [::TheLayman] from comment #3) > Hi, Can I work on this bug? > I've just setup the dev environment for Firefox. Hi, George. Are you still working on that bug?
Comment 6•7 years ago
|
||
Hi I'd like to work on this bug. I am a beginner and have the firefox dev env built. I am currently looking at the function in netwerk/base/ProxyAutoConfig.cpp
Updated•7 years ago
|
Assignee: benc → nobody
QA Contact: benc
Comment 7•7 years ago
|
||
Updated•7 years ago
|
Attachment #8848121 -
Flags: review?(mcmanus)
Updated•7 years ago
|
Attachment #8848121 -
Flags: review?(mcmanus) → review?(daniel)
Comment 8•7 years ago
|
||
This actually make our function even less similar in functionality to Chrome's and that could be a concern. Chrome doesn't seem to accept a dot in there, and makes sure the 'host' is not a numerical IPv6-address (as it doesn't use any dots) see https://chromium.googlesource.com/chromium/src/net/+/master/proxy/proxy_resolver_v8.cc#347 (C++ code)
Comment 9•7 years ago
|
||
Comment on attachment 8848121 [details] [diff] [review] Add fix for hostnames ending with '.' Review of attachment 8848121 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/base/ProxyAutoConfig.cpp @@ +66,5 @@ > "" > "function isPlainHostName(host) {\n" > + " if (host.search('\\\\.') != -1) {\n" > + " var str = host.substring(0, host.length - 1);\n" > + " if (str.search('\\\\.') == -1) {\n" I think doing search + substring + search again is a bit on the heavy side and an unnecessary amount of processing. Wouldn't a simpler and faster implementation rather just use the found column from the first search to check if it was last in the host name string? Something like this (untested) snippet: var col = host.search('\\\\.'); if (col != -1) { if (col+1 == host.length) { return true; } else { return false; } } else { return true; }
Attachment #8848121 -
Flags: review?(daniel) → review-
Comment 10•7 years ago
|
||
MozReview-Commit-ID: JkHVMJkRWWZ
Comment 11•7 years ago
|
||
Comment on attachment 8850509 [details]
Amend top commit with bug number when not using mq
Please ignore this attachment. Submitted the wrong patch through bzexport.
Attachment #8850509 -
Attachment is obsolete: true
Attachment #8850509 -
Attachment is patch: false
Comment 12•7 years ago
|
||
I totally missed out the fact that the search method returns the index of the first occurence. This attachment contains the updated (and tested) code.
Attachment #8850519 -
Flags: review?(daniel)
Updated•7 years ago
|
Attachment #8850519 -
Flags: review?(daniel) → review-
Comment 13•7 years ago
|
||
I am really sorry and apologize for the confusion caused. As I mentioned earlier, I am a beginner and still catching up to things...
Attachment #8850521 -
Flags: review?(daniel)
Comment 14•7 years ago
|
||
No worries, we've all been beginners. You'll get there. Now you only submitted the final correction as a patch for me to review. Can you squash your two last commits and submit them as a single patch so that I can review the entire change as a single commit?
Comment 15•7 years ago
|
||
Comment on attachment 8850521 [details] [diff] [review] Remove unnecessary substring method Review of attachment 8850521 [details] [diff] [review]: ----------------------------------------------------------------- (r- this, waiting for the full patch to get resubmitted)
Attachment #8850521 -
Flags: review?(daniel) → review-
Comment 16•7 years ago
|
||
Attachment containing patch with squashed commits from previous attachments.
Attachment #8850553 -
Flags: review?(daniel)
Updated•7 years ago
|
Attachment #8850519 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #8850521 -
Attachment is obsolete: true
Comment 17•7 years ago
|
||
Comment on attachment 8850553 [details] [diff] [review] Use simple column search instead of search+substring Review of attachment 8850553 [details] [diff] [review]: ----------------------------------------------------------------- This is still not the complete patch but a follow-up patch that changes your original suggestion. I'd like the full stand-alone patch in a single commit to review+ (I've seen the change now so I know it is correct and I approve of it) and then run through a try-run to verify it doesn't introduce any side-effects.
Attachment #8850553 -
Flags: review?(daniel) → review-
Comment 18•7 years ago
|
||
Attachment with complete patch (tested).
Attachment #8850576 -
Flags: review?(daniel)
Updated•7 years ago
|
Attachment #8848121 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #8850553 -
Attachment is obsolete: true
Comment 19•7 years ago
|
||
This patch blanket permitting trailing dots instead of special casing "localhost." I don't think it is OK (see comment #1). For example, the patched function will mis-identify "to." as a plain host name.
Comment 20•7 years ago
|
||
And honestly, I think it is too late to change the PAC function behavior (this bug was reported 13 years ago). I don't think we should change it unless other browser vendors agree the change.
Comment 21•7 years ago
|
||
I even think this bug is not valid. It is natual that isPlainHostName() returns false if host is FQDN by definition because FQDN is not a plain host name.
Comment 22•7 years ago
|
||
Comment on attachment 8850576 [details] [diff] [review] Add fix for hostnames ending with '.' See above comments.
Attachment #8850576 -
Flags: feedback-
Comment 23•7 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #19) > This patch blanket permitting trailing dots instead of special casing > "localhost." I don't think it is OK (see comment #1). > For example, the patched function will mis-identify "to." as a plain host > name. Oh yes, very good point. I got too focused on the actual code I forgot that detail. If we should do something, we probably should only pass exactly "localhost." through... but yes, unless other browsers do this we should probably rather close this as spec-adherent.
Comment 24•7 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #19) > This patch blanket permitting trailing dots instead of special casing > "localhost." I don't think it is OK (see comment #1). > For example, the patched function will mis-identify "to." as a plain host > name. That's right.. I accidentally totally forgot about the condition. Nonetheless.. judging by the above comments, I guess I should stall my work on this bug until the behavior described in this bug is desired.
Comment 25•7 years ago
|
||
Comment on attachment 8850576 [details] [diff] [review] Add fix for hostnames ending with '.' Given this some time and thoughts, I'm now weighing to favor PAC compatibility and stability. I don't see for example Chrome supporting a trailing dot for localhost, so introducing this support now in Firefox without a stronger motivation seems to just ask for compatibility issues going forward.
Attachment #8850576 -
Flags: review?(daniel) → review-
Comment 26•7 years ago
|
||
A trailing dot for localhost in a PAC is not universally accepted. Let's not do this unless it becomes universally agreed to be a good idea.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•