diff options
author | vnugent <public@vaughnnugent.com> | 2024-06-16 13:08:31 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-06-16 13:08:31 -0400 |
commit | ff0926be56fc6eafdce36411847d73bf4ce9f183 (patch) | |
tree | 77dfbf2a26a74871b368e42d757c90f4857ef008 /lib/Net.Http/src | |
parent | 07ddf6738d32127926d07b1366e56d2a2308b53b (diff) |
feat: Allow multiple plugin loading directories
Diffstat (limited to 'lib/Net.Http/src')
-rw-r--r-- | lib/Net.Http/src/Core/Buffering/ContextLockedBufferManager.cs | 13 | ||||
-rw-r--r-- | lib/Net.Http/src/Core/HttpContext.cs | 13 |
2 files changed, 16 insertions, 10 deletions
diff --git a/lib/Net.Http/src/Core/Buffering/ContextLockedBufferManager.cs b/lib/Net.Http/src/Core/Buffering/ContextLockedBufferManager.cs index b99e3ff..b11b62b 100644 --- a/lib/Net.Http/src/Core/Buffering/ContextLockedBufferManager.cs +++ b/lib/Net.Http/src/Core/Buffering/ContextLockedBufferManager.cs @@ -145,6 +145,19 @@ namespace VNLib.Net.Http.Core.Buffering ///<inheritdoc/> public IChunkAccumulatorBuffer ChunkAccumulatorBuffer => _chunkAccBuffer; + public Memory<byte> GetInitStreamBuffer() + { + /* + * Since this buffer must be shared with char buffers, size + * must be respected. Remember that split buffesr store binary + * data at the head of the buffer and char data at the tail + */ + + Memory<byte> dataBuffer = RequestHeaderParseBuffer.GetMemory(); + + return dataBuffer[..RequestHeaderParseBuffer.BinSize]; + } + /* * Response buffer and form data buffer are shared because they are never diff --git a/lib/Net.Http/src/Core/HttpContext.cs b/lib/Net.Http/src/Core/HttpContext.cs index 18aef69..aa6f260 100644 --- a/lib/Net.Http/src/Core/HttpContext.cs +++ b/lib/Net.Http/src/Core/HttpContext.cs @@ -172,7 +172,7 @@ namespace VNLib.Net.Http.Core { /* * This function allows for pre-buffering of the transport - * before parsing the response. It also allows waiting for more data async + * before parsing the request. It also allows waiting for more data async * when an http1 request is in keep-alive mode waiting for more data. * * We can asynchronously read data when its available and preload @@ -185,18 +185,11 @@ namespace VNLib.Net.Http.Core _bytesRead = 0; - Memory<byte> dataBuffer = Buffers.RequestHeaderParseBuffer.GetMemory(); - - /* - * Since this buffer must be shared with char buffers, size - * must be respected. Remember that split buffesr store binary - * data at the head of the buffer and char data at the tail - */ - dataBuffer = dataBuffer[..Buffers.RequestHeaderParseBuffer.BinSize]; + Memory<byte> dataBuffer = Buffers.GetInitStreamBuffer(); _bytesRead = await _ctx!.ConnectionStream.ReadAsync(dataBuffer, cancellation); - Debug.Assert(_bytesRead <= Buffers.RequestHeaderParseBuffer.BinSize); + Debug.Assert(_bytesRead <= dataBuffer.Length); } #endregion |