Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Commit 17ec376

Browse files
committed
PR feedback
1 parent c793360 commit 17ec376

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]

benchmarks/Microsoft.AspNetCore.ResponseCompression.Benchmarks/ResponseCompressionProviderBenchmark.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System.Collections.Generic;
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Collections.Generic;
25
using BenchmarkDotNet.Attributes;
36
using Microsoft.AspNetCore.Builder;
47
using Microsoft.AspNetCore.Http;

src/Microsoft.AspNetCore.ResponseCompression/BrotliCompressionProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public Stream CreateStream(Stream outputStream)
4141
#if NETCOREAPP2_1
4242
return new BrotliStream(outputStream, Options.Level, leaveOpen: true);
4343
#elif NET461 || NETSTANDARD2_0
44+
// Brotli is only supported in .NET Core 2.1+
4445
throw new PlatformNotSupportedException();
4546
#else
4647
#error Target frameworks need to be updated.

src/Microsoft.AspNetCore.ResponseCompression/ResponseCompressionOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class ResponseCompressionOptions
2222
public bool EnableForHttps { get; set; } = false;
2323

2424
/// <summary>
25-
/// The ICompressionProviders to use for responses.
25+
/// The <see cref="ICompressionProvider"/> types to use for responses.
26+
/// Providers are prioritized based on the order they are added.
2627
/// </summary>
2728
public CompressionProviderCollection Providers { get; } = new CompressionProviderCollection();
2829
}

src/Microsoft.AspNetCore.ResponseCompression/ResponseCompressionProvider.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public virtual ICompressionProvider GetCompressionProvider(HttpContext context)
125125

126126
if (StringSegment.Equals("identity", encodingName, StringComparison.OrdinalIgnoreCase))
127127
{
128-
candidates.Add(new ProviderCandidate(encodingName.Value, quality, int.MaxValue, null));
128+
// We add 'identity' to the list of "candidates" with a very low priority and no provider.
129+
// This will allow it to be ordered based on its quality (and priority) later in the method.
130+
candidates.Add(new ProviderCandidate(encodingName.Value, quality, priority: int.MaxValue, provider: null));
129131
}
130132
}
131133

0 commit comments

Comments
 (0)