tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r558127 - in /tomcat/trunk/java/org/apache: catalina/valves/ErrorReportValve.java tomcat/util/http/ServerCookie.java
Date Fri, 20 Jul 2007 20:44:09 GMT
Author: fhanik
Date: Fri Jul 20 13:44:08 2007
New Revision: 558127

URL: http://svn.apache.org/viewvc?view=rev&rev=558127
Log:
synch from 6.0

http://svn.apache.org/viewvc?view=rev&rev=543307
http://svn.apache.org/viewvc?view=rev&rev=553410


Modified:
    tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
    tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java

Modified: tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java?view=diff&rev=558127&r1=558126&r2=558127
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java Fri Jul 20 13:44:08
2007
@@ -104,7 +104,7 @@
         Throwable throwable =
             (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR);
 
-        if (response.isAppCommitted()) {
+        if (response.isCommitted()) {
             return;
         }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java?view=diff&rev=558127&r1=558126&r2=558127
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/ServerCookie.java Fri Jul 20 13:44:08 2007
@@ -130,6 +130,7 @@
     //
     // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
     private static final String tspecials = ",; ";
+    private static final String tspecials2 = ",; \"";
 
     /*
      * Tests a string and returns true if the string counts as a
@@ -154,6 +155,19 @@
 	return true;
     }
 
+    public static boolean isToken2(String value) {
+	if( value==null) return true;
+	int len = value.length();
+
+	for (int i = 0; i < len; i++) {
+	    char c = value.charAt(i);
+
+	    if (c < 0x20 || c >= 0x7f || tspecials2.indexOf(c) != -1)
+		return false;
+	}
+	return true;
+    }
+
     public static boolean checkName( String name ) {
 	if (!isToken(name)
 		|| name.equalsIgnoreCase("Comment")	// rfc2019
@@ -213,7 +227,7 @@
         // this part is the same for all cookies
 	buf.append( name );
         buf.append("=");
-        maybeQuote(version, buf, value);
+        maybeQuote2(version, buf, value);
 
 	// XXX Netscape cookie: "; "
  	// add version 1 specific information
@@ -283,6 +297,17 @@
             buf.append('"');
         }
     }
+    public static void maybeQuote2 (int version, StringBuffer buf,
+            String value) {
+        // special case - a \n or \r  shouldn't happen in any case
+        if (isToken2(value)) {
+            buf.append(value);
+        } else {
+            buf.append('"');
+            buf.append(escapeDoubleQuotes(value));
+            buf.append('"');
+        }
+    }
 
     // log
     static final int dbg=1;
@@ -306,12 +331,14 @@
         }
 
         StringBuffer b = new StringBuffer();
+        char p = s.charAt(0);
         for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);
-            if (c == '"')
+            if (c == '"' && p != '\\')
                 b.append('\\').append('"');
             else
                 b.append(c);
+            p = c;
         }
 
         return b.toString();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message