mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Failed to read stream from HttpClient.Get with option HttpCompletionOption.ResponseHeadersRead #196
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jiabiao on GitHub (Jun 3, 2017).
The following code works fine under full framework, but get exception under .net core 1.0 and 2.0.
Changing the HttpClient.Get option to
HttpCompletionOption.ResponseContentReadalso works. But for large files, it can not start decompressing until the entire file is downloaded.@adamhathcock commented on GitHub (Jun 3, 2017):
Worked for me
Always use
async/awaitandusingstatements please.@adamhathcock commented on GitHub (Jun 3, 2017):
This
netcoreapp1.1haven't tried 2.0@jiabiao commented on GitHub (Jun 4, 2017):
Weird, your code throw the same exception on my end.

I did use
async/awaitandusingstatements in my actual code. The code in the original post is simplified for demonstration purposes.@adamhathcock commented on GitHub (Jun 4, 2017):
Weird.
Just in case I put my code here: https://github.com/adamhathcock/sc-http-test
@jiabiao commented on GitHub (Jun 4, 2017):
git clone & dotnet run still get the same exception.
I will debug with source to see what happened.
@jiabiao commented on GitHub (Jun 4, 2017):
I created an issue https://github.com/dotnet/corefx/issues/20676.
Reading 0 byte from network stream will cause this exception.
So if the count parameter is 0, the RewindableStream.Read method should return 0 directly.
@adamhathcock commented on GitHub (Jun 4, 2017):
I don't get how I didn't get the exception but you did. Just happened to read zero bytes and I didn't?
@jiabiao commented on GitHub (Jun 5, 2017):
This issue occurs only on windows, Are you using macOS or Linux?
Otherwise, I don't know why you didn't get the exception. You can add a conditional breakpoints at the beginning of RewindableStream.Read method to investigate.
@adamhathcock commented on GitHub (Jun 5, 2017):
You're right. I get this on Windows but not macOS
@adamhathcock commented on GitHub (Jun 9, 2017):
https://www.nuget.org/packages/sharpcompress/0.17.1
@jiabiao commented on GitHub (Jun 9, 2017):
thanks.