hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Johnson <sjohn...@mercury.com>
Subject RE: Set-Cookie: filtering on the path= verses URL path
Date Mon, 23 Aug 2004 22:53:10 GMT
Hi Oleg,

We will pursue (3), as we do not use auto redirect.
We have considered overriding the HttpMethodBase. addCookieRequestHeader(HttpState state,
HttpConnection conn)
with simpler matching logic, but hopefully not. 

Thanks for your quick help,
Steve

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Monday, August 23, 2004 3:54 PM
To: Commons HttpClient Project
Subject: Re: Set-Cookie: filtering on the path= verses URL path

Steve,
The cookie with the path attribute "/insight" may certainly not be sent
to a url starting with "/insightreporting". So, HttpClient's behavior is
correct.

You can pursue one of three options to work the problem around.

(1) If you do not mind using ALPHA software you can consider using
HttpClient 3.0alpha1, which supports pluggable cookie policies
(2) Fork HttpClient 2.0.1 and tweak its cookie policy(ies) to your
liking
(3) Disable automatic redirect, execute the first GET, iterate through
the cookies in the HTTP state prior to executing the subsequent
requests, find the session cookie and replace its path attribute

Hope this helps,

Oleg


On Mon, 2004-08-23 at 22:54, Steve Johnson wrote:
> Hi All,
>  
> We have a URL that works in IE and Netscape, but the cookie is not getting sent
> from HTTPClient.
>  
> Here is the URL and the Set-Cookie
>  
> https://was4.hewitt.com/insightreporting/reports/websitemonitoring
> <https://was4.hewitt.com/insightreporting/reports/websitemonitoring> 
>  
> response header has this:
>  
> Set-Cookie: JSESSIONID=0000CQL00NOE2OHVJFC5I3I5YRQ:v0c153k7;Path=/insight
>  
> The cookie path fails this logic in CookieSpecBase.java
>  
>     /**
>      * Performs a path-match slightly smarter than a straight-forward startsWith
>      * check.
>      * @param path The path to check.
>      * @param topmostPath The path to check against.
>      * @return true if the paths match
>      */
>     private static boolean pathMatch(
>         final String path, final String topmostPath) {
>             
>         boolean match = path.startsWith (topmostPath);     // Our example passes this
>         
>         // if there is a match and these values are not exactly the same we have
>         // to make sure we're not matcing "/foobar" and "/foo"
>         if (match && path.length() != topmostPath.length()) {
>             if (!topmostPath.endsWith(PATH_DELIM)) {
>                 match = (path.charAt(topmostPath.length()) == PATH_DELIM_CHAR);  // Our
example fails this,
we
> want /foobar to match /foo
>             }
>         }
>         return match;
>     }
>  
> Is there a way to bypass this pathMatch() or specify another one?
>  
> Thanks,
> Steve
>  
> Steve Johnson
> Software Engineer
> Mercury Interactive
> 720 564 - 6532
> USA, Canada and the Americas 
> 720 564-6620
> Hours: M-F 08:00-17:00 MST (Mountain Standard Time) 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  <http://www.mercuryinteractive.com> http://www.mercuryinteractive.com
> Looking for Answers to your SiteScope or SiteSeer questions?        <http://support.mercuryinteractive.com>
> http://support.mercuryinteractive.com
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  
> 
> 


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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message