You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2003/05/26 19:58:03 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie CookieSpecBase.java RFC2109Spec.java

olegk       2003/05/26 10:58:03

  Modified:    httpclient/src/java/org/apache/commons/httpclient/cookie
                        CookieSpecBase.java RFC2109Spec.java
  Log:
  Bug fix #20240 (Cookies with null path attribute are rejected in the compatibility mode)
  
  Reviewed by Mike Becke
  Contributed by Oleg Kalnichevski
  
  Revision  Changes    Path
  1.15      +5 -10     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/CookieSpecBase.java
  
  Index: CookieSpecBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/CookieSpecBase.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CookieSpecBase.java	17 Apr 2003 03:00:31 -0000	1.14
  +++ CookieSpecBase.java	26 May 2003 17:58:03 -0000	1.15
  @@ -278,13 +278,8 @@
   
           if (paramName.equals("path")) {
   
  -            if (paramValue == null) {
  -                throw new MalformedCookieException(
  -                    "Missing value for path attribute");
  -            }
  -            if (paramValue.trim().equals("")) {
  -                throw new MalformedCookieException(
  -                    "Blank value for path attribute");
  +            if ((paramValue == null) || (paramValue.trim().equals(""))) {
  +                paramValue = "/";
               }
               cookie.setPath(paramValue);
               cookie.setPathAttributeSpecified(true);
  
  
  
  1.14      +16 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/RFC2109Spec.java
  
  Index: RFC2109Spec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/cookie/RFC2109Spec.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RFC2109Spec.java	7 Mar 2003 18:23:46 -0000	1.13
  +++ RFC2109Spec.java	26 May 2003 17:58:03 -0000	1.14
  @@ -113,7 +113,19 @@
           final String paramName = attribute.getName().toLowerCase();
           final String paramValue = attribute.getValue();
   
  -        if (paramName.equals("version")) {
  +        if (paramName.equals("path")) {
  +            if (paramValue == null) {
  +                throw new MalformedCookieException(
  +                    "Missing value for path attribute");
  +            }
  +            if (paramValue.trim().equals("")) {
  +                throw new MalformedCookieException(
  +                    "Blank value for path attribute");
  +            }
  +            cookie.setPath(paramValue);
  +            cookie.setPathAttributeSpecified(true);
  +        }
  +        else if (paramName.equals("version")) {
   
               if (paramValue == null) {
                   throw new MalformedCookieException(
  
  
  

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