-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Respect SETTINGS_MAX_HEADER_LIST_SIZE on HTTP/2 and HTTP/3 #79281
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCloses #78193 This PR does approximate header list length calculations for HTTP/2 and HTTP/3 in order to enforce the Do we care about the calculated length being exactly correct? Given this limit is generally really high and should only be hit in exceptional cases, I don't think we do. Doing precise bookkeeping would mainly represent a maintenance burden for us (and a slight performance overhead). The current approach of taking the encoded length from HPACK works well as long as we don't support the dynamic table/compression for request headers. cc: @Tratcher
|
src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs
Outdated
Show resolved
Hide resolved
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.
LGTM
@Tratcher can you please take a look at this one if this reduced change still makes sense to you? |
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Outdated
Show resolved
Hide resolved
7efb4f5
to
d8d975a
Compare
/backport to release/7.0 |
Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/3787989385 |
Closes #78193
This PR does approximate header list length calculations for HTTP/2 and HTTP/3 in order to enforce the
SETTINGS_MAX_HEADER_LIST_SIZE
setting. It is a slight overestimation of the actual size (mainly from counting the overhead of HPACK framing), therefore making the client slightly more strict than the spec describes.ASP.NET Core on the other hand is slightly less strict than the spec describes dotnet/aspnetcore#44668 (this is good, you don't want the client/server to be the other way around).
Do we care about the calculated length being exactly correct? Given this limit is generally really high and should only be hit in exceptional cases, I don't think we do. Doing precise bookkeeping would mainly represent a maintenance burden for us (and a slight performance overhead). The current approach of taking the encoded length from HPACK works well as long as we don't support the dynamic table/compression for request headers.
cc: @Tratcher