Remy Maucherat a écrit :
Henri Gomez wrote:
Hi to all,
What about using regexp in HTTP 1.1 connector to include/exclude browser which could/couldn't use gzip compression ?
May be it could be use also to drop to HTTP 1.0 browser which claims to be 1.1 compatible, but are not.
CF: Apache HTTPD server
Well, I thought regexp was rather slow in Java, so it could be a problem if using a generic regexp library.
You could find attached a patch to make use of regexp in HTTP 1.1.
It check via jakarta-regexp which browser should be exclude from gzip but also from HTTP 1.1 (even if they claim to be compatible).
(regexp is also used in some valves)
With such add-on we mimic what HTTP teams does in Apache 2.0 via BrowserMatch.
Nota their approach may be better since BrowserMatch set some properties like :
nokeepalive, downgrade-1.0, force-response-1.0, nogzip....
Something which may be nice to implements (may we could use attributes or notes ?)
You should note that if no restrictedUserAgents or noCompressionUserAgents are set in HTTP connector settings, there is no check done, so no performance penalty.
There is case where it should be done so better have provision for....
+0 if disabled by default; -1 otherwise.
All this stuff is inefficient, as it uses Strings. Ie, we take the byte array we have for the header value, convert it to a String, and then regexp will likely convert it to something else to work with it (likely a char array). This is bad, obviously :-(
I don't know if the JDK 1.4 stuff can work with bytes, but in any case, the benchmarks seem a lot faster.
So we need a simple byte-based regexp :) (sort of like the mapper)
Remy
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]