Skip to content

Conversation

@eerhardt
Copy link
Member

Contributes to #44534

Spinning this off into a separate PR from the discussion on #52572 (comment).

Before: 2,660,648 bytes
After: 2,658,176 bytes

@ghost
Copy link

ghost commented May 12, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #44534

Spinning this off into a separate PR from the discussion on #52572 (comment).

Before: 2,660,648 bytes
After: 2,658,176 bytes

Author: eerhardt
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@eerhardt eerhardt added the size-reduction Issues impacting final app size primary for size sensitive workloads label May 12, 2021
@ghost
Copy link

ghost commented May 12, 2021

Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar, @CoffeeFlux
See info in area-owners.md if you want to be subscribed.

Issue Details

Contributes to #44534

Spinning this off into a separate PR from the discussion on #52572 (comment).

Before: 2,660,648 bytes
After: 2,658,176 bytes

Author: eerhardt
Assignees: -
Labels:

area-System.Net.Http, size-reduction

Milestone: -

public static readonly KnownHeader XXssProtection = new KnownHeader("X-XSS-Protection", HttpHeaderType.Custom, null, new string[] { "0", "1", "1; mode=block" });

private static HttpHeaderParser? GetAltSvcHeaderParser() =>
#if TARGET_BROWSER
Copy link
Contributor

Choose a reason for hiding this comment

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

You could also use SocketsHttpHandler.IsSupported check

Copy link
Member Author

Choose a reason for hiding this comment

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

That approach has 2 disadvantages:

  1. We would need to suppress this:
C:\git\runtime\src\libraries\System.Net.Http\src\System\Net\Http\Headers\KnownHeaders.cs(112,13): 
    error CA1416: This call site is reachable on: 'Browser'. 'SocketsHttpHandler.IsSupported' is unsupported on: 'Browser'. [C:\git\runtime\src\libraries\System.Net.Http\src\System.Net.Http.csproj]
  1. This way, on Browser, AltSvcHeaderParser isn't even compiled into the library. So if someone tries to take a reference to it in some other code, they will consciously need to add it back to be compiled during the Browser build.

Copy link
Contributor

Choose a reason for hiding this comment

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

We would need to suppress this:

You could use guarded supported attribute

AltSvcHeaderParser isn't even compiled into the library.

It's the same it would be removed by linker during build and if someone adds it back it should trigger size regression warning

Just showing an alternative way to implement this

@eerhardt eerhardt merged commit b7f54e9 into dotnet:main May 13, 2021
@eerhardt eerhardt deleted the RemoveAltSvcParserBrowser branch May 13, 2021 15:24
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net.Http size-reduction Issues impacting final app size primary for size sensitive workloads

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants