billbarker 2004/08/20 19:51:37
Modified: http11/src/java/org/apache/coyote/http11
Http11Processor.java
Log:
Check that the browser actually sent a user-agent header before using it.
Fix for Bug #30770
Reported By: Elmar Haneke [EMAIL PROTECTED]
Revision Changes Path
1.104 +15 -11
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
Index: Http11Processor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- Http11Processor.java 12 Aug 2004 21:46:41 -0000 1.103
+++ Http11Processor.java 21 Aug 2004 02:51:37 -0000 1.104
@@ -1154,12 +1154,14 @@
request.getMimeHeaders().getValue("user-agent");
// Check in the restricted list, and adjust the http11
// and keepAlive flags accordingly
- String userAgentValue = userAgentValueMB.toString();
- for (int i = 0; i < restrictedUserAgents.length; i++) {
- if (restrictedUserAgents[i].match(userAgentValue)) {
- http11 = false;
- keepAlive = false;
- break;
+ if(userAgentValueMB != null) {
+ String userAgentValue = userAgentValueMB.toString();
+ for (int i = 0; i < restrictedUserAgents.length; i++) {
+ if (restrictedUserAgents[i].match(userAgentValue)) {
+ http11 = false;
+ keepAlive = false;
+ break;
+ }
}
}
}
@@ -1376,12 +1378,14 @@
if (noCompressionUserAgents != null) {
MessageBytes userAgentValueMB =
request.getMimeHeaders().getValue("user-agent");
- String userAgentValue = userAgentValueMB.toString();
+ if(userAgentValueMB != null) {
+ String userAgentValue = userAgentValueMB.toString();
- // If one Regexp rule match, disable compression
- for (int i = 0; i < noCompressionUserAgents.length; i++)
- if (noCompressionUserAgents[i].match(userAgentValue))
- return false;
+ // If one Regexp rule match, disable compression
+ for (int i = 0; i < noCompressionUserAgents.length; i++)
+ if (noCompressionUserAgents[i].match(userAgentValue))
+ return false;
+ }
}
// Check if suffisant len to trig the compression
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]