[links-list] Re: gzipped files - final

Petr Baudis pasky at pasky.ji.cz
Sun May 5 11:06:50 PDT 2002


Dear diary, on Sun, May 05, 2002 at 07:48:11PM CEST, I got a letter,
where Witold Filipczyk <witekfl at poczta.onet.pl> told me, that...
> 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.

Looks fine.

> But if file (for example) aaa.gz is download (file://aaa.gz)
> it will be saved uncompressed.

That's a problem, yes.

> The flag (download|view) will come in useful.

Possibly.

> > > 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.

I don't require function to fit on screen, but I prefer shorter functions as
well.

However, this'll add one line to read_http_data() and otherwise you'd just
have to duplicate whole read_http_data().

> 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.

What if there'll be no Content-Encoding? But don't mind, we could change this
later if neccessary.

> 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.

-- 
 
				Petr "Pasky" Baudis
 
* ELinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
Object orientation is in the mind, not in the compiler. -- Alan Cox
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/
-- 
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