Duzayak, 'Set-Cookie' (request) header is not the same thing as the 'Cookie' (response) header. CookieSpec#formatCookieHeader() method produces a 'Set-Cookie' (request) header, whereas CookieSpec#parse() method is intended to parse 'Cookie' (response) headers
I hope this clarifies things a bit Oleg -----Original Message----- From: Cabbar Duzayak [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 13:47 To: Commons HttpClient Project Subject: Cookie Bug? Hi, I am trying to run the following code for www.google.com: Cookie cookie = initialState.getCookies()[0]; CookieSpec cs = CookiePolicy.getDefaultSpec(); Header h = cs.formatCookieHeader(cookie); Cookie[] cookie2 = cs.parse(cookie.getDomain(), 80, cookie.getPath(), cookie.getSecure(), h); And, it is throwing an exception as: "org.apache.commons.httpclient.cookie.MalformedCookieException: Cookie name may not start with $" It looks like h.getValue returns name with $ sign (which was indeed created by the cookiespec), but the same cookiespec can not read this back, because it has a $ sign??? BTW, h.getValue() is: $Version=0; PREF=ID=069e080d47cd4332:TM=1084362072:LM=1084362072:S=0u9G4CTYGPvhxJzn; $Domain=.google.com; $Path=/ Looks like, cookieSpec.parse is expecting the same string without $ signs, in fact, when I remove dollar signs manually, the code works fine. Did I hit the jackpot and found a bug;) Thanks... __________________________________ Do you Yahoo!? Yahoo! Movies - Buy advance tickets for 'Shrek 2' http://movies.yahoo.com/showtimes/movie?mid=1808405861 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *************************************************************************************************** The information in this email is confidential and may be legally privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system. *************************************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]