From 79591f27b7877cd4aa1e3dd4a215a90d0a48e540 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 10 Apr 2022 00:42:53 +0200 Subject: [PATCH] Fix chunked transfers for real this time. --- Hamakaze/HttpResponseMessage.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Hamakaze/HttpResponseMessage.cs b/Hamakaze/HttpResponseMessage.cs index b2d7abb..a7bfb95 100644 --- a/Hamakaze/HttpResponseMessage.cs +++ b/Hamakaze/HttpResponseMessage.cs @@ -151,7 +151,7 @@ namespace Hamakaze { if(line == null) throw new IOException(@"Failed to read initial HTTP header."); if(!line.StartsWith(@"HTTP/")) - throw new IOException(@"Response is not a valid HTTP message."); + throw new IOException($@"Response is not a valid HTTP message: {line}."); string[] parts = line[5..].Split(' ', 3); if(!int.TryParse(parts.ElementAtOrDefault(1), out int statusCode)) throw new IOException(@"Invalid HTTP status code format."); @@ -238,6 +238,8 @@ namespace Hamakaze { readBuffer(chunkLength); readLine(); } + + readLine(); } else if(contentLength != 0) { body = new MemoryStream(); readBuffer(contentLength);