HttpBaseStream Gzip extract - NotSupportedException #639

Closed
opened 2026-01-29 22:15:07 +00:00 by claunia · 4 comments
Owner

Originally created by @Ilanlido on GitHub (May 18, 2024).

Originally assigned to: @Copilot on GitHub.

Hi, looks like when trying to decompress a gzip through httpStream it throws NotSupportedException on Position when setting EntryStartPosition. what is the purpose of settings this field? how can i mitigate the problem? Thanks!

System.NotSupportedException: Specified method is not supported.
   at System.Net.Http.HttpBaseStream.get_Position()
   at SharpCompress.IO.RewindableStream.get_Position()
   at SharpCompress.Common.GZip.GZipFilePart..ctor(Stream stream, ArchiveEncoding archiveEncoding)
   at SharpCompress.Common.GZip.GZipEntry.GetEntries(Stream stream, OptionsBase options)+MoveNext()

P.S i'd prefer to not save the file to disk and read it again as FileStream if possible
If that's not possible which types require random access? i know that .tar.gz works perfectly fine through http for example, Thanks in advance!

Originally created by @Ilanlido on GitHub (May 18, 2024). Originally assigned to: @Copilot on GitHub. Hi, looks like when trying to decompress a gzip through httpStream it throws NotSupportedException on Position when setting EntryStartPosition. what is the purpose of settings this field? how can i mitigate the problem? Thanks! ``` System.NotSupportedException: Specified method is not supported. at System.Net.Http.HttpBaseStream.get_Position() at SharpCompress.IO.RewindableStream.get_Position() at SharpCompress.Common.GZip.GZipFilePart..ctor(Stream stream, ArchiveEncoding archiveEncoding) at SharpCompress.Common.GZip.GZipEntry.GetEntries(Stream stream, OptionsBase options)+MoveNext() ``` P.S i'd prefer to not save the file to disk and read it again as FileStream if possible If that's not possible which types require random access? i know that .tar.gz works perfectly fine through http for example, Thanks in advance!
Author
Owner

@adamhathcock commented on GitHub (May 20, 2024):

You'll have to show me how you're calling things.

GZipFilePart does check CanSeek but Rewindable is meant to buffer unbufferable streams so shouldn't be used here.

@adamhathcock commented on GitHub (May 20, 2024): You'll have to show me how you're calling things. GZipFilePart does check CanSeek but Rewindable is meant to buffer unbufferable streams so shouldn't be used here.
Author
Owner

@adamhathcock commented on GitHub (May 20, 2024):

Actually, I take that back, GZipFilePart has a usage of Position no matter seeking. That should be changed

@adamhathcock commented on GitHub (May 20, 2024): Actually, I take that back, GZipFilePart has a usage of Position no matter seeking. That should be changed
Author
Owner

@Ilanlido commented on GitHub (May 20, 2024):

I'm not familiar with the internals of how Gzip works, but again, why do we need EntryStartPosition? isn't there only one entry always in .gz? maybe i can help :)

@Ilanlido commented on GitHub (May 20, 2024): I'm not familiar with the internals of how Gzip works, but again, why do we need EntryStartPosition? isn't there only one entry always in .gz? maybe i can help :)
Author
Owner

@adamhathcock commented on GitHub (May 20, 2024):

you're right but I'm not sure why I'm doing that....I'd have to look and remember

@adamhathcock commented on GitHub (May 20, 2024): you're right but I'm not sure why I'm doing that....I'd have to look and remember
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#639