-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Managed Handler: add some basic protocol tests for status line handling #23333
Conversation
| } | ||
| } | ||
|
|
||
| public sealed class ManagedHandler_HttpProtocolTests : HttpProtocolTests, IDisposable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we should have non-ManagedHandler versions of these to ensure the exceptions we get back match the existing behavior.
| public override Stream GetStream(Stream s) | ||
| { | ||
| return new DribbleStream(s); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could be
public override Stream GetStream(Stream s) => new DribbleStream(s);| [InlineData(555, "we just don't like you")] | ||
| [InlineData(600, "still valid")] | ||
| [InlineData(999, "this\ttoo\t")] | ||
| public async Task ValidStatusLine(int statusCode, string reason) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any benefit https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs#L1292 provides over this? Seems like we need one or the other but not both.
| [InlineData(600, "still valid")] | ||
| [InlineData(999, "this\ttoo\t")] | ||
| public async Task ValidStatusLine(int statusCode, string reason) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the current naming convention for networking tests which use a three part name separated by underscores.
| [InlineData("HTTP/A.1 200 OK")] | ||
| [InlineData("HTTP/X.Y.Z 200 OK")] | ||
| [InlineData("HTTP\\1.1 200 OK")] | ||
| [InlineData("HTTP 1.1 200 OK")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly for https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs#L1317... can that be rolled into this and that one deleted?
|
|
||
| namespace System.Net.Http.Functional.Tests | ||
| { | ||
| public abstract class HttpProtocolTests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the naming convention for class name and filename regarding test classes which use a singular "Test" as the suffix.
| await s.WriteAsync(responseBytes, 0, responseBytes.Length); | ||
| accept.Close(); | ||
| listen.Close(); | ||
| }, TaskContinuationOptions.ExecuteSynchronously); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is now the 3rd or 4th loopback server we have in these tests :) Can we augment one of the existing ones however is needed rather than adding another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We already have a LoopbackServer that we use extensively in Http tests. And you can have whatever status line you want returned to enable "fuzzer" type tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll use the existing LoopbackServer.
|
|
||
| [Theory] | ||
| [InlineData(200, "OK")] | ||
| [InlineData(200, "Sure why not?")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about obs-text chars in range %x80-FF, also percent encoded chars, like "Is this valid? %FF"
Priya91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases LGTM!
|
@dotnet-bot Test Outerloop Windows x64 Debug Build |
|
@geoffkizer what is status of this PR? 2.5 weeks no update ... |
|
@geoffkizer ping? |
|
I'll finish this. |
315b83d to
3b6870c
Compare
3b6870c to
3b9525b
Compare
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Managed Handler: add some basic protocol tests for status line handling Commit migrated from dotnet/corefx@08802ff
@stephentoub @Priya91 @wfurt