commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/test/org/apache/commons/httpclient TestCookie.java
Date Wed, 01 May 2002 07:07:51 GMT
rwaldhoff    02/05/01 00:07:50

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        Cookie.java
               httpclient/src/test/org/apache/commons/httpclient
                        TestCookie.java
  Log:
  fix bugzilla bug 5279: single quotes around cookie's expires attribute
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5279
  
  Revision  Changes    Path
  1.18      +13 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java
  
  Index: Cookie.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Cookie.java	23 Apr 2002 18:59:47 -0000	1.17
  +++ Cookie.java	1 May 2002 07:07:50 -0000	1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v
1.17 2002/04/23 18:59:47 marcsaeg Exp $
  - * $Revision: 1.17 $
  - * $Date: 2002/04/23 18:59:47 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Cookie.java,v
1.18 2002/05/01 07:07:50 rwaldhoff Exp $
  + * $Revision: 1.18 $
  + * $Date: 2002/05/01 07:07:50 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -90,7 +90,7 @@
    * @author Sean C. Sullivan
    * @author <a href="mailto:JEvans@Cyveillance.com">John Evans</a>
    * @author Marc A. Saegesser
  - * @version $Revision: 1.17 $ $Date: 2002/04/23 18:59:47 $
  + * @version $Revision: 1.18 $ $Date: 2002/05/01 07:07:50 $
    */
   
   public class Cookie extends NameValuePair implements Serializable, Comparator {
  @@ -836,6 +836,15 @@
                       } else if (name.equals("expires")) {
                           boolean set = false;
                           String expiryDate = parameters[j].getValue();
  +                        // trim single quotes around expiry if present
  +                        // see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5279
  +                        if(null != expiryDate) {
  +                            if(expiryDate.length() > 1 &&
  +                                    expiryDate.startsWith("'") &&
  +                                    expiryDate.endsWith("'")) {
  +                                expiryDate = expiryDate.substring(1,expiryDate.length()-1);
  +                            }
  +                        }
                           for(int k=0;k<expiryFormats.length;k++) {
                               try {
                                   Date date = expiryFormats[k].parse(expiryDate);
  
  
  
  1.10      +14 -4     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java
  
  Index: TestCookie.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestCookie.java	23 Apr 2002 19:01:03 -0000	1.9
  +++ TestCookie.java	1 May 2002 07:07:50 -0000	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
1.9 2002/04/23 19:01:03 marcsaeg Exp $
  - * $Revision: 1.9 $
  - * $Date: 2002/04/23 19:01:03 $
  + * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestCookie.java,v
1.10 2002/05/01 07:07:50 rwaldhoff Exp $
  + * $Revision: 1.10 $
  + * $Date: 2002/05/01 07:07:50 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -80,7 +80,7 @@
    * @author dIon Gillard
    * @author <a href="mailto:JEvans@Cyveillance.com">John Evans</a>
    * @author Marc A. Saegesser
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class TestCookie extends TestCase {
   
  @@ -184,6 +184,16 @@
       }
   
       // ------------------------------------------------------------- More Tests
  +
  +    // see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5279
  +    public void testQuotedExpiresAttribute() throws Exception {
  +        String headerValue = "custno=12345;Expires='Thu, 01-Jan-2070 00:00:10 GMT'";
  +        Cookie[] cookies = Cookie.parse(DOMAIN_NAME,"/",true,new Header(
  +            "set-cookie", headerValue));
  +        assertNotNull("Expected some cookies",cookies);
  +        assertEquals("Expected 1 cookie",1,cookies.length);
  +        assertNotNull("Expected cookie to have getExpiryDate",cookies[0].getExpiryDate());
  +    }
   
       public void testSecurityError() throws Exception {
           String headerValue = "custno=12345;comment=test; version=1," +
  
  
  

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


Mime
View raw message