diff options
Diffstat (limited to 'lib/Net.Http')
-rw-r--r-- | lib/Net.Http/src/Core/Response/ChunkedStream.cs | 2 | ||||
-rw-r--r-- | lib/Net.Http/src/Core/SharedHeaderReaderBuffer.cs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Net.Http/src/Core/Response/ChunkedStream.cs b/lib/Net.Http/src/Core/Response/ChunkedStream.cs index 953d763..724e28d 100644 --- a/lib/Net.Http/src/Core/Response/ChunkedStream.cs +++ b/lib/Net.Http/src/Core/Response/ChunkedStream.cs @@ -70,7 +70,7 @@ namespace VNLib.Net.Http.Core LastChunk = encoding.GetBytes(LAST_CHUNK_STRING); //get the min buffer by rounding to the nearest page - int actualBufSize = (chunkBufferSize / 4096 + 1) * 4096; + int actualBufSize = (int)MemoryUtil.NearestPage(chunkBufferSize); //Init accumulator ChunckAccumulator = new(encoding, actualBufSize); diff --git a/lib/Net.Http/src/Core/SharedHeaderReaderBuffer.cs b/lib/Net.Http/src/Core/SharedHeaderReaderBuffer.cs index 36ebb66..fb20e68 100644 --- a/lib/Net.Http/src/Core/SharedHeaderReaderBuffer.cs +++ b/lib/Net.Http/src/Core/SharedHeaderReaderBuffer.cs @@ -27,8 +27,6 @@ using System.Runtime.InteropServices; using VNLib.Utils.Memory; - - namespace VNLib.Net.Http.Core { sealed class SharedHeaderReaderBuffer : IHttpLifeCycle @@ -46,6 +44,9 @@ namespace VNLib.Net.Http.Core { _bufferSize = length + (length * sizeof(char)); + //Round to nearest page + _bufferSize = (int)MemoryUtil.NearestPage(_bufferSize); + //Bin buffer is the specified size BinLength = length; } |