Closed Bug 1671844 Opened 4 years ago Closed 4 years ago

PAC isPlainHostName() matching ipv6 addresses

Categories

(Core :: Networking, defect, P3)

Firefox 81
defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: luizluca, Assigned: yrahul3910, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [necko-triaged][good first bug][lang=js])

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36

Steps to reproduce:

In my PAC script, I have something like:

...
if (isPlainHostName(host)) {
return "DIRECT"
}
...

Actual results:

isPlainHostName returns true for addresses like: https://[2801:82:0:6::45]/

Expected results:

isPlainHostName should have returned false as it is not a plain host name. I guess it simply looks for '.', while it should now also consider ':'

Component: Untriaged → Networking
Product: Firefox → Core

Thanks for the report.

It seems the behaviour you suggest matches Chrome, so in the name of compatibility we should probably address this.

The fix belongs here.

Mentor: valentin.gosu
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug
Priority: -- → P3
Whiteboard: [necko-triaged][good first bug][lang=js]

I could do this; given the information above, it would appear the regex simply needs a tweak from checking for "." (match a dot) to "(.|:)". Does this seem right?

Also, might I suggest the use of String.raw instead of the code you've pointed to? It's rather difficult to read as it stands, and I suspect this is partly because it was written pre-ES6.

Flags: needinfo?(valentin.gosu)

(In reply to Rahul from comment #2)

Also, might I suggest the use of String.raw instead of the code you've pointed to? It's rather difficult to read as it stands, and I suspect this is partly because it was written pre-ES6.

This part was pre-coffee, sorry :) But I guess my point still stands: we could use the C++11 raw string literal syntax (R"...") instead.

Assignee: nobody → yrahul3910
Status: NEW → ASSIGNED

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: yrahul3910 → nobody
Status: ASSIGNED → NEW

Sorry for missing the notification.
I'll respond again in the review.

Assignee: nobody → yrahul3910
Flags: needinfo?(valentin.gosu)
Attachment #9191834 - Attachment description: Bug 1671844 - [core] PAC isPlainHostName() matching ipv6 addresses r=valentin → Bug 1671844 - PAC isPlainHostName() matching ipv6 addresses r=valentin
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/a0cf96e3910f PAC isPlainHostName() matching ipv6 addresses r=valentin,necko-reviewers
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: