[links-list] Re: gzipped files - final

Witold Filipczyk juandon at poczta.onet.pl
Thu May 2 02:50:09 PDT 2002


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

For http:
additional functions:
read_http_data_gzip
read_http_data_bzip2
and so on

It is so simple, so I write it, surely ;-)


I have noticed, that header parsing is totally messy (you like this word,
aren't you).

My proposal is:

void (*response)()[]

array for functions - "responses" for every code get from server, eg.

HTTP/1.1 200 OK

response[200-100]() handle this

Possible codes are in range 100-599, so we need only
500 * sizeof(pointer) bytes of additional memory.
But then it will be simple, fast and easilly extensible.

In similar way for headers:
- function for Date:
- function for Server:
- function for every known header

Default headers in sorted array.
With binary search we get either index of function, which handle given header,
or we get to know that this header is not handled yet.

Development will be simple, easy and enjoyable :)

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