Re: Problem cookies values with double quote

"Wolfgang Fahl" <[email protected]> Thu, 20 Aug 2009 14:04:58 +0200
Newsgroups gmane.comp.web.httpunit.devel
Organization BITPlan GmbH
Message-ID <[email protected]>
Dear Mario,

thank you for pointing this problem out.
http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=1046

has a new TestCase, which I had to disable since it 
indeed does not run.
 /***
     * test for double quoted cookies suggested by Mario V
     * disabled since it indeed fails - FIXME - we need a patch here
     * @throws Exception
     */
    public void xtestDoubleQuoteCookies() throws Exception {
        CookieJar jar = new CookieJar(
                new TestSource( new URL( "http://www.meterware.com" ),
                                new String[] { "NewUniversalCookie=\"mmmmmmmmmmmmmmm==mmmmmmm mmmmmmm\"; Path=/"} ) );
        Collection cookies = jar.getCookies();        
        assertTrue("There should only be one cookie but there are "+cookies.size(),cookies.size()==1);
        assertEquals( "cookie 'NewUniversalCookie' value", "mmmmmmmmmmmmmmm==mmmmmmm mmmmmmm", jar.getCookieValue( "NewUniversalCookie" ) );
    }


A patch for this problem would be much appreciated.
The parser in CookieJar.java would have to be improved 
for this.

Yours
  Wolfgang
> 
> Hi,
> 
> I use httpunit to receive response with cookies, I must receive two 
> cookies but httpunit divide in three.
> This special behavior occurs when i use GlassFish Server, in WAS6 no 
> pass. When the cookie has == a white space, GlassFish puts double quote 
> in NewUniversalCookie, in the begin and at the end.
> 
> HttpUnit receive this response
> 
> Response Headers Value
> (Status-Line) HTTP/1.1 200 OK
> X-Powered-By Servlet/2.5
> Server Sun GlassFish Enterprise Server v2.1
> Set-
> CookieUniversalCookie=a0775c7168f6a91a69874c7587a4#1239806798590#3600
> 000#U2FsdGVkX18zzhi1qcuSkfug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREX
> fDsO8TsM-
> rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0f
> jY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==; Path=/
> Set-CookieNewUniversalCookie="mmmmmmmmmmmmmmm==mmmmmmm mmmmmmm"; 
> Path=/
> Content-Type text/html; charset=iso-8859-1
> Transfer-Encoding chunked
> Date Thu, 16 Apr 2009 13:49:25 GMT
> 
> But when I trace the result.
> 
> header[0]: CONTENT-TYPE : text/html; charset=iso-8859-1
> header[1]: TRANSFER-ENCODING : chunked
> header[2]: SERVER : Sun GlassFish Enterprise Server v2.1
> header[3]: X-POWERED-BY : Servlet/2.5
> header[4]: DATE : Thu, 16 Apr 2009 13:49:25 GMT
> header[5]: SET-COOKIE : 
> UniversalCookie=a0775c7168f6a91a69874c7587a4#1239806798590#3600000#U2Fsd
> GVkX18zzhi1qcuSkfug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREXfDsO8TsM-
> rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0f
> jY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==; Path=/
> cookie[0]: UniversalCookie : 
> a0775c7168f6a91a69874c7587a4#1239806798590#3600000#U2FsdGVkX18zzhi1qcuSk
> fug0hwqix7iEPw0tIEX3LXp1BSvhTufTMrFw1bdzw3+BREXfDsO8TsM-
> rTR9YLtX+4LXZ+CQBcTc6mOfu4MTlGYHZSrLVYNfp8kW/SNBKDSYbf4xuPkABmIz/xJHez0f
> jY3u-+oZqatr4BCEZyGUX0kN0R3nCxMkqug==
> cookie[1]: mmmmmmmmmmmmmmm : =mmmmmmm mmmmmmm
> cookie[2]: NewUniversalCookie :
> 
> NewUniversalCookie has value null and HttpUnit create a new cookie 
> mmmmmmmmmmmmmmm with value =mmmmmmm mmmmmmm
> 
> There are some form to use double quote in cookies with HttpUnit.
> 
> 
> Thanks.
> 



BITPlan - smart solutions
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: http://www.bitplan.de
bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, 
Geschäftsführer: Wolfgang Fahl

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop