Fix chunked transfers for real this time.
This commit is contained in:
parent
b762026958
commit
79591f27b7
1 changed files with 3 additions and 1 deletions
|
@ -151,7 +151,7 @@ namespace Hamakaze {
|
||||||
if(line == null)
|
if(line == null)
|
||||||
throw new IOException(@"Failed to read initial HTTP header.");
|
throw new IOException(@"Failed to read initial HTTP header.");
|
||||||
if(!line.StartsWith(@"HTTP/"))
|
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);
|
string[] parts = line[5..].Split(' ', 3);
|
||||||
if(!int.TryParse(parts.ElementAtOrDefault(1), out int statusCode))
|
if(!int.TryParse(parts.ElementAtOrDefault(1), out int statusCode))
|
||||||
throw new IOException(@"Invalid HTTP status code format.");
|
throw new IOException(@"Invalid HTTP status code format.");
|
||||||
|
@ -238,6 +238,8 @@ namespace Hamakaze {
|
||||||
readBuffer(chunkLength);
|
readBuffer(chunkLength);
|
||||||
readLine();
|
readLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readLine();
|
||||||
} else if(contentLength != 0) {
|
} else if(contentLength != 0) {
|
||||||
body = new MemoryStream();
|
body = new MemoryStream();
|
||||||
readBuffer(contentLength);
|
readBuffer(contentLength);
|
||||||
|
|
Reference in a new issue