Ra/request decompression middleware/david acker#26763
Conversation
|
@david-acker please review my commit. That's a quick pass, I'll tweak it but you'll get an idea of my changes. |
|
@Rick-Anderson Looks great! Thanks for cleaning this up. |
| Decompression: | ||
|
|
||
| * Occurs when the body of the request is being read. That is, decompression occurs at the endpoint on model binding. The request body is not decompressed eagerly. | ||
| * When attempting to read the decompressed request body, if the compressed data is invalid for the specified `Content-Encoding`, an exception is thrown. |
There was a problem hiding this comment.
What kind of exception? Since this is Stream, only a few types of exceptions are expected, like IOException.
There was a problem hiding this comment.
These are the exceptions thrown by the underlying decompression stream implementations used by the default providers:
Brotli (BrotliStream):
System.InvalidOperationException: Decoder ran into invalid data.
Deflate (DeflateStream):
System.IO.InvalidDataException: The archive entry was compressed using an unsupported compression method.
GZip (GZipStream):
System.IO.InvalidDataException: The archive entry was compressed using an unsupported compression method.
| The maximum request size for an endpoint is set by: | ||
|
|
||
| * <xref:Microsoft.AspNetCore.Http.Metadata.IRequestSizeLimitMetadata.MaxRequestBodySize?displayProperty=nameWithType>, such as <xref:Microsoft.AspNetCore.Mvc.RequestSizeLimitAttribute> or <xref:Microsoft.AspNetCore.Mvc.DisableRequestSizeLimitAttribute> for MVC endpoints. | ||
| * If the preceding API's aren't applied, the global server size limit specified by <xref:Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature.MaxRequestBodySize?displayProperty=nameWithType> is used. |
There was a problem hiding this comment.
The default size limit is set at the server level such as
https://github.com/dotnet/aspnetcore/blob/197c1693d3c830af52b587e8d88891bc9689be44/src/Servers/Kestrel/Core/src/KestrelServerLimits.cs#L148-L157
Fixes #26541
moved from #26761
Internal review URL
Public review of the doc build:
review.from URL.