jsdever     2002/11/27 16:21:14

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        Cookie.java
               httpclient/src/test/org/apache/commons/httpclient
                        TestCookie.java
  Log:
  Fixes cookie domain matching being case sesnitive.
  
  Contributed by: Oleg Kalnichevski
  
  Revision  Changes    Path
  1.26      +7 -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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Cookie.java       27 Nov 2002 01:32:34 -0000      1.25
  +++ Cookie.java       28 Nov 2002 00:21:14 -0000      1.26
  @@ -785,6 +785,9 @@
               throw new IllegalArgumentException("set-cookie header may not be 
null.");
           }
   
  +        // Normalize domain name
  +        domain = domain.toLowerCase();
  +
           /* Build the default path.  Per RFC 2109/4.3.1 this is the 
            * request path up to, but not including, the right-most / charater.
            */
  
  
  
  1.13      +23 -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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestCookie.java   27 Nov 2002 01:32:34 -0000      1.12
  +++ TestCookie.java   28 Nov 2002 00:21:14 -0000      1.13
  @@ -80,6 +80,7 @@
    * @author dIon Gillard
    * @author <a href="mailto:[EMAIL PROTECTED]";>John Evans</a>
    * @author Marc A. Saegesser
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Oleg Kalnichevski</a>
    * @version $Revision$
    */
   public class TestCookie extends TestCase {
  @@ -681,9 +682,27 @@
       }
       
       
  +    /**
  +     * Tests default constructor.
  +     */
       public void testDefaultConsttuctor() throws Exception {
           Cookie dummy = new Cookie();
           assertEquals( dummy.toExternalForm(), "noname=null" );
  +    }
  +
  +    /**
  +     * Tests whether domain attribute check is case-insensitive.
  +     */
  +    public void testDomainCaseInsensitivity() {
  +        Header setCookie = new Header(
  +          "Set-Cookie", "name=value; domain=.sybase.com; path=/");
  +        try {
  +            Cookie[] parsed = Cookie.parse("www.Sybase.com", "/", false, setCookie 
);
  +        }
  +        catch(HttpException e) {
  +            e.printStackTrace();
  +            fail("Unexpected exception: " + e.toString());
  +        }
       }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to