Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[H/3] Clean up and fix Alt-Svc handling #114528

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ManickaP
Copy link
Member

Fixes #83775

  • This change is not strictly necessary, it's making us being more lenient by accepting Alt-Svc with empty ALPN (RFC is more strict) and ignoring it.

Fixes #83874

  • Fixed ToString for "Alt-Svc: clear".
  • Fixed handling of "clear" - clears out Alt-Svc including anything from the current response.
  • Fixed HttpAuthority comparison by overloading == operator (class is internal, not public).
  • The last point about NRE is irrelevant since the H/3 connection pooling was refactored to support multiple connections.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs:277

  • After re-adding the 'Alt-Svc' header with the value 'clear', consider adding an assertion to verify that the header was processed as expected, ensuring the roundtrip behavior is fully validated.
headers.Add("Alt-Svc", value);

ExpireAltSvcAuthority();
Debug.Assert(_authorityExpireTimer != null || _disposed);
_authorityExpireTimer?.Change(Timeout.Infinite, Timeout.Infinite);
break;
return;
Copy link
Preview

Copilot AI Apr 11, 2025

Choose a reason for hiding this comment

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

Consider adding a clarifying comment above the 'return' statement to document that returning immediately upon handling a 'clear' Alt-Svc header is an intentional control flow decision to prevent further header processing.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Copy link
Member

@MihaZupan MihaZupan left a comment

Choose a reason for hiding this comment

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

Thanks

@@ -13,7 +13,9 @@ namespace System.Net.Http.Headers
/// </remarks>
internal sealed class AltSvcHeaderValue
{
public static AltSvcHeaderValue Clear { get; } = new AltSvcHeaderValue("clear", host: null, port: 0, maxAge: TimeSpan.Zero, persist: false);
public static string ClearString { get; } = "clear";
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
public static string ClearString { get; } = "clear";
public const string ClearString = "clear";

No need respin CI just for this though.

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

Successfully merging this pull request may close these issues.

[HTTP/3] Alt-Svc logic has many issues Alt-Svc header parser doesn't accept empty ALPN
2 participants