Skip to content

net/: Use both QUIC and TCP for initial URL requests#9262

Open
ckim1346 wants to merge 4 commits intoyoutube:mainfrom
ckim1346:enable-quic
Open

net/: Use both QUIC and TCP for initial URL requests#9262
ckim1346 wants to merge 4 commits intoyoutube:mainfrom
ckim1346:enable-quic

Conversation

@ckim1346
Copy link
Contributor

@ckim1346 ckim1346 commented Feb 26, 2026

This PR reintroduces the use_quic_for_unknown_origins flag to try both QUIC and TCP for initial/unknown URL requests. If QUIC returns first, it will cancel the TCP request and otherwise fall back on the TCP ensuring we try quick but also have a reliable fallback. Additionally, we allow non-production builds to use any port whereas production builds can only use port 443.

Please refer to #2981 and #3514.

Bug: 467778593

@github-actions
Copy link
Contributor

🤖 Gemini Suggested Commit Message


net: Race QUIC/TCP connections for Android TV

Introduce a flag to enable racing QUIC and TCP connections for initial
URL requests to origins without established Alternative Service records.
This mechanism allows the system to concurrently attempt connections
using both protocols and utilize the one that connects faster.

This optimization improves initial connection setup latency, especially
for first-time connections to a server that supports QUIC but has not
yet advertised it via Alt-Svc. This feature is enabled specifically for
Android TV builds.

Bug: 467778593

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@ckim1346 ckim1346 changed the title Use both QUIC and TCP for initial URL requests net/: Use both QUIC and TCP for initial URL requests Feb 26, 2026
#if BUILDFLAG(IS_ANDROIDTV)
if (session_->IsQuicEnabled() && session_->UseQuicForUnknownOrigin()) {
url::SchemeHostPort origin(original_url);
#if defined(COBALT_BUILD_TYPE_GOLD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would port not be 443?

I also think it's dangerous to have qa and gold differ on this behavior. Prod could break if there's some issue with the prod-specific code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3514 I would assume for testing/debugging purposes -- @kaidokert do you remember the exact reasoning?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is for mirroring the enforcing of https for gold builds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should at least enforce it to be a privileged port (<1024).

@ckim1346 ckim1346 marked this pull request as ready for review February 26, 2026 22:34
@ckim1346 ckim1346 requested a review from a team as a code owner February 26, 2026 22:34
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reintroduces the use_quic_for_unknown_origins feature, which opportunistically attempts a QUIC connection for initial requests to improve performance, with a fallback to TCP. The implementation correctly restricts this behavior to port 443 for production builds. However, there is a critical preprocessor logic error in http_stream_factory_job_controller.cc that will cause a compilation failure. I've provided a comment with a suggested fix for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants