jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <Antony.Bowes...@williamhill.com.au>
Subject RE: Sending cookies to non origin domains
Date Fri, 02 Jun 2017 05:32:53 GMT
I do this

        cookieManager.setImplementation(HC4CookieHandler.class.getName());
        cookieManager.setCookiePolicy("standard");
        cookieManager.testStarted();

I see that I BasicDomainHandler.domainMatch() will support wildcarding, so I have currently
solved it by fooling the Cookie into thinking the domain was specified

Cookie.setDomainSpecified(true)

And then trimming of the upper part of the domain.



 
> -----Original Message-----
> From: Philippe Mouawad [mailto:philippe.mouawad@gmail.com]
> Sent: Friday, 2 June 2017 3:10 PM
> To: JMeter Users List
> Subject: Re: Sending cookies to non origin domains
> 
> Hello,
> What policy are you using for Cookie Manager ?
> Thanks
> 
> On Friday, June 2, 2017, Antony Bowesman
> <Antony.Bowesman@williamhill.com.au>
> wrote:
> 
> > All my samplers are Java samplers, so I am pretty much doing what you
> > suggest in my code, but I worked out that the BasicDomainHandler, used
> > by the CookieSpec handler, will allow the Cookie if I post process the
> > set-cookie and change the provided domain from api.xxx to just xxx and
> > set the domanSpecified to true
> >
> >             c.setDomain("xxx");
> >             c.setDomainSpecified(true);
> >
> > Thanks
> >
> >
> > > -----Original Message-----
> > > From: 易, [mailto:sc.yiwei@gmail.com <javascript:;>]
> > > Sent: Friday, 2 June 2017 12:09 PM
> > > To: JMeter Users List
> > > Subject: Re: Sending cookies to non origin domains
> > >
> > > You can add "JSR223 PostProcessor" as the child of your sampler.
> > > Then put the following code in the script, now you can change the
> > > domain of all
> > your
> > > cookies to the new domain.
> > >
> > > import org.apache.jmeter.protocol.http.control.CookieManager;
> > > import org.apache.jmeter.protocol.http.control.Cookie;
> > >
> > > CookieManager manager = sampler.getCookieManager(); int count =
> > > manager.getCookieCount(); for(int i=0;i<count;i++){ Cookie cookie =
> > > manager.get(i); cookie.setDomain(vars.get("domain"));
> > > }
> > >
> > > 2017-06-02 6:57 GMT+08:00 Antony Bowesman <
> > > Antony.Bowesman@williamhill.com.au <javascript:;>>:
> > >
> > > > Hi,
> > > >
> > > > I am using JMeter 3.1, HttpClient4 and HC4CookieHandler and after
> > > > login am getting .ASPXAUTH cookies sent to me for domain
> > > >
> > > > api.xxx
> > > >
> > > > Our real clients are then sending those cookies back to
> > > >
> > > > services.xxx
> > > >
> > > > which then talks to api.xxx and of course forwards the cookies.
> > > >
> > > > However, jmeter is (correctly) not sending the cookie from api.xxx
> > > > back to services.xxx, so when the request goes internally to
> > > > api.xxx that thinks I am not logged in.
> > > >
> > > > Is there any way I can get JMeter to send those cookies back to
> > > > the non originating domain?
> > > >
> > > > Cheers
> > > > Antony
> > > >
> > > >
> > >
> > >
> > > --
> > > Best Regards
> > >
> > > Wei
> >
> 
> 
> --
> Cordialement.
> Philippe Mouawad.
Mime
View raw message