Skip to content

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

Merged
mikeharder merged 12 commits intoAzure:mainfrom
mikeharder:http-fault-injector-interrupt-request
Feb 28, 2024
Merged

[http-fault-injector] Add support for interrupting request#7698
mikeharder merged 12 commits intoAzure:mainfrom
mikeharder:http-fault-injector-interrupt-request

Conversation

@mikeharder
Copy link
Copy Markdown
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

using (var upstreamRequest = new HttpRequestMessage(new HttpMethod(request.Method), upstreamUri))
{
if (request.ContentLength > 0)
Copy link
Copy Markdown
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.

EXPOSE 7777
EXPOSE 7778

ENV ASPNETCORE_URLS=http://+:7777;https://+:7778
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

@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
@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

Development

Successfully merging this pull request may close these issues.

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

3 participants