Forum

usegzfile

Rene
11 November 2009, 17:23
Hello,

the Flag usegzfile say hiawatha, to search an *.gz-file when the request was not found. What to bring this behavior?

I think it makes more sense if hiawatha with certain file types always looking first for a .gz-file, if this is not available, delivering the actual file? That would make sense for me to make such this flag, but the other way around I can see no advantage.

Regards

Rene
Hugo Leisink
12 November 2009, 09:21
It already works as you described. The manual is incorrect. Fixed it, thanks.
Rene
12 November 2009, 15:19
Hello,

sorry, i mean an feature like this:

from http://www.fefe.de/gatling/
"transparent content negotiation (will serve foo.html.gz if foo.html was asked for and browser indicates it understands deflate)"

Hiawatha make this in another Ordering, it serve first for foo.html, when this file doesn't exists, it serves for foo.html.gz . Can Hiawatha make this like gatling?

Sorry, my English is very bad.

Rene
Hugo Leisink
12 November 2009, 15:47
Hiawatha works just like that. The manual was incorrect.

If /image.jpg is requested, UseGZfile is set to 'yes' and the browser tells Hiawatha it supports gzip content encoding, Hiawatha will look for /image.jpg.gz. If that file exists, it will upload that one with "Content-Encoding: gzip". The browser will show image.jpg normally, it's only uploaded faster. If /image.jpg.gz does not exists, it will upload /image.jpg (which will of course be slower than the .gz version).
Rene
12 November 2009, 17:57
Sorry, that is unfortunately not correct.

See in Source hiawatha.c line 962:
switch (is_directory(session->file_on_disk)) {
[...]
// normaly file ?
case no:
if ((session->request_method != PUT) && (session->host->enable_path_info)) {
if ((result = get_path_info(session)) != 200) {
return result;
}
}
break;

case not_found:
if (session->request_method == DELETE) {
return 404;
} else if (session->request_method != PUT) {
if (session->host->use_gz_file) {
if ((search = get_headerfield("Accept-Encoding:", session->headerfields)) != NULL) {
if ((strstr(search, "gzip")) != NULL) {
session->accept_gzip = true;
}
}
}
}
}

After the file was not found, hiawatha search for an .gz-File.
Rene
12 November 2009, 17:59

When i start my Browser with www.my_domain.de, after that i make a stat() to index.html and index.html.gz :
File: index.html
Access: 2009-11-12 17:36:50.000000000 +0100
File: index.html.gz
Access: 2009-11-12 17:17:40.000000000 +0100

Hiawatha has send index.html. I have tested my configuration with http://web-sniffer.net . Tests with http://web-sniffer.net gives the same results. Sorry, can you please test my Observations?

Rene
Rene
12 November 2009, 18:02
Here is my hiawatha.conf:

http://textsnip.com/e798a6

by
Hugo Leisink
12 November 2009, 20:11
Hmm, it looks like you're right. It seems that over time code changes has changed the desired behaviour. It will be fixed in 6.18. Thanks.
Ben
15 November 2009, 21:27
My question about UseGZfile was deleted.

Where does Hiawatha store these gz-files? Does Hiawatha need write-access to every folder then?
Hugo Leisink
15 November 2009, 21:29
Since you posted your question twice, I deleted one.

Hiawatha doesn't create GZIP files. You have to create them. Read the EXTRA paragraph in the manual page to understand how it works.
Ben
15 November 2009, 21:40
Hm, not working for me.

1) I cant create a gz-File for every file
2) Even I use GZip in PHP it still says "No GZip compression active"
3) I set the variable as described, created index.htm and index.htm.gz

Whatever I do it never says compression active.

We save a lot of traffic by using GZip. If its not working as expected, thats very critical.
Ben
15 November 2009, 22:03
Maybe you should think of an alternative way of implementing GZip, at least as an option.

On the fly encoding is better than a quite uncomfortable handling (manual creation of archives).
This topic has been closed.