Skip to content

Commit 8d334ab

Browse files
Fix weights in accept-encoding header causing compression to be disabled (#831)
1 parent 110e974 commit 8d334ab

16 files changed

Lines changed: 80 additions & 44 deletions

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"dotnet-sonarscanner": {
6-
"version": "11.0.0",
6+
"version": "11.2.1",
77
"commands": [
88
"dotnet-sonarscanner"
99
]

.github/workflows/build.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727

2828
- name: Checkout
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6
3030
with:
3131
fetch-depth: 0
3232

@@ -36,7 +36,7 @@ jobs:
3636
sudo apt-get install -y libmsquic
3737
3838
- name: Download .NET SDK
39-
uses: actions/setup-dotnet@v4
39+
uses: actions/setup-dotnet@v5
4040
with:
4141
dotnet-version: 10.0
4242

@@ -110,24 +110,33 @@ jobs:
110110

111111
- os:
112112
name: 🍎
113-
runs-on: macos-15-intel
113+
runs-on: macos-26-intel
114114
arch: x64
115115
runtime: osx-x64
116116
platform: macos/amd64
117117

118118
- os:
119119
name: 🍎
120-
runs-on: macos-15
120+
runs-on: macos-26
121121
arch: arm64
122122
runtime: osx-arm64
123123
platform: macos/arm64
124124

125125
steps:
126126
- name: Checkout source
127-
uses: actions/checkout@v4
127+
uses: actions/checkout@v6
128+
129+
- name: Harden macOS x64 environment
130+
131+
if: matrix.os.runs-on == 'macos-26-intel'
132+
run: |
133+
sudo rm -rf /opt/homebrew || true
134+
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
135+
export DYLD_LIBRARY_PATH=""
136+
export DYLD_FALLBACK_LIBRARY_PATH=""
128137
129138
- name: Setup .NET SDK
130-
uses: actions/setup-dotnet@v4
139+
uses: actions/setup-dotnet@v5
131140
if: matrix.os.runs-on != 'linux-arm32'
132141
with:
133142
dotnet-version: |

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ jobs:
2020

2121
steps:
2222
- name: Checkout source
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v6
2424
with:
2525
fetch-depth: 0
2626

2727
- name: Setup .NET SDK
28-
uses: actions/setup-dotnet@v4
28+
uses: actions/setup-dotnet@v5
2929
with:
3030
dotnet-version: 10.0
3131

3232
- name: Setup NuGet CLI
33-
uses: NuGet/setup-nuget@v2
33+
uses: NuGet/setup-nuget@v4
3434

3535
- name: Restore dependencies
3636
run: dotnet restore

Adapters/AspNetCore/GenHTTP.Adapters.AspNetCore.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
</ItemGroup>
3636

3737
<ItemGroup>
38-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.3" />
38+
39+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.7" />
40+
3941
</ItemGroup>
4042

4143
</Project>

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
<ItemGroup>
4242

43-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103" PrivateAssets="All" />
43+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.203" PrivateAssets="All" />
4444

4545
</ItemGroup>
4646

Engine/Internal/GenHTTP.Engine.Internal.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
<ProjectReference Include="..\..\Modules\IO\GenHTTP.Modules.IO.csproj" />
2121

22-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.3" />
22+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.7" />
2323

24-
<PackageReference Include="System.IO.Pipelines" Version="10.0.3" />
24+
<PackageReference Include="System.IO.Pipelines" Version="10.0.7" />
2525

2626
</ItemGroup>
2727

Modules/Archives/GenHTTP.Modules.Archives.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ProjectReference Include="..\IO\GenHTTP.Modules.IO.csproj" />
1616

17-
<PackageReference Include="SharpCompress" Version="0.46.1" />
17+
<PackageReference Include="SharpCompress" Version="0.47.4" />
1818

1919
</ItemGroup>
2020

Modules/Caching/GenHTTP.Modules.Caching.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<PackageReference Include="AsyncKeyedLock" Version="8.0.2" />
1616

17-
<PackageReference Include="System.Text.Json" Version="10.0.3" />
17+
<PackageReference Include="System.Text.Json" Version="10.0.7" />
1818

1919
</ItemGroup>
2020

Modules/Compression/Providers/CompressionConcern.cs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.IO.Compression;
1+
using System.Buffers;
2+
using System.IO.Compression;
23

34
using GenHTTP.Api.Content;
45
using GenHTTP.Api.Content.IO;
@@ -131,31 +132,39 @@ private bool ShouldCompressBySize(IResponse response)
131132

132133
return MinimumSize is null || contentLength is null || contentLength >= MinimumSize;
133134
}
135+
136+
private static readonly SearchValues<char> Delimiters = SearchValues.Create([',', ';']);
134137

135138
private static HashSet<string> ParseSupported(ReadOnlySpan<char> acceptHeader)
136139
{
137140
var result = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
138141

139-
var start = 0;
140-
141-
while (start <= acceptHeader.Length)
142+
while (!acceptHeader.IsEmpty)
142143
{
143-
var comma = acceptHeader[start..].IndexOf(',');
144-
var end = comma >= 0 ? start + comma : acceptHeader.Length;
145-
146-
var part = acceptHeader.Slice(start, end - start).Trim();
144+
var delimIdx = acceptHeader.IndexOfAny(Delimiters);
147145

148-
if (!part.IsEmpty)
146+
ReadOnlySpan<char> token;
147+
if (delimIdx < 0)
149148
{
150-
result.Add(part.ToString());
149+
token = acceptHeader.Trim();
150+
acceptHeader = default;
151151
}
152-
153-
if (comma < 0)
152+
else if (acceptHeader[delimIdx] == ',')
153+
{
154+
token = acceptHeader[..delimIdx].Trim();
155+
acceptHeader = acceptHeader[(delimIdx + 1)..];
156+
}
157+
else
154158
{
155-
break;
159+
token = acceptHeader[..delimIdx].TrimEnd();
160+
var commaIdx = acceptHeader[delimIdx..].IndexOf(',');
161+
acceptHeader = commaIdx >= 0
162+
? acceptHeader[(delimIdx + commaIdx + 1)..]
163+
: default;
156164
}
157165

158-
start = end + 1;
166+
if (!token.IsEmpty)
167+
result.Add(token.ToString());
159168
}
160169

161170
return result;

Modules/Conversion/GenHTTP.Modules.Conversion.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<ProjectReference Include="..\IO\GenHTTP.Modules.IO.csproj" />
1616

17-
<PackageReference Include="YamlDotNet" Version="16.3.0" />
17+
<PackageReference Include="YamlDotNet" Version="17.0.1" />
1818

1919
</ItemGroup>
2020

0 commit comments

Comments
 (0)