diff --git a/HTTP/HttpStream.cs b/HTTP/HttpStream.cs index 02d06f1..0b9005f 100644 --- a/HTTP/HttpStream.cs +++ b/HTTP/HttpStream.cs @@ -75,11 +75,20 @@ class HttpStream : IDisposable } } - public ValueTask Read(Memory buffer) + public async ValueTask Read(Memory buffer) { try { - return Buffer.ReadAsync(buffer); + int index = 0; + while (index < buffer.Length) + { + int count = await Buffer.ReadAsync(buffer[index..]); + if (count == 0) + break; + + index += count; + } + return index; } catch (IOException e) {