@@ -144,17 +144,16 @@ private async Task<IFormCollection> InnerReadFormAsync(CancellationToken cancell
144
144
var section = await multipartReader . ReadNextSectionAsync ( cancellationToken ) ;
145
145
while ( section != null )
146
146
{
147
- var headers = section . Headers ;
148
147
ContentDispositionHeaderValue contentDisposition ;
149
- ContentDispositionHeaderValue . TryParse ( headers [ HeaderNames . ContentDisposition ] , out contentDisposition ) ;
148
+ ContentDispositionHeaderValue . TryParse ( section . ContentDisposition , out contentDisposition ) ;
150
149
if ( HasFileContentDisposition ( contentDisposition ) )
151
150
{
152
151
// Find the end
153
152
await section . Body . DrainAsync ( cancellationToken ) ;
154
153
155
154
var file = new FormFile ( _request . Body , section . BaseStreamOffset . Value , section . Body . Length )
156
155
{
157
- Headers = new HeaderDictionary ( headers ) ,
156
+ Headers = new HeaderDictionary ( section . Headers ) ,
158
157
} ;
159
158
if ( files == null )
160
159
{
@@ -170,7 +169,7 @@ private async Task<IFormCollection> InnerReadFormAsync(CancellationToken cancell
170
169
171
170
var key = HeaderUtilities . RemoveQuotes ( contentDisposition . Name ) ;
172
171
MediaTypeHeaderValue mediaType ;
173
- MediaTypeHeaderValue . TryParse ( headers [ HeaderNames . ContentType ] , out mediaType ) ;
172
+ MediaTypeHeaderValue . TryParse ( section . ContentType , out mediaType ) ;
174
173
var encoding = FilterEncoding ( mediaType ? . Encoding ) ;
175
174
using ( var reader = new StreamReader ( section . Body , encoding , detectEncodingFromByteOrderMarks : true , bufferSize : 1024 , leaveOpen : true ) )
176
175
{
@@ -180,7 +179,7 @@ private async Task<IFormCollection> InnerReadFormAsync(CancellationToken cancell
180
179
}
181
180
else
182
181
{
183
- System . Diagnostics . Debug . Assert ( false , "Unrecognized content-disposition for this section: " + headers [ HeaderNames . ContentDisposition ] ) ;
182
+ System . Diagnostics . Debug . Assert ( false , "Unrecognized content-disposition for this section: " + section . ContentDisposition ) ;
184
183
}
185
184
186
185
section = await multipartReader . ReadNextSectionAsync ( cancellationToken ) ;
0 commit comments