Closed Bug 1772212 Opened 2 years ago Closed 2 years ago

Improve dispatching transactions on tunnel through a HTTP/2 proxy

Categories

(Core :: Networking: HTTP, task, P3)

task

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: dragana, Assigned: kershaw)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Current state:

The browser limits the number of parallel connections to an origin. nsHttpConnectionMgr is responsible for this for all HTTP requests and all HTTP requests through a non HTTP/2 proxy. In the case of the HTTP/2 proxy, the Http2Session is responsible for this which not only duplicates functionalities but also adds unnecessary complexity (e.g. if there is space for more connection because a CONNECT stream was closed a separate triggering mechanism is needed).
Additional complexity is that the CONNECT request is driven in 2 ways at the moment:

  • In the case of HTTP/1.1 proxy: nsHttpConnection is responsible for driving the CONNECT request
  • In the case of HTTP/2 proxy: Http2ConnectTransaction drives the CONNECT request.

Proposal

When a new nsHttpTransaction that should be sent through a proxy needs to be dispatched do the following:

  • Check if there is a HTTP/2 connection to the origin that goes through the HTTP/2 proxy. If there is one and it can accept new streams, dispatch the transaction.
  • Check if the connection limit for the connection to an origin though the proxy is reached(there cannot be more than 6 connections to origin x that go through proxy y). If this is true, add the transaction to the pending queue.
  • If there is a HTTP/2 connection to the proxy:
    • Create Http2StreamConnention (see 1772205)
    • Create a nsHttpConnection object for the connection through the proxy and register it to the nsHttpConnectionMgr. The nsHttpConnection will use Http2StreamConnention as nsISocketTransport and Http2StreamConnectionOutputStream and Http2StreamConnectionInputStream as nsSocketInoput/OutputStream.
    • Dispatch the transaction to the nsHttpConnection.
    • The nsHttpConnection will be responsible for driving CONNECT request.
  • If there is no HTTP/2 connection to the proxy, create a new connection to the proxy in the same way it is don now for HTTP/1.1 and HTTP/2 proxies.
Depends on: 1772205
Assignee: nobody → kershaw
Status: NEW → ASSIGNED
Pushed by kjang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1e2092c319eb
Check connection limit before dispatch a transaction thourgh Http/2 proxy, r=necko-reviewers,dragana
Regressions: 1785239
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
Blocks: 1772202
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: