You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opening a tar.gz file directly from the network makes SharpZipLib to an attempt to access an already disposed Stream #379
With the current 1.2.0 release (and 1.1.0 and 1.0.0) I get an ObjectDisposedException on the network socket stream, but it happens after the whole file has been extracted successfully, so it seems to be yet another exceptional case happening after finishing the file.
In my total ignorance of this code, I've tracked the issue to this line:
makes my specific case work successfully. I think that the server ends the connection after the file is downloaded so the stream is not there to be read from anymore.
Activity
Numpsy commentedon Aug 24, 2019
The discussion @ https://stackoverflow.com/questions/48829032/streamreader-readline-throwing-disposed-exception-rather-than-returning-null suggests that the FTP response stream closes itself when all the data is read, which could cause issues with stacked streams?
Maybe the multiple-block handling loop in GZipInputStream.Read could check stream.CanRead before trying to read a second block?
koide commentedon Aug 26, 2019
Yup, looks like it's not the server but FtpWebRequest's FtpDataStream.
I can confirm that doing
while (toRead > 0 && inputStream.CanRead)instead of
SharpZipLib/src/ICSharpCode.SharpZipLib/Zip/Compression/Streams/InflaterInputStream.cs
Line 119 in ab7f8c5
makes it work in my case as well, and looks like a saner approach.
Unit test for issue icsharpcode#379
Merge PR #387: Better handle baseStreams closing themselves unexpectedly