hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Exposing Cookie processing code
Date Mon, 30 May 2011 08:19:02 GMT
On Sun, 2011-05-29 at 23:11 +0100, sebb wrote:
> On 28 May 2011 17:36, Oleg Kalnichevski <olegk@apache.org> wrote:
> > On Fri, 2011-05-27 at 19:21 +0100, sebb wrote:
> >> I'm considering updating JMeter to use the cookie handling from HC4.
> >>
> >> At present it uses the Commons HC 3.1 code, in particular it relies on
> >> the method
> >>
> >> Cookie[] org.apache.commons.httpclient.cookie.CookieSpecBase.match(String
> >> host, int port, String path, boolean secure, Cookie[] cookies)
> >>
> >> which extracts the relevant cookies from the the cookies array and
> >> returns the matching cookies in path name order.
> >>
> >> There does not seem to be an equivalent method in HC4. As far as I can
> >> tell, the cookie match handling is only present in the method
> >>
> >> void org.apache.http.client.protocol.RequestAddCookies.process(HttpRequest
> >> request, HttpContext context)
> >>
> >> which is not particularly easy to use in isolation.
> >>
> >> For JMeter it would be useful if the code used to process the list of
> >> cookie heaqders could be extracted into a public method, for example:
> >>
> >> List<Header> getCookieHeaders(CookieStore cookieStore, CookieOrigin
> >> cookieOrigin, CookieSpec cookieSpec)
> >>
> >> This could then be used to generate the headers for the Java and HC3
> >> implementations.
> >>
> >> Thoughts?
> >>
> >
> > Hi Sebastian
> >
> > There is not really that much code and I suspect you might be better off
> > just coping to JMeter the bits you need.
> 
> Yes, I could do that, but if the code ever needed to be changed then
> it would have to be changed in two places...
> 

This works both ways. Changes in the external code can produce side
effects on your application. Code re-use is a double-edged sword. 

Oleg



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


Mime
View raw message