I've wrapped the cookie creation in a try/catch to avoid having the
Exception kill the request. I also added some logging in the catch to log
the original cookie header string. Maybe I'll be able to find out what's
going on...

This is patched against the 3.2.3 final source.

Thanks,
--jeff

--- RequestUtil.java.orig       Thu Aug  9 14:18:33 2001
+++ RequestUtil.java    Thu Aug  9 14:31:31 2001
@@ -184,10 +184,23 @@
                     
                     String name = token.substring(0, i).trim();
                     String value = token.substring(i+1, token.length()).trim();
-                   // RFC 2109 and bug 
-                   value=stripQuote( value );
-                    Cookie cookie = new Cookie(name, value);
-                    cookies.addElement(cookie);
+                    // RFC 2109 and bug 
+                    value=stripQuote( value );
+
+                    // Wrap the cookie creation in a try/catch to prevent bad
+                    // cookie names from killing the request -- Bug #1141
+                    try {
+                        Cookie cookie = new Cookie(name, value);
+                        cookies.addElement(cookie);
+                    }
+                    catch ( java.lang.IllegalArgumentException iae ) {
+                        
+                        // Log the original cookie header string, so we
+                        // can see what is causing this
+                        System.err.println(iae.getMessage() + "\n" +
+                                           "Cookie Header: " + cookieString);
+                    }
+
                 } else {
                     // we have a bad cookie.... just let it go
                 }

Reply via email to