Martin Jonsson wrote: >browser compression capabilities. The size of the protocol cache should >also be reduced a bit since entries are stored in the compressed form >(memory is cheap these days, but anyways ... ;) )
If I can cache four times as many entries in the same GB of RAM, compression is still a win, even when memory is cheap. >listening filesystem anyways. There will still be an option to enable >compression of dynamic requests, though. Great. Thanks. The implementation looks rather good. Excellent work. Maybe one minor fixup: commit 79323f6cd3d734c9e4f6884417e3e322689cfb0b Author: Stephen R. van den Berg <[email protected]> Date: Thu Jan 29 08:54:10 2009 +0100 Make sure compression works on Windows as well diff --git a/server/protocols/http.pike b/server/protocols/http.pike index 929f672..9163e4b 100644 --- a/server/protocols/http.pike +++ b/server/protocols/http.pike @@ -1995,18 +1995,18 @@ Thread.Local gzfileobj = Thread.Local(); private string gzip_data(string data) { - Stdio.FakeFile f = Stdio.FakeFile("", "w"); + Stdio.FakeFile f = Stdio.FakeFile("", "wb"); // Reuse the Gz.File object to reduce the overhead of instantiating // Gz.deflate objects etc. Gz.File gzfile = gzfileobj->get(); if(!gzfile) { - gzfile = Gz.File(f, "w"); + gzfile = Gz.File(f, "wb"); gzfile->setparams(conf->query("http_compression_level"), Gz.DEFAULT_STRATEGY); gzfileobj->set(gzfile); } else { - gzfile->open(f, "w"); + gzfile->open(f, "wb"); } gzfile->write(data); @@ -2017,16 +2017,16 @@ private string gzip_data(string data) private string gunzip_data(string data) { - Stdio.FakeFile f = Stdio.FakeFile(data, "r"); + Stdio.FakeFile f = Stdio.FakeFile(data, "rb"); Gz.File gzfile = gzfileobj->get(); if(!gzfile) { - gzfile = Gz.File(f, "r"); + gzfile = Gz.File(f, "rb"); gzfile->setparams(conf->query("http_compression_level"), Gz.DEFAULT_STRATEGY); gzfileobj->set(gzfile); } else { - gzfile->open(f, "r"); + gzfile->open(f, "rb"); } string res = gzfile->read(); -- Sincerely, Stephen R. van den Berg. "If you make people think they're thinking, they'll love you; but if you really make them think, they'll hate you."
