Skip to content

Disable request body data rate limits per HTTP/2 stream #10355

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

Merged
merged 2 commits into from
May 18, 2019
Merged

Conversation

halter73
Copy link
Member

Addresses #7635


MinDataRate IHttpMinRequestBodyDataRateFeature.MinDataRate
{
get => throw new NotSupportedException(CoreStrings.Http2MinDataRateNotSupported);
Copy link
Member

@Tratcher Tratcher May 17, 2019

Choose a reason for hiding this comment

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

The getter should return null if that's the only allowed value, or it should at least return null if already set to null. Throwing getters are no fun.

Copy link
Member Author

@halter73 halter73 May 17, 2019

Choose a reason for hiding this comment

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

The thing is we generally are enforcing a rate limit for HTTP/2. It's just per connection, not per stream. So I don't think it makes sense to return null, but I also don't think it makes sense to return the entire connection's rate limit either.

- The implementations are in Http1Connection and Http2Stream
@JamesNK
Copy link
Member

JamesNK commented May 17, 2019

I'd like to understand how we'll use this in gRPC.

I believe we only want to disable the rate limit on gRPC requests. We could be more specific and only disable the rate limit on client or duplex streaming request. Would that be done by setting this feature on the HttpContext with a null MinDataRate on only gRPC client/duplex streaming requests?

@halter73
Copy link
Member Author

Would that be done by setting this feature on the HttpContext with a null MinDataRate on only gRPC client/duplex streaming requests?

Exactly. Something like https://github.com/aspnet/AspNetCore/pull/10355/files#diff-2d9b5c655816cc6e1ea41260d95cd33eR815

@JamesNK
Copy link
Member

JamesNK commented May 17, 2019

Ah, the IHttpMinRequestBodyDataRateFeature will always be set on a HTTP/2 request, and it is a matter of getting it and setting MinDataRate to null in the appropriate requests.

What happens if you have a HTTP/2 request and someone defines there own IHttpMinRequestBodyDataRateFeature implementation and has a non-null MinDataRate?

@halter73
Copy link
Member Author

What happens if you have a HTTP/2 request and someone defines there own IHttpMinRequestBodyDataRateFeature implementation and has a non-null MinDataRate?

That's the prerogative of whoever defines their own IHttpMinRequestBodyDataRateFeature. I doubt a custom IHttpMinRequestBodyDataRateFeature would be able to do much with a non-null MinDataRate and an HTTP/2 request unless is measured the rate of the request body itself.

@halter73
Copy link
Member Author

I expect most people who replace a IHttpMinRequestBodyDataRateFeature would be replacing it with a facade that would call the "real" MinDataRate setter which would throw a NotSupportedException given a non-null rate with HTTP/2.

@JamesNK
Copy link
Member

JamesNK commented May 18, 2019

Ok. I'm not super familiar with this space, just want to make sure it is thought about.

@halter73 halter73 merged commit 8d83e53 into master May 18, 2019
@halter73 halter73 deleted the halter73/7635 branch May 18, 2019 01:25
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants