Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[http-fault-injector] Add support for interrupting request #7698

Merged

Conversation

mikeharder
Copy link
Member

@mikeharder mikeharder commented Feb 16, 2024

The changes under Azure.Sdk.Tools.HttpFaultInjector deserve more scrutiny. The changes under sample-[clients|servers] need less scrutiny since they are just samples.

- Should handle chunked upstream requests without content-length
- And shouldn't break requests with no body
- Default buffer size is about 3MB, which is too large for 10MB payload
@mikeharder mikeharder marked this pull request as ready for review February 16, 2024 10:45
@mikeharder mikeharder requested a review from a team as a code owner February 16, 2024 10:45
@mikeharder mikeharder self-assigned this Feb 16, 2024
@@ -67,13 +67,10 @@ private async Task<UpstreamResponse> SendUpstreamRequest(HttpRequest request, st

using (var upstreamRequest = new HttpRequestMessage(new HttpMethod(request.Method), upstreamUri))
{
if (request.ContentLength > 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should work even for requests with no body, or requests with chunked encoding. Shouldn't need to gate on content-length header.

@@ -13,6 +13,8 @@ RUN dotnet dev-certs https
EXPOSE 7777
EXPOSE 7778

ENV ASPNETCORE_URLS=http://+:7777;https://+:7778
Copy link
Member Author

Choose a reason for hiding this comment

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

These are already set in appsettings.json, but when we tried to run the docker container, it ws using the default ports of 5000 and 5001 instead. This seems like a reasonable setting if we want to ensure ASP.NET uses these ports.

@mikeharder
Copy link
Member Author

@lmolkova: I'd like for you to review this before I merge.

})
.Configure(app => app.Run(async context =>
{
Console.WriteLine($"Request: {context.Request.Path}");
Copy link
Member

Choose a reason for hiding this comment

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

nit: you can still do app.UseHttpLogging() to have logging configurable, controllable and exportable

Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikeharder mikeharder merged commit 3fa3512 into Azure:main Feb 28, 2024
8 checks passed
@mikeharder mikeharder deleted the http-fault-injector-interrupt-request branch February 28, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[http-fault-injector] Add support for interrupting request with TCP RST
3 participants