Register FileBufferingReadStream for disposal
This commit is contained in:
parent
1a485fadb0
commit
ee804e5841
|
|
@ -48,9 +48,9 @@ namespace Microsoft.AspNet.Http.Internal
|
||||||
var body = request.Body;
|
var body = request.Body;
|
||||||
if (!body.CanSeek)
|
if (!body.CanSeek)
|
||||||
{
|
{
|
||||||
// TODO: Register this buffer for disposal at the end of the request to ensure the temp file is deleted.
|
var fileStream = new FileBufferingReadStream(body, bufferThreshold, _getTempDirectory);
|
||||||
// Otherwise it won't get deleted until GC closes the stream.
|
request.Body = fileStream;
|
||||||
request.Body = new FileBufferingReadStream(body, bufferThreshold, _getTempDirectory);
|
request.HttpContext.Response.RegisterForDispose(fileStream);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue