hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Dever <jsde...@sympatico.ca>
Subject Re: [PATCH] Cookie's domain attribute check turned out to be case sensitive
Date Sat, 30 Nov 2002 16:35:18 GMT
In other words, modify TestCookie.java so that it fails in your 
enviroment.  Edit the code block:

    /**
     * Tests whether domain attribute check is case-insensitive.
     */
    public void testDomainCaseInsensitivity() {
        Header setCookie = new Header(
          "Set-Cookie", "name=value; path=/; domain=.sybase.com");
        try {
            Cookie[] parsed = Cookie.parse("www.Sybase.com", "/", false, 
setCookie );
        }
        catch(HttpException e) {
            e.printStackTrace();
            fail("Unexpected exception: " + e.toString());
        }
    }

and then run "ant test-nohost".  Save the result output and post it back 
to the list.


Oleg Kalnichevski wrote:

>Adam,
>
>Due to some reason not quite clear to me value
>"http://www.TrySybase.com/" has been passed as a path of origin. That's
>wrong. It should have been "/"
>Unfortunately as I can't reproduce this problem here, I can't find out
>why the parse() method has gotten the wrong value as an input.
>
>Let's get better organized here. I assume you are familiar with JUnit.
>That's the test case I have used trying to reproduce the problem. Could
>you please tweak it so that the bug would show up?
>
>Cheers
>
>Oleg
>
>
>
>
>
>
>On Sat, 2002-11-30 at 14:42, Adam Jack wrote:
>  
>
>>With last night's gump drop (which I assume has the patches) I get this
>>error:
>>
>>org.apache.commons.httpclient.HttpException: Bad cookie header: illegal path
>>attribute "/". Path of origin: "http://www.TrySybase.com/"
>>        at org.apache.commons.httpclient.Cookie.validate(Cookie.java:1006)
>>        at org.apache.commons.httpclient.Cookie.parse(Cookie.java:940)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.processResponseHeaders(HttpMeth
>>odBase.java:1445)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.jav
>>a:1530)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.j
>>ava:2182)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:820
>>)
>>        at
>>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:455)
>>
>>regards
>>
>>Adam
>>-----Original Message-----
>>From: Kalnichevski, Oleg [mailto:oleg.kalnichevski@bearingpoint.com]
>>Sent: Friday, November 29, 2002 12:31 PM
>>To: Commons HttpClient Project; ajack@trysybase.com
>>Subject: RE: [PATCH] Cookie's domain attribute check turned out to be
>>case sensitive
>>
>>
>>Adam, give it a shot with a new patch. I have changed the parse method quite
>>a bit. If the problem persists, just let me know. 
>>
>>What I can see from the logs you have attached is that the server does not
>>explicitly specifies cookie's version attribute. The new Httpclient should
>>handle this kind of situations better
>>
>>Oleg
>>
>>-----Original Message-----
>>From: Adam Jack [mailto:ajack@TrySybase.com]
>>Sent: Friday, November 29, 2002 7:40 PM
>>To: 'Commons HttpClient Project'
>>Subject: RE: [PATCH] Cookie's domain attribute check turned out to be
>>case sensitive
>>
>>
>>JSD wrote:
>>
>>    
>>
>>>Committed.  Thanks Oleg.
>>>Adam, please give a current build a shot.
>>>      
>>>
>>I've downloaded the build from:
>>
>>	http://gump.covalent.net/jars/latest/jakarta-commons/
>>
>>I tried yesterday (early whilst getting the Turkey up and to room
>>temperature for it's big day) and got the same result. Perhaps I was too
>>early.
>>
>>I tried again just now with last night's build. Although the result is
>>different (it no longer complaining about the domain attribute) it isn't as
>>I suspect is correct (see below.) Now it complains about "different path".
>>
>>Thanks for your efforts.
>>
>>regards
>>
>>Adam
>>
>>----------------------------------------------------------------------------
>>----------------------
>>
>>org.apache.commons.httpclient.HttpException: Bad Set-Cookie header:
>>sID=172.20.2.225.1038594731743097; path=/; domain=.TrySybase.com,
>>sID=172.20.2.225.1038594731743097; path=/; domain=.TrySybase.com Header
>>targets a different path, found "/" for "http://www.TrySybase.com/"
>>        at org.apache.commons.httpclient.Cookie.parse(Cookie.java:1016)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.processResponseHeaders(HttpMeth
>>odBase.java:1445)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.jav
>>a:1530)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.j
>>ava:2182)
>>        at
>>org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:820
>>)
>>        at
>>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:455)
>>        at com.trysybase.net.robot.Robot.performTask(Robot.java:186)
>>        at com.trysybase.net.robot.Robot.perform(Robot.java:100)
>>        at com.trysybase.net.robot.Robot.main(Robot.java:403)
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail:
>><mailto:commons-httpclient-dev-help@jakarta.apache.org>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail:
>><mailto:commons-httpclient-dev-help@jakarta.apache.org>
>>
>>______________________________________________________________________
>>
>>--
>>To unsubscribe, e-mail:   <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:commons-httpclient-dev-help@jakarta.apache.org>
>>    
>>
>>------------------------------------------------------------------------
>>
>>package org.apache.commons.httpclient;
>>
>>import junit.framework.TestCase;
>>import org.apache.commons.httpclient.methods.*;
>>
>>public class TestSybaseSite extends TestCase
>>{
>>    public TestSybaseSite(String s)
>>    {
>>        super(s);
>>    }
>>    
>>    
>>    public void testTrySybaseCookie()
>>    {
>>
>>        HttpClient client = new HttpClient();
>>        client.startSession("www.TrySybase.com", 80);
>>        GetMethod method = new GetMethod("/");
>>        method.setUseDisk(false);
>>        try {
>>            client.executeMethod(method);
>>        } catch (Exception e) {
>>            e.printStackTrace();
>>            fail("Unexpected exception: " + e.toString());
>>        }
>>        assertEquals("Response: ", method.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
>>    }
>>}
>>
>>    
>>
>>------------------------------------------------------------------------
>>
>>--
>>To unsubscribe, e-mail:   <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:commons-httpclient-dev-help@jakarta.apache.org>
>>


Mime
View raw message