Author: jfclere Date: Wed Jul 4 07:29:19 2007 New Revision: 553218 URL: http://svn.apache.org/viewvc?view=rev&rev=553218 Log: Arrange the handling of cookies values.
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java?view=diff&rev=553218&r1=553217&r2=553218 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/http/Cookies.java Wed Jul 4 07:29:19 2007 @@ -250,8 +250,10 @@ cc=bytes[pos]; if( cc== '\'' || cc=='"' ) { - startValue++; - endValue=indexOf( bytes, startValue, end, cc ); + endValue=findDelim3( bytes, startValue+1, end, cc ); + if (endValue == -1) { + endValue=findDelim2( bytes, startValue+1, end ); + } else startValue++; pos=endValue+1; // to skip to next cookie } else { endValue=findDelim2( bytes, startValue, end ); @@ -335,28 +337,27 @@ return off; } - public static int indexOf( byte bytes[], int off, int end, byte qq ) + /* + * search for cc but skip \cc as required by rfc2616 + * (according to rfc2616 cc should be ") + */ + public static int findDelim3( byte bytes[], int off, int end, byte cc ) { + byte prev = bytes[off]; while( off < end ) { byte b=bytes[off]; - if( b==qq ) + if ( b== '\\' ) { + off++; + off++; + continue; + } + if( b==cc ) return off; off++; } - return off; + return -1; } - public static int indexOf( byte bytes[], int off, int end, char qq ) - { - while( off < end ) { - byte b=bytes[off]; - if( b==qq ) - return off; - off++; - } - return off; - } - // XXX will be refactored soon! public static boolean equals( String s, byte b[], int start, int end) { int blen = end-start; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]