Open Bug 1971997 Opened 1 year ago Updated 1 month ago

HTTP/2 and HTTP/3 should not reparse the headers.

Categories

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

enhancement

Tracking

()

ASSIGNED

People

(Reporter: valentin, Assigned: valentin)

References

(Blocks 3 open bugs, Regressed 1 open bug)

Details

(Keywords: leave-open, Whiteboard: [necko-triaged][necko-priority-next])

Attachments

(4 files, 2 obsolete files)

As can be noticed in bug 1965246, we have an odd way of passing headers from the transaction to the H2 and H3 stream.

When opening the channel and creating the transaction, we'll serialize the requestHead in mozilla::net::nsHttpTransaction::Init on the main thread.
Then we create an input stream that contains the headers and possibly body.
When the transaction gets dispatched we call:
mozilla::net::nsHttpTransaction::ReadSegments
-> mozilla::net::nsAHttpSegmentReader::OnReadSegment which reads from the stream.
The headers then get read into a different string for H2 in mozilla::net::Http2StreamBase::OnReadSegment then passed to EncodeHeaderBlock in mozilla::net::Http2Stream::GenerateHeaders which parses the string and compresses the headers with HPACK mozilla::net::Http2Compressor::EncodeHeaderBlock.

Similarly for H3 mFlatHttpRequestHeaders gets passed into neqo that again parses it into a header array in neqo_http3conn_fetch

Just passing in a nsHttpRequestHead* to HPACK and neqo_http3conn_fetch would be much better - it would avoid the allocations and reparsing.

Blocks: 1944331
Blocks: 1594633
Assignee: nobody → valentin.gosu
Attachment #9547034 - Attachment description: WIP: Bug 1971997 - HTTP/2 and HTTP/3 should not reparse the headers. r=#necko → Bug 1971997 - HTTP/2 and HTTP/3 should not reparse the headers. r=#necko
Status: NEW → ASSIGNED
Blocks: 2034093
See Also: 1944331
Pushed by valentin.gosu@gmail.com: https://github.com/mozilla-firefox/firefox/commit/ae6a9de29bdf https://hg.mozilla.org/integration/autoland/rev/9c45995e2912 HTTP/2 and HTTP/3 should not reparse the headers. r=necko-reviewers,geckoview-reviewers,extension-reviewers,devtools-reviewers,jesup,robwu,nalexander,bomsy https://github.com/mozilla-firefox/firefox/commit/fc0985269088 https://hg.mozilla.org/integration/autoland/rev/cbd35d9c831d Make Request head const r=necko-reviewers,jesup
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e8aa1cc58d36 https://hg.mozilla.org/integration/autoland/rev/5efb7b69f730 Revert "Bug 1971997 - Make Request head const r=necko-reviewers,jesupi" for causing causing mocitest http3 failures @ test_XHRSendData.html
Flags: needinfo?(valentin.gosu)
Attachment #9547034 - Attachment description: Bug 1971997 - HTTP/2 and HTTP/3 should not reparse the headers. r=#necko → Bug 1971997 - Remove uploadStreamHasHeaders from nsIUploadChannel2 r=#necko
Attachment #9602576 - Attachment is obsolete: true
Attachment #9602577 - Attachment is obsolete: true
Keywords: leave-open
Pushed by valentin.gosu@gmail.com: https://github.com/mozilla-firefox/firefox/commit/664d1913d5e2 https://hg.mozilla.org/integration/autoland/rev/5ce10b2d67d1 Remove uploadStreamHasHeaders from nsIUploadChannel2 r=necko-reviewers,geckoview-reviewers,extension-reviewers,devtools-reviewers,jesup,robwu,nalexander,bomsy,media-playback-reviewers,alwu https://github.com/mozilla-firefox/firefox/commit/61bde9c80a4d https://hg.mozilla.org/integration/autoland/rev/2bf8ee9788d8 Make Request head const r=necko-reviewers,jesup https://github.com/mozilla-firefox/firefox/commit/e0dffbb8ef61 https://hg.mozilla.org/integration/autoland/rev/6647b15c7470 apply code formatting via Lando
Regressions: 2051911
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: