Closed Bug 1894206 Opened 1 month ago Closed 29 days ago

Speculative connect for HTTPS upgraded page loads has the wrong originAttributes

Categories

(Core :: Networking: HTTP, defect, P2)

defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: valentin, Assigned: valentin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged] [necko-priority-next])

Attachments

(1 file)

I was using the profiler to look at a regression with browser.tabs.documentchannel.parent-controlled, but I noticed something interesting with speculative connects.

If I open a tab and type wikipedia.org what happens is that we create a channel and do a speculative connect, that channel later gets upgraded to HTTPS, but the speculative connect is partitioned using the http scheme of the initial load.

We upgrade the URL to preconnect to the HTTPS url, but the originAttributes keep using http. link here

{ "start": 638713.213607, "end": null, "name": "LogMessages", "category": 1, "threadId": null, "data": { "type": "Log", "module": "nsHttp", "name": "nsHttpConnectionMgr::SpeculativeConnect [ci=.S........[tlsflags0x00000000]wikipedia.org:443^partitionKey=%28http%2Cwikipedia.org%29]\n", "cause": { "tid": 234822, "time": 638713.214095, "stack": 55152 } } }

The result is that the speculative connect probably doesn't get used.
This is a minor fix which is likely to improve perf in a common user interaction.

I wonder why the default scheme for the url bar is http?

Whiteboard: [necko-triaged] [necko-priority-new] → [necko-triaged] [necko-priority-next]

(In reply to Andrew Creskey [:acreskey] from comment #1)

I wonder why the default scheme for the url bar is http?

The speculative connect is coming from here
I guess URIFixup.sys.mjs generates a http URL first, and upgrade proceeds knowing http was should be attempted, instead of generating a https URL and falling back to http if that fails. (I'm assuming). We could try to change the default, but I expect that was considered before. See https_first_schemeless.

In any case, just fixing the originAttributes is probably enough.

Assignee: nobody → valentin.gosu

When entering www.wikipedia.org in the URL bar, that gets fixed up to
being a http URL, and then a speculativeConnect is dispatched.
nsHttpHandler::SpeculativeConnectInternal will upgrade the URL to https,
but the originAttributes in the network partition key also need to be
HTTPS, otherwise the speculative connection will not be used by the
connection manager.

Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/41b2d771de01
Speculative connect for HTTPS upgraded page loads has the wrong originAttributes r=acreskey,necko-reviewers,kershaw
Status: NEW → RESOLVED
Closed: 29 days ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
See Also: → 1898448
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: