Closed Bug 1873940 Opened 1 year ago Closed 1 year ago

mozurl_host_port returns the wrong thing for non-spec:/.//

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: valentin, Assigned: dotoole)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/52f45d12530f9f8da61c6c7237003b5d1499b6d1/netwerk/base/mozurl/src/lib.rs#217-219

pub extern "C" fn mozurl_host_port(url: &MozURL) -> SpecSlice {
    (&url[Position::BeforeHost..Position::BeforePath]).into()
}

host returns the right thing, but host_port returns a slice. This works for most URLs, but the non-idempotency quirk makes it return /. as a host:port.
This should be fixed, probably by checking if the url has a host before returning.

Assignee: nobody → dotoole
Attachment #9392581 - Attachment description: WIP: Bug 1873940 - added port check to mozurl_host_port. r=valentin → Bug 1873940 - added port check to mozurl_host_port. r=valentin
Pushed by dotoole@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e642cf84fa6f added port check to mozurl_host_port. r=necko-reviewers,valentin
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: