Skip to content

Commit c4e00cc

Browse files
committed
Ensure ConnectionCloseReadStream uses provided bufferSize
See dotnet/corefx#32803
1 parent 0c0bde4 commit c4e00cc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

StandardSocketsHttpHandler/Net/Http/SocketsHttpHandler/HttpConnection.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,20 +1432,19 @@ private Task CopyToUntilEofAsync(Stream destination, int bufferSize, Cancellatio
14321432

14331433
int remaining = _readLength - _readOffset;
14341434
return remaining > 0 ?
1435-
CopyToUntilEofWithExistingBufferedDataAsync(destination, cancellationToken) :
1435+
CopyToUntilEofWithExistingBufferedDataAsync(destination, bufferSize, cancellationToken) :
14361436
_stream.CopyToAsync(destination, bufferSize, cancellationToken);
14371437
}
14381438

1439-
private async Task CopyToUntilEofWithExistingBufferedDataAsync(Stream destination, CancellationToken cancellationToken)
1439+
private async Task CopyToUntilEofWithExistingBufferedDataAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
14401440
{
14411441
int remaining = _readLength - _readOffset;
14421442
Debug.Assert(remaining > 0);
14431443

14441444
await CopyFromBufferAsync(destination, remaining, cancellationToken).ConfigureAwait(false);
14451445
_readLength = _readOffset = 0;
14461446

1447-
const int BufferSize = 81920; // Stream.DefaultCopyBufferSize
1448-
await _stream.CopyToAsync(destination, BufferSize, cancellationToken).ConfigureAwait(false);
1447+
await _stream.CopyToAsync(destination, bufferSize, cancellationToken).ConfigureAwait(false);
14491448
}
14501449

14511450
// Copy *exactly* [length] bytes into destination; throws on end of stream.

0 commit comments

Comments
 (0)