[links-list] Re: gzipped files - final

Witold Filipczyk witekfl at poczta.onet.pl
Sun May 5 10:48:11 PDT 2002


On Sun, May 05, 2002 at 07:18:17PM +0200, Petr Baudis wrote:
> Dear diary, on Thu, May 02, 2002 at 11:50:09AM CEST, I got a letter,
> where Witold Filipczyk <juandon at poczta.onet.pl> told me, that...
> > On Wed, May 01, 2002 at 10:48:53PM +0200, Petr Baudis wrote:
> > [...]
> > 
> > OK. You are right. I didn't listen carefully.
> > zstream for deflated and gzip and similar interface for bzip2
> > in one file (protocol/compressed.c) will be simpler and better.
> > For local files:
> > - read them at once
> > - goto decompression
> > 	if not compressed return
> > 	if gzipped decompress(gzip); return;
> > 	if bzipped2 decompress(bzip2); return;
> > 	and so on ...
> 
> Yes, that's it! :) (just please name it util/compress.c ;)

I have done it.
Function decompress tests:
if it is gzip file decompress_gzip is called
if it is bzipped2 - decompress_bzip2 is called
change nothing, otherwise.

But if file (for example) aaa.gz is download (file://aaa.gz)
it will be saved uncompressed.
The flag (download|view) will come in useful.

> > For http:
> > additional functions:
> > read_http_data_gzip
> > read_http_data_bzip2
> > and so on
> 
> I guess it could be just read_http_data(), and saving type of compression in
> struct http_connection_info - if there's any compression, we'll just
> additionally decompress the data before doing anything with them.

I think that ten short functions are better than one big, which doesn't fit
on screen.
To change http_connection_info isn't necessary.  Content-Encoding is known
from header.  To test Content-Encoding header field and call
appreciate function is sufficient.

I didn't code it yet (It's very hot recently.
Summer in May it is already standard.)
> > It is so simple, so I write it, surely ;-)
> Great :).

I changed e-mail address and I hope I won't over the top.

Witek
-- 
Unsubscribe: send email to links-list-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message



More information about the links-list mailing list