Skip to content

Commit 85c7f82

Browse files
committed
fixes
1 parent 24fecb7 commit 85c7f82

55 files changed

Lines changed: 1637 additions & 1606 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ jobs:
107107
working-directory: './src'
108108
run: >
109109
dotnet test
110-
--configuration Release
111-
--no-ansi
112-
--no-build
113-
--coverage
114-
--coverage-output-format cobertura
115-
--results-directory ${{ env.TEST_OUTPUT_DIRECTORY }}
116-
--solution *.sln
110+
--configuration Release
111+
--no-ansi
112+
--no-build
113+
--coverage
114+
--coverage-output-format cobertura
115+
--results-directory ${{ env.TEST_OUTPUT_DIRECTORY }}
116+
--solution *.slnx
117117
118118
- name: Create NuGet package
119119
run: >

src/TurboHTTP.API.Tests/verify/CoreAPISpec.ApproveCore.DotNet.verified.txt

Lines changed: 373 additions & 1 deletion
Large diffs are not rendered by default.

src/TurboHTTP.API.Tests/verify/CoreAPISpec.ApproveCore.received.txt

Lines changed: 0 additions & 392 deletions
This file was deleted.

src/TurboHTTP.AcceptanceTests/H10/CompressionSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private static byte[] GzipCompress(byte[] data)
4343
private static byte[] DeflateCompress(byte[] data)
4444
{
4545
using var output = new MemoryStream();
46-
using (var deflate = new DeflateStream(output, CompressionMode.Compress))
46+
using (var deflate = new ZLibStream(output, CompressionMode.Compress))
4747
{
4848
deflate.Write(data, 0, data.Length);
4949
}

src/TurboHTTP.AcceptanceTests/H10/RequestCompressionSpec.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ namespace TurboHTTP.AcceptanceTests.H10;
1313

1414
public sealed class RequestCompressionSpec : AcceptanceTestBase
1515
{
16-
private static Http10Engine Engine => new(new Http1EngineOptions(16, 6, 3, 64 * 1024, 64, 1024 * 1024, TimeSpan.FromSeconds(2)));
17-
16+
1817
private static byte[] MakePayload(int size)
1918
{
2019
var payload = new byte[size];
@@ -29,21 +28,21 @@ private static BidiFlow<HttpRequestMessage, IOutputItem, IInputItem, HttpRespons
2928
CreateCompressionEngine(string encoding)
3029
{
3130
var stage = new ContentEncodingBidiStage(true, new CompressionPolicy { Encoding = encoding });
32-
return BidiFlow.FromGraph(stage).Atop(Engine.CreateFlow());
31+
return BidiFlow.FromGraph(stage).Atop(CreateHttp10Engine().CreateFlow());
3332
}
3433

3534
private static BidiFlow<HttpRequestMessage, IOutputItem, IInputItem, HttpResponseMessage, NotUsed>
3635
CreateDefaultCompressionEngine()
3736
{
3837
var stage = new ContentEncodingBidiStage(true, CompressionPolicy.Default);
39-
return BidiFlow.FromGraph(stage).Atop(Engine.CreateFlow());
38+
return BidiFlow.FromGraph(stage).Atop(CreateHttp10Engine().CreateFlow());
4039
}
4140

4241
private static BidiFlow<HttpRequestMessage, IOutputItem, IInputItem, HttpResponseMessage, NotUsed>
4342
CreateDecompressingAndCompressingEngine(string encoding)
4443
{
4544
var stage = new ContentEncodingBidiStage(true, new CompressionPolicy { Encoding = encoding });
46-
return BidiFlow.FromGraph(stage).Atop(Engine.CreateFlow());
45+
return BidiFlow.FromGraph(stage).Atop(CreateHttp10Engine().CreateFlow());
4746
}
4847

4948
private static byte[] BuildResponse(byte[] body, string? extraHeaders = null)
@@ -144,7 +143,7 @@ public async Task RequestCompression_should_send_and_verify_gzip_request_body()
144143
Content = new ByteArrayContent(payload)
145144
};
146145

147-
var (response, fake) = await SendCompressedAsync(
146+
var (response, _) = await SendCompressedAsync(
148147
CreateCompressionEngine("gzip"),
149148
request,
150149
(_, outbound) =>
@@ -223,7 +222,7 @@ public async Task RequestCompression_should_not_compress_small_body_below_thresh
223222
Content = new ByteArrayContent(payload)
224223
};
225224

226-
var (response, fake) = await SendCompressedAsync(
225+
var (response, _) = await SendCompressedAsync(
227226
CreateDefaultCompressionEngine(),
228227
request,
229228
(_, outbound) =>

src/TurboHTTP.AcceptanceTests/H10/ResilienceSpec.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ namespace TurboHTTP.AcceptanceTests.H10;
1111

1212
public sealed class ResilienceSpec : AcceptanceTestBase
1313
{
14-
private static Http10Engine Engine => new(new Http1EngineOptions(16, 6, 3, 64 * 1024, 64, 1024 * 1024, TimeSpan.FromSeconds(2)));
15-
1614
private static BidiFlow<HttpRequestMessage, IOutputItem, IInputItem, HttpResponseMessage, NotUsed>
1715
CreateDecompressingEngine()
1816
{
1917
var decomp = BidiFlow.FromGraph(new ContentEncodingBidiStage());
20-
return decomp.Atop(Engine.CreateFlow());
18+
return decomp.Atop(CreateHttp10Engine().CreateFlow());
2119
}
2220

2321
private async Task<HttpResponseMessage> SendScriptedAsync(HttpRequestMessage request, Func<int, byte[], byte[]?> factory)
2422
{
2523
var fake = new ScriptedFakeConnectionStage(factory);
26-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
24+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
2725

2826
var tcs = new TaskCompletionSource<HttpResponseMessage>();
2927
_ = Source.Single(request)
@@ -59,7 +57,7 @@ public async Task Resilience_should_cause_exception_on_content_length_mismatch()
5957
var raw = "HTTP/1.0 200 OK\r\nContent-Length: 100\r\n\r\nhello";
6058

6159
var fake = new ScriptedFakeConnectionStage((_, _) => Encoding.Latin1.GetBytes(raw));
62-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
60+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
6361

6462
var tcs = new TaskCompletionSource<HttpResponseMessage>();
6563
_ = Source.Single(request)
@@ -148,7 +146,7 @@ public async Task Resilience_should_detect_truncated_body()
148146
truncatedBody.CopyTo(responseBytes, headerBytes.Length);
149147

150148
var fake = new ScriptedFakeConnectionStage((_, _) => responseBytes);
151-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
149+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
152150

153151
var tcs = new TaskCompletionSource<HttpResponseMessage>();
154152
_ = Source.Single(request)
@@ -190,7 +188,7 @@ public async Task Resilience_should_cause_cancellation_when_slow_headers_exceed_
190188

191189
// Simulate server that never responds (abort connection)
192190
var fake = new ScriptedFakeConnectionStage((_, _) => null);
193-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
191+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
194192

195193
var tcs = new TaskCompletionSource<HttpResponseMessage>();
196194
_ = Source.Single(request)
@@ -212,7 +210,7 @@ public async Task Resilience_should_cause_exception_on_empty_response()
212210

213211
// Server closes connection without sending anything
214212
var fake = new ScriptedFakeConnectionStage((_, _) => null);
215-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
213+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
216214

217215
var tcs = new TaskCompletionSource<HttpResponseMessage>();
218216
_ = Source.Single(request)

src/TurboHTTP.AcceptanceTests/H10/SmokeSpec.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace TurboHTTP.AcceptanceTests.H10;
1010

1111
public sealed class SmokeSpec : AcceptanceTestBase
1212
{
13-
private static Http10Engine Engine => new(new Http1EngineOptions(16, 6, 3, 64 * 1024, 64, 1024 * 1024, TimeSpan.FromSeconds(2)));
14-
1513
[Fact(Timeout = 5000)]
1614
[Trait("RFC", "RFC1945-4.1")]
1715
public async Task SmokeTest_should_return_200_hello_world()
@@ -26,7 +24,7 @@ public async Task SmokeTest_should_return_200_hello_world()
2624
var responseBytes = Encoding.Latin1.GetBytes(raw);
2725

2826
var fake = new ScriptedFakeConnectionStage((_, _) => responseBytes);
29-
var flow = Engine.CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
27+
var flow = CreateHttp10Engine().CreateFlow().Join(Flow.FromGraph<IOutputItem, IInputItem, NotUsed>(fake));
3028

3129
var tcs = new TaskCompletionSource<HttpResponseMessage>();
3230
_ = Source.Single(request)
@@ -39,4 +37,4 @@ public async Task SmokeTest_should_return_200_hello_world()
3937
var responseBody = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
4038
Assert.Equal("Hello World", responseBody);
4139
}
42-
}
40+
}

src/TurboHTTP.AcceptanceTests/H11/CompressionSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private static byte[] GzipCompress(byte[] data)
4444
private static byte[] DeflateCompress(byte[] data)
4545
{
4646
using var output = new MemoryStream();
47-
using (var deflate = new DeflateStream(output, CompressionMode.Compress))
47+
using (var deflate = new ZLibStream(output, CompressionMode.Compress))
4848
{
4949
deflate.Write(data, 0, data.Length);
5050
}

src/TurboHTTP.AcceptanceTests/H2/CompressionSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static byte[] GzipCompress(byte[] data)
4040
private static byte[] DeflateCompress(byte[] data)
4141
{
4242
using var output = new MemoryStream();
43-
using (var deflate = new DeflateStream(output, CompressionMode.Compress))
43+
using (var deflate = new ZLibStream(output, CompressionMode.Compress))
4444
{
4545
deflate.Write(data, 0, data.Length);
4646
}

src/TurboHTTP.AcceptanceTests/H3/CompressionSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private static byte[] GzipCompress(byte[] data)
4040
private static byte[] DeflateCompress(byte[] data)
4141
{
4242
using var output = new MemoryStream();
43-
using (var deflate = new DeflateStream(output, CompressionMode.Compress))
43+
using (var deflate = new ZLibStream(output, CompressionMode.Compress))
4444
{
4545
deflate.Write(data, 0, data.Length);
4646
}

0 commit comments

Comments
 (0)