You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Artem Fedorov <ar...@blazemeter.com> on 2018/08/21 12:57:54 UTC

JMeter send double requests when configure proxy with authentication

HI All

I configure HTTP Request that use proxy with authentication

In proxy log I can see, that JMeter *always send 2 requests*:  (I used
`squid` in tests)

1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> http://blazedemo.com/ - HIER_NONE/- text/html
> 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html


The first request JMeter send without authentication options, because this
options are create after server got a response with 401/407 code.

In performance test I'll see the following log: (50 % of all requests are
send without authentication options) - IMO this is incorrect load of proxy
server or we lose a lot of time for create authentication scheme for each
request

- TCP_DENIED/407 (without proxy authentication)
- TCP_MISS/200 (with proxy authentication)
- TCP_DENIED/407 (without proxy authentication)
- TCP_MISS/200 (with proxy authentication)
- TCP_DENIED/407 (without proxy authentication)
- TCP_MISS/200 (with proxy authentication)
....

The first request (the response for this request) use by httpclient for
detect Standard authentication type (Basic/Digest/NTLM/SPNEGO/Kerberos). I
think If we have not dynamic proxy we can *reuse* knowledges about
authentication type in the second and subsequent requests.
After such changes we will see the following log:

- TCP_DENIED/407 (without proxy authentication)
- TCP_MISS/200 (with proxy authentication)
- TCP_MISS/200 (with proxy authentication)
- TCP_MISS/200 (with proxy authentication)
....

What do you think about such changes? If all is OK I can contribute the fix


Thanks,
Artem

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Bossu <pb...@gmail.com>.
Hello Artem,
On what version of JMeter are you seing this ?

Thanks

On Tuesday, August 21, 2018, Artem Fedorov <ar...@blazemeter.com>
wrote:

> HI All
>
> I configure HTTP Request that use proxy with authentication
>
> In proxy log I can see, that JMeter *always send 2 requests*:  (I used
> `squid` in tests)
>
> 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > http://blazedemo.com/ - HIER_NONE/- text/html
> > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
>
>
> The first request JMeter send without authentication options, because this
> options are create after server got a response with 401/407 code.
>
> In performance test I'll see the following log: (50 % of all requests are
> send without authentication options) - IMO this is incorrect load of proxy
> server or we lose a lot of time for create authentication scheme for each
> request
>
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> ....
>
> The first request (the response for this request) use by httpclient for
> detect Standard authentication type (Basic/Digest/NTLM/SPNEGO/Kerberos). I
> think If we have not dynamic proxy we can *reuse* knowledges about
> authentication type in the second and subsequent requests.
> After such changes we will see the following log:
>
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> ....
>
> What do you think about such changes? If all is OK I can contribute the fix
>
>
> Thanks,
> Artem
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Artem Fedorov <ar...@blazemeter.com>.
Hi Philippe

I added simple test to my PR

Artem

On Wed, Sep 19, 2018 at 9:42 PM Philippe Mouawad <ph...@gmail.com>
wrote:

> Hello Artem,
> At minimum, we should have a JMX Test plan that allows testing all
> combinations of an authentication using httpbin.org for example and some
> java library that could play the role of a proxy, I see the following cases
> but feel free to complete:
>
>    - No proxy set
>    - Global Proxy set at JMeter level
>    - Proxy set in HTTP Request Defaults
>    - Proxy set only on request
>
> We should have 2 threads (to check ), 2 iterations and 3 requests (the one
> we are concerned about in the middle)
>
> Regarding JUnit, unless  we externalize this particular piece of code into
> a custom class, it looks to me hard to do that but if you have an idea ...
>
> Regards
>
> On Wed, Sep 19, 2018 at 5:23 PM Artem Fedorov <
> artem.fedorov@blazemeter.com>
> wrote:
>
> > Hi Philippe
> >
> > I have very simple use case
> > I configure squid proxy with authentication and I have jmx Test Plan that
> > makes 3 HTTP Request.
> >
> > I attached jmx file and access log from squid.
> >
> > Is there any ways for create a JUnit test with the same scenario?
> > Also I want to remove !isDynamicProxy(getProxyHost(),
> getProxyPortInt())) from
> > this condition
> > <
> https://github.com/apache/jmeter/blob/387271deb6f5b310fa4f8672f65948ab6049ed90/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L694
> >,
> > because it always false, when proxy config was specified.
> >
> > Thanks,
> > Artem
> >
> >
> > On Sun, Sep 16, 2018 at 9:53 PM, Philippe Mouawad <
> > philippe.mouawad@gmail.com> wrote:
> >
> >> Thanks for last PR update.
> >> We'll merge it once 5.0 is released;
> >>
> >> But before, could you describe the use case met that made you see this
> >> issue ?
> >> Is the a possibility to provide  a JMX Test plan that could be used as
> >> integration test ? and if possible a JUnit test ?
> >>
> >> Thanks
> >>
> >> On Sat, Sep 1, 2018 at 4:02 PM Philippe Mouawad <
> >> philippe.mouawad@gmail.com>
> >> wrote:
> >>
> >> > Hello,
> >> > Thanks for latest updates of PR.
> >> > 1/ I would not use Object but AuthState instead.
> >> >
> >> > 2/ Shouldn't we use HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY and
> >> > store AuthState there (transforming Pair to Triple)?
> >> >
> >> > This would be the case for a Thread representing a Virtual User.
> >> > But it would not be correct if a thread is not a Virtual User
> >> >
> >> >
> >> > Regards
> >> >
> >> > On Wed, Aug 29, 2018 at 11:14 AM Artem Fedorov <
> >> > artem.fedorov@blazemeter.com> wrote:
> >> >
> >> >> Fixed.
> >> >>
> >> >> Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have
> >> doubts:
> >> >>
> >> >> - minimal number of authstate, that we should store = Number of
> >> Requests
> >> >> in
> >> >> Test Plan. (each request can use own proxy). Does the AuthState is
> >> Thread
> >> >> Safe and we can share it between threads? I think no and it'll better
> >> to
> >> >> store Number of Requests in Plan * Number of Threads AuthStates.
> >> >>
> >> >> - Also in case if we use dynamic proxy we can not reuse saved
> >> AuthState:
> >> >>
> >> >> >  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
> >> >> >    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE,
> >> proxy);
> >> >> >  }
> >> >>
> >> >> Artem
> >> >>
> >> >> On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
> >> >> philippe.mouawad@gmail.com> wrote:
> >> >>
> >> >> > Thank you Artem,
> >> >> >
> >> >> > I made a little comment on PR.
> >> >> >
> >> >> > Just to be sure I understand the PR:
> >> >> >
> >> >> >    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used
> if
> >> >> >    updated
> >> >> >
> >> >> > But is it correct to store it as:
> >> >> >
> >> >> >    - "http.auth.proxy-scope" + this
> >> >> >
> >> >> > Because we'll end per Thread with :
> >> >> >
> >> >> >    - Number of Requests in Plan * Number of Threads AuthStates
> >> >> >
> >> >> > Regards
> >> >> >
> >> >> >
> >> >> > On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
> >> >> > artem.fedorov@blazemeter.com>
> >> >> > wrote:
> >> >> >
> >> >> > > Hi Philippe
> >> >> > >
> >> >> > > https://github.com/apache/jmeter/pull/397
> >> >> > >
> >> >> > > Let's discuss the details in the PR
> >> >> > >
> >> >> > > Thanks,
> >> >> > > Artem
> >> >> > >
> >> >> > > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
> >> >> > > philippe.mouawad@gmail.com> wrote:
> >> >> > >
> >> >> > > > Hello Artem,
> >> >> > > > Go ahead and propose a patch or PR.
> >> >> > > > It will be a clearer base to discuss.
> >> >> > > >
> >> >> > > > Thank you
> >> >> > > >
> >> >> > > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> >> >> > > > artem.fedorov@blazemeter.com>
> >> >> > > > wrote:
> >> >> > > >
> >> >> > > > > I work with the latest JMeter version from github
> >> >> > > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> >> >> > > > >
> >> >> > > > > I create a Thread Group with 1 loop and 1 user. This Thread
> >> Group
> >> >> > > > contains
> >> >> > > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
> >> >> > > > >
> >> >> > > > > Configuration of HTTP Sampler:
> >> >> > > > >
> >> >> > > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> >> >> > > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
> >> >> > enabled="true">
> >> >> > > > > >           <elementProp name="HTTPsampler.Arguments"
> >> >> > > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> >> >> > > > > testclass="Arguments"
> >> >> > > > > > testname="User Defined Variables" enabled="true">
> >> >> > > > > >             <collectionProp name="Arguments.arguments"/>
> >> >> > > > > >           </elementProp>
> >> >> > > > > >           <stringProp
> name="HTTPSampler.domain"></stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.port"></stringProp>
> >> >> > > > > >           <stringProp
> >> name="HTTPSampler.protocol"></stringProp>
> >> >> > > > > >           <stringProp
> >> >> > > name="HTTPSampler.contentEncoding"></stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.path">
> >> >> http://blazedemo.com
> >> >> > > > > > </stringProp>
> >> >> > > > > >           <stringProp
> >> name="HTTPSampler.method">GET</stringProp>
> >> >> > > > > >           <boolProp name="HTTPSampler.follow_
> >> >> > > > redirects">true</boolProp>
> >> >> > > > > >           <boolProp
> >> >> > > name="HTTPSampler.auto_redirects">false</boolProp>
> >> >> > > > > >           <boolProp name="HTTPSampler.use_
> >> >> > keepalive">true</boolProp>
> >> >> > > > > >           <boolProp
> >> name="HTTPSampler.DO_MULTIPART_POST">false</
> >> >> > > > boolProp>
> >> >> > > > > >           <stringProp
> >> >> > > name="HTTPSampler.embedded_url_re"></stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.proxyHost">
> >> >> > > > localhost</stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.proxyPort">
> >> >> > 3321</stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.proxyUser">
> >> >> > artem</stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.proxyPass">
> >> >> > artem</stringProp>
> >> >> > > > > >           <stringProp
> >> >> > > name="HTTPSampler.connect_timeout"></stringProp>
> >> >> > > > > >           <stringProp name="HTTPSampler.response_
> >> >> > > > timeout"></stringProp>
> >> >> > > > > >         </HTTPSamplerProxy>
> >> >> > > > >
> >> >> > > > >
> >> >> > > > > When I run this Test Plan I see 1 sample in the View Results
> >> Tree,
> >> >> > but
> >> >> > > in
> >> >> > > > > the access.log of squid I see 2 request from JMeter.
> >> >> > > > >
> >> >> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> >> >> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> >> >> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> >> >> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
> >> text/html
> >> >> > > > >
> >> >> > > > >
> >> >> > > > > So, in real test each Sampler will send 2 requests:
> >> >> > > > > - 1st without authentication data (and will receive 407 http
> >> >> response
> >> >> > > > code)
> >> >> > > > >  - TCP_DENIED/407
> >> >> > > > > - 2nd with authentication data(username/password/type) - will
> >> be a
> >> >> > > > success
> >> >> > > > > - TCP_MISS/200
> >> >> > > > >
> >> >> > > > > JMeter (httpclient) send 1st request for detect
> authentication
> >> >> type
> >> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> >> >> > > > > If we will have 2 loops the JMeter will send 4 requests, 3
> >> loops
> >> >> = 6
> >> >> > > > > requests etc. I would like to reduce number of request to the
> >> >> proxy
> >> >> > > > server
> >> >> > > > > and make request for detect authentication type once at the
> >> start
> >> >> of
> >> >> > > the
> >> >> > > > > loop
> >> >> > > > >
> >> >> > > > > Artem
> >> >> > > > >
> >> >> > > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> >> >> > > > > p.mouawad@ubik-ingenierie.com> wrote:
> >> >> > > > >
> >> >> > > > > > Hello Artem,
> >> >> > > > > > I am not sure to understand.
> >> >> > > > > >
> >> >> > > > > > Can you clarify with an example or reformulating what you
> >> mean
> >> >> by
> >> >> > > HTTP
> >> >> > > > > > Request that use proxy with authentication.
> >> >> > > > > >
> >> >> > > > > > and also clarify what’s after that, it’s really not clear
> for
> >> >> me.
> >> >> > > > > >
> >> >> > > > > > Thank you
> >> >> > > > > >
> >> >> > > > > > On Tuesday, August 21, 2018, Artem Fedorov <
> >> >> > > > artem.fedorov@blazemeter.com
> >> >> > > > > >
> >> >> > > > > > wrote:
> >> >> > > > > >
> >> >> > > > > > > HI All
> >> >> > > > > > >
> >> >> > > > > > > I configure HTTP Request that use proxy with
> authentication
> >> >> > > > > > >
> >> >> > > > > > > In proxy log I can see, that JMeter *always send 2
> >> >> requests*:  (I
> >> >> > > > used
> >> >> > > > > > > `squid` in tests)
> >> >> > > > > > >
> >> >> > > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> >> >> > > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> >> >> > > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> >> >> > > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
> >> >> text/html
> >> >> > > > > > >
> >> >> > > > > > >
> >> >> > > > > > > The first request JMeter send without authentication
> >> options,
> >> >> > > because
> >> >> > > > > > this
> >> >> > > > > > > options are create after server got a response with
> 401/407
> >> >> code.
> >> >> > > > > > >
> >> >> > > > > > > In performance test I'll see the following log: (50 % of
> >> all
> >> >> > > requests
> >> >> > > > > are
> >> >> > > > > > > send without authentication options) - IMO this is
> >> incorrect
> >> >> load
> >> >> > > of
> >> >> > > > > > proxy
> >> >> > > > > > > server or we lose a lot of time for create authentication
> >> >> scheme
> >> >> > > for
> >> >> > > > > each
> >> >> > > > > > > request
> >> >> > > > > > >
> >> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > ....
> >> >> > > > > > >
> >> >> > > > > > > The first request (the response for this request) use by
> >> >> > httpclient
> >> >> > > > for
> >> >> > > > > > > detect Standard authentication type
> >> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> >> >> > > > > > I
> >> >> > > > > > > think If we have not dynamic proxy we can *reuse*
> >> knowledges
> >> >> > about
> >> >> > > > > > > authentication type in the second and subsequent
> requests.
> >> >> > > > > > > After such changes we will see the following log:
> >> >> > > > > > >
> >> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> >> > > > > > > ....
> >> >> > > > > > >
> >> >> > > > > > > What do you think about such changes? If all is OK I can
> >> >> > contribute
> >> >> > > > the
> >> >> > > > > > fix
> >> >> > > > > > >
> >> >> > > > > > >
> >> >> > > > > > > Thanks,
> >> >> > > > > > > Artem
> >> >> > > > > > >
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > > --
> >> >> > > > > > Cordialement.
> >> >> > > > > > Philippe Mouawad.
> >> >> > > > > > Ubik-Ingénierie
> >> >> > > > > >
> >> >> > > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> >> >> > > > > >
> >> >> > > > > > UBIK LOAD PACK on TWITTER <
> https://twitter.com/ubikloadpack>
> >> >> > > > > >
> >> >> > > > >
> >> >> > > >
> >> >> > > >
> >> >> > > > --
> >> >> > > > Cordialement.
> >> >> > > > Philippe Mouawad.
> >> >> > > >
> >> >> > >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cordialement.
> >> >> > Philippe Mouawad.
> >> >> >
> >> >>
> >> >
> >> >
> >> > --
> >> > Cordialement.
> >> > Philippe Mouawad.
> >> >
> >> >
> >> >
> >>
> >> --
> >> Cordialement.
> >> Philippe Mouawad.
> >>
> >
> >
>
> --
> Cordialement.
> Philippe Mouawad.
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello Artem,
At minimum, we should have a JMX Test plan that allows testing all
combinations of an authentication using httpbin.org for example and some
java library that could play the role of a proxy, I see the following cases
but feel free to complete:

   - No proxy set
   - Global Proxy set at JMeter level
   - Proxy set in HTTP Request Defaults
   - Proxy set only on request

We should have 2 threads (to check ), 2 iterations and 3 requests (the one
we are concerned about in the middle)

Regarding JUnit, unless  we externalize this particular piece of code into
a custom class, it looks to me hard to do that but if you have an idea ...

Regards

On Wed, Sep 19, 2018 at 5:23 PM Artem Fedorov <ar...@blazemeter.com>
wrote:

> Hi Philippe
>
> I have very simple use case
> I configure squid proxy with authentication and I have jmx Test Plan that
> makes 3 HTTP Request.
>
> I attached jmx file and access log from squid.
>
> Is there any ways for create a JUnit test with the same scenario?
> Also I want to remove !isDynamicProxy(getProxyHost(), getProxyPortInt())) from
> this condition
> <https://github.com/apache/jmeter/blob/387271deb6f5b310fa4f8672f65948ab6049ed90/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L694>,
> because it always false, when proxy config was specified.
>
> Thanks,
> Artem
>
>
> On Sun, Sep 16, 2018 at 9:53 PM, Philippe Mouawad <
> philippe.mouawad@gmail.com> wrote:
>
>> Thanks for last PR update.
>> We'll merge it once 5.0 is released;
>>
>> But before, could you describe the use case met that made you see this
>> issue ?
>> Is the a possibility to provide  a JMX Test plan that could be used as
>> integration test ? and if possible a JUnit test ?
>>
>> Thanks
>>
>> On Sat, Sep 1, 2018 at 4:02 PM Philippe Mouawad <
>> philippe.mouawad@gmail.com>
>> wrote:
>>
>> > Hello,
>> > Thanks for latest updates of PR.
>> > 1/ I would not use Object but AuthState instead.
>> >
>> > 2/ Shouldn't we use HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY and
>> > store AuthState there (transforming Pair to Triple)?
>> >
>> > This would be the case for a Thread representing a Virtual User.
>> > But it would not be correct if a thread is not a Virtual User
>> >
>> >
>> > Regards
>> >
>> > On Wed, Aug 29, 2018 at 11:14 AM Artem Fedorov <
>> > artem.fedorov@blazemeter.com> wrote:
>> >
>> >> Fixed.
>> >>
>> >> Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have
>> doubts:
>> >>
>> >> - minimal number of authstate, that we should store = Number of
>> Requests
>> >> in
>> >> Test Plan. (each request can use own proxy). Does the AuthState is
>> Thread
>> >> Safe and we can share it between threads? I think no and it'll better
>> to
>> >> store Number of Requests in Plan * Number of Threads AuthStates.
>> >>
>> >> - Also in case if we use dynamic proxy we can not reuse saved
>> AuthState:
>> >>
>> >> >  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
>> >> >    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE,
>> proxy);
>> >> >  }
>> >>
>> >> Artem
>> >>
>> >> On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
>> >> philippe.mouawad@gmail.com> wrote:
>> >>
>> >> > Thank you Artem,
>> >> >
>> >> > I made a little comment on PR.
>> >> >
>> >> > Just to be sure I understand the PR:
>> >> >
>> >> >    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
>> >> >    updated
>> >> >
>> >> > But is it correct to store it as:
>> >> >
>> >> >    - "http.auth.proxy-scope" + this
>> >> >
>> >> > Because we'll end per Thread with :
>> >> >
>> >> >    - Number of Requests in Plan * Number of Threads AuthStates
>> >> >
>> >> > Regards
>> >> >
>> >> >
>> >> > On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
>> >> > artem.fedorov@blazemeter.com>
>> >> > wrote:
>> >> >
>> >> > > Hi Philippe
>> >> > >
>> >> > > https://github.com/apache/jmeter/pull/397
>> >> > >
>> >> > > Let's discuss the details in the PR
>> >> > >
>> >> > > Thanks,
>> >> > > Artem
>> >> > >
>> >> > > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
>> >> > > philippe.mouawad@gmail.com> wrote:
>> >> > >
>> >> > > > Hello Artem,
>> >> > > > Go ahead and propose a patch or PR.
>> >> > > > It will be a clearer base to discuss.
>> >> > > >
>> >> > > > Thank you
>> >> > > >
>> >> > > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
>> >> > > > artem.fedorov@blazemeter.com>
>> >> > > > wrote:
>> >> > > >
>> >> > > > > I work with the latest JMeter version from github
>> >> > > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
>> >> > > > >
>> >> > > > > I create a Thread Group with 1 loop and 1 user. This Thread
>> Group
>> >> > > > contains
>> >> > > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
>> >> > > > >
>> >> > > > > Configuration of HTTP Sampler:
>> >> > > > >
>> >> > > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
>> >> > > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
>> >> > enabled="true">
>> >> > > > > >           <elementProp name="HTTPsampler.Arguments"
>> >> > > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
>> >> > > > > testclass="Arguments"
>> >> > > > > > testname="User Defined Variables" enabled="true">
>> >> > > > > >             <collectionProp name="Arguments.arguments"/>
>> >> > > > > >           </elementProp>
>> >> > > > > >           <stringProp name="HTTPSampler.domain"></stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.port"></stringProp>
>> >> > > > > >           <stringProp
>> name="HTTPSampler.protocol"></stringProp>
>> >> > > > > >           <stringProp
>> >> > > name="HTTPSampler.contentEncoding"></stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.path">
>> >> http://blazedemo.com
>> >> > > > > > </stringProp>
>> >> > > > > >           <stringProp
>> name="HTTPSampler.method">GET</stringProp>
>> >> > > > > >           <boolProp name="HTTPSampler.follow_
>> >> > > > redirects">true</boolProp>
>> >> > > > > >           <boolProp
>> >> > > name="HTTPSampler.auto_redirects">false</boolProp>
>> >> > > > > >           <boolProp name="HTTPSampler.use_
>> >> > keepalive">true</boolProp>
>> >> > > > > >           <boolProp
>> name="HTTPSampler.DO_MULTIPART_POST">false</
>> >> > > > boolProp>
>> >> > > > > >           <stringProp
>> >> > > name="HTTPSampler.embedded_url_re"></stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.proxyHost">
>> >> > > > localhost</stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.proxyPort">
>> >> > 3321</stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.proxyUser">
>> >> > artem</stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.proxyPass">
>> >> > artem</stringProp>
>> >> > > > > >           <stringProp
>> >> > > name="HTTPSampler.connect_timeout"></stringProp>
>> >> > > > > >           <stringProp name="HTTPSampler.response_
>> >> > > > timeout"></stringProp>
>> >> > > > > >         </HTTPSamplerProxy>
>> >> > > > >
>> >> > > > >
>> >> > > > > When I run this Test Plan I see 1 sample in the View Results
>> Tree,
>> >> > but
>> >> > > in
>> >> > > > > the access.log of squid I see 2 request from JMeter.
>> >> > > > >
>> >> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
>> >> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
>> >> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
>> >> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
>> text/html
>> >> > > > >
>> >> > > > >
>> >> > > > > So, in real test each Sampler will send 2 requests:
>> >> > > > > - 1st without authentication data (and will receive 407 http
>> >> response
>> >> > > > code)
>> >> > > > >  - TCP_DENIED/407
>> >> > > > > - 2nd with authentication data(username/password/type) - will
>> be a
>> >> > > > success
>> >> > > > > - TCP_MISS/200
>> >> > > > >
>> >> > > > > JMeter (httpclient) send 1st request for detect authentication
>> >> type
>> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
>> >> > > > > If we will have 2 loops the JMeter will send 4 requests, 3
>> loops
>> >> = 6
>> >> > > > > requests etc. I would like to reduce number of request to the
>> >> proxy
>> >> > > > server
>> >> > > > > and make request for detect authentication type once at the
>> start
>> >> of
>> >> > > the
>> >> > > > > loop
>> >> > > > >
>> >> > > > > Artem
>> >> > > > >
>> >> > > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
>> >> > > > > p.mouawad@ubik-ingenierie.com> wrote:
>> >> > > > >
>> >> > > > > > Hello Artem,
>> >> > > > > > I am not sure to understand.
>> >> > > > > >
>> >> > > > > > Can you clarify with an example or reformulating what you
>> mean
>> >> by
>> >> > > HTTP
>> >> > > > > > Request that use proxy with authentication.
>> >> > > > > >
>> >> > > > > > and also clarify what’s after that, it’s really not clear for
>> >> me.
>> >> > > > > >
>> >> > > > > > Thank you
>> >> > > > > >
>> >> > > > > > On Tuesday, August 21, 2018, Artem Fedorov <
>> >> > > > artem.fedorov@blazemeter.com
>> >> > > > > >
>> >> > > > > > wrote:
>> >> > > > > >
>> >> > > > > > > HI All
>> >> > > > > > >
>> >> > > > > > > I configure HTTP Request that use proxy with authentication
>> >> > > > > > >
>> >> > > > > > > In proxy log I can see, that JMeter *always send 2
>> >> requests*:  (I
>> >> > > > used
>> >> > > > > > > `squid` in tests)
>> >> > > > > > >
>> >> > > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
>> >> > > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
>> >> > > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
>> >> > > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
>> >> text/html
>> >> > > > > > >
>> >> > > > > > >
>> >> > > > > > > The first request JMeter send without authentication
>> options,
>> >> > > because
>> >> > > > > > this
>> >> > > > > > > options are create after server got a response with 401/407
>> >> code.
>> >> > > > > > >
>> >> > > > > > > In performance test I'll see the following log: (50 % of
>> all
>> >> > > requests
>> >> > > > > are
>> >> > > > > > > send without authentication options) - IMO this is
>> incorrect
>> >> load
>> >> > > of
>> >> > > > > > proxy
>> >> > > > > > > server or we lose a lot of time for create authentication
>> >> scheme
>> >> > > for
>> >> > > > > each
>> >> > > > > > > request
>> >> > > > > > >
>> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > ....
>> >> > > > > > >
>> >> > > > > > > The first request (the response for this request) use by
>> >> > httpclient
>> >> > > > for
>> >> > > > > > > detect Standard authentication type
>> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
>> >> > > > > > I
>> >> > > > > > > think If we have not dynamic proxy we can *reuse*
>> knowledges
>> >> > about
>> >> > > > > > > authentication type in the second and subsequent requests.
>> >> > > > > > > After such changes we will see the following log:
>> >> > > > > > >
>> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> >> > > > > > > ....
>> >> > > > > > >
>> >> > > > > > > What do you think about such changes? If all is OK I can
>> >> > contribute
>> >> > > > the
>> >> > > > > > fix
>> >> > > > > > >
>> >> > > > > > >
>> >> > > > > > > Thanks,
>> >> > > > > > > Artem
>> >> > > > > > >
>> >> > > > > >
>> >> > > > > >
>> >> > > > > > --
>> >> > > > > > Cordialement.
>> >> > > > > > Philippe Mouawad.
>> >> > > > > > Ubik-Ingénierie
>> >> > > > > >
>> >> > > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
>> >> > > > > >
>> >> > > > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
>> >> > > > > >
>> >> > > > >
>> >> > > >
>> >> > > >
>> >> > > > --
>> >> > > > Cordialement.
>> >> > > > Philippe Mouawad.
>> >> > > >
>> >> > >
>> >> >
>> >> >
>> >> > --
>> >> > Cordialement.
>> >> > Philippe Mouawad.
>> >> >
>> >>
>> >
>> >
>> > --
>> > Cordialement.
>> > Philippe Mouawad.
>> >
>> >
>> >
>>
>> --
>> Cordialement.
>> Philippe Mouawad.
>>
>
>

-- 
Cordialement.
Philippe Mouawad.

Re: JMeter send double requests when configure proxy with authentication

Posted by Artem Fedorov <ar...@blazemeter.com>.
Hi Philippe

I have very simple use case
I configure squid proxy with authentication and I have jmx Test Plan that
makes 3 HTTP Request.

I attached jmx file and access log from squid.

Is there any ways for create a JUnit test with the same scenario?
Also I want to remove !isDynamicProxy(getProxyHost(), getProxyPortInt())) from
this condition
<https://github.com/apache/jmeter/blob/387271deb6f5b310fa4f8672f65948ab6049ed90/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java#L694>,
because it always false, when proxy config was specified.

Thanks,
Artem


On Sun, Sep 16, 2018 at 9:53 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Thanks for last PR update.
> We'll merge it once 5.0 is released;
>
> But before, could you describe the use case met that made you see this
> issue ?
> Is the a possibility to provide  a JMX Test plan that could be used as
> integration test ? and if possible a JUnit test ?
>
> Thanks
>
> On Sat, Sep 1, 2018 at 4:02 PM Philippe Mouawad <
> philippe.mouawad@gmail.com>
> wrote:
>
> > Hello,
> > Thanks for latest updates of PR.
> > 1/ I would not use Object but AuthState instead.
> >
> > 2/ Shouldn't we use HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY and
> > store AuthState there (transforming Pair to Triple)?
> >
> > This would be the case for a Thread representing a Virtual User.
> > But it would not be correct if a thread is not a Virtual User
> >
> >
> > Regards
> >
> > On Wed, Aug 29, 2018 at 11:14 AM Artem Fedorov <
> > artem.fedorov@blazemeter.com> wrote:
> >
> >> Fixed.
> >>
> >> Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have
> doubts:
> >>
> >> - minimal number of authstate, that we should store = Number of Requests
> >> in
> >> Test Plan. (each request can use own proxy). Does the AuthState is
> Thread
> >> Safe and we can share it between threads? I think no and it'll better to
> >> store Number of Requests in Plan * Number of Threads AuthStates.
> >>
> >> - Also in case if we use dynamic proxy we can not reuse saved AuthState:
> >>
> >> >  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
> >> >    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE,
> proxy);
> >> >  }
> >>
> >> Artem
> >>
> >> On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
> >> philippe.mouawad@gmail.com> wrote:
> >>
> >> > Thank you Artem,
> >> >
> >> > I made a little comment on PR.
> >> >
> >> > Just to be sure I understand the PR:
> >> >
> >> >    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
> >> >    updated
> >> >
> >> > But is it correct to store it as:
> >> >
> >> >    - "http.auth.proxy-scope" + this
> >> >
> >> > Because we'll end per Thread with :
> >> >
> >> >    - Number of Requests in Plan * Number of Threads AuthStates
> >> >
> >> > Regards
> >> >
> >> >
> >> > On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
> >> > artem.fedorov@blazemeter.com>
> >> > wrote:
> >> >
> >> > > Hi Philippe
> >> > >
> >> > > https://github.com/apache/jmeter/pull/397
> >> > >
> >> > > Let's discuss the details in the PR
> >> > >
> >> > > Thanks,
> >> > > Artem
> >> > >
> >> > > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
> >> > > philippe.mouawad@gmail.com> wrote:
> >> > >
> >> > > > Hello Artem,
> >> > > > Go ahead and propose a patch or PR.
> >> > > > It will be a clearer base to discuss.
> >> > > >
> >> > > > Thank you
> >> > > >
> >> > > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> >> > > > artem.fedorov@blazemeter.com>
> >> > > > wrote:
> >> > > >
> >> > > > > I work with the latest JMeter version from github
> >> > > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> >> > > > >
> >> > > > > I create a Thread Group with 1 loop and 1 user. This Thread
> Group
> >> > > > contains
> >> > > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
> >> > > > >
> >> > > > > Configuration of HTTP Sampler:
> >> > > > >
> >> > > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> >> > > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
> >> > enabled="true">
> >> > > > > >           <elementProp name="HTTPsampler.Arguments"
> >> > > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> >> > > > > testclass="Arguments"
> >> > > > > > testname="User Defined Variables" enabled="true">
> >> > > > > >             <collectionProp name="Arguments.arguments"/>
> >> > > > > >           </elementProp>
> >> > > > > >           <stringProp name="HTTPSampler.domain"></stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.port"></stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.protocol"></
> stringProp>
> >> > > > > >           <stringProp
> >> > > name="HTTPSampler.contentEncoding"></stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.path">
> >> http://blazedemo.com
> >> > > > > > </stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.method">GET<
> /stringProp>
> >> > > > > >           <boolProp name="HTTPSampler.follow_
> >> > > > redirects">true</boolProp>
> >> > > > > >           <boolProp
> >> > > name="HTTPSampler.auto_redirects">false</boolProp>
> >> > > > > >           <boolProp name="HTTPSampler.use_
> >> > keepalive">true</boolProp>
> >> > > > > >           <boolProp name="HTTPSampler.DO_
> MULTIPART_POST">false</
> >> > > > boolProp>
> >> > > > > >           <stringProp
> >> > > name="HTTPSampler.embedded_url_re"></stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.proxyHost">
> >> > > > localhost</stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.proxyPort">
> >> > 3321</stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.proxyUser">
> >> > artem</stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.proxyPass">
> >> > artem</stringProp>
> >> > > > > >           <stringProp
> >> > > name="HTTPSampler.connect_timeout"></stringProp>
> >> > > > > >           <stringProp name="HTTPSampler.response_
> >> > > > timeout"></stringProp>
> >> > > > > >         </HTTPSamplerProxy>
> >> > > > >
> >> > > > >
> >> > > > > When I run this Test Plan I see 1 sample in the View Results
> Tree,
> >> > but
> >> > > in
> >> > > > > the access.log of squid I see 2 request from JMeter.
> >> > > > >
> >> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> >> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> >> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> >> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
> text/html
> >> > > > >
> >> > > > >
> >> > > > > So, in real test each Sampler will send 2 requests:
> >> > > > > - 1st without authentication data (and will receive 407 http
> >> response
> >> > > > code)
> >> > > > >  - TCP_DENIED/407
> >> > > > > - 2nd with authentication data(username/password/type) - will
> be a
> >> > > > success
> >> > > > > - TCP_MISS/200
> >> > > > >
> >> > > > > JMeter (httpclient) send 1st request for detect authentication
> >> type
> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> >> > > > > If we will have 2 loops the JMeter will send 4 requests, 3 loops
> >> = 6
> >> > > > > requests etc. I would like to reduce number of request to the
> >> proxy
> >> > > > server
> >> > > > > and make request for detect authentication type once at the
> start
> >> of
> >> > > the
> >> > > > > loop
> >> > > > >
> >> > > > > Artem
> >> > > > >
> >> > > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> >> > > > > p.mouawad@ubik-ingenierie.com> wrote:
> >> > > > >
> >> > > > > > Hello Artem,
> >> > > > > > I am not sure to understand.
> >> > > > > >
> >> > > > > > Can you clarify with an example or reformulating what you mean
> >> by
> >> > > HTTP
> >> > > > > > Request that use proxy with authentication.
> >> > > > > >
> >> > > > > > and also clarify what’s after that, it’s really not clear for
> >> me.
> >> > > > > >
> >> > > > > > Thank you
> >> > > > > >
> >> > > > > > On Tuesday, August 21, 2018, Artem Fedorov <
> >> > > > artem.fedorov@blazemeter.com
> >> > > > > >
> >> > > > > > wrote:
> >> > > > > >
> >> > > > > > > HI All
> >> > > > > > >
> >> > > > > > > I configure HTTP Request that use proxy with authentication
> >> > > > > > >
> >> > > > > > > In proxy log I can see, that JMeter *always send 2
> >> requests*:  (I
> >> > > > used
> >> > > > > > > `squid` in tests)
> >> > > > > > >
> >> > > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> >> > > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> >> > > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> >> > > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
> >> text/html
> >> > > > > > >
> >> > > > > > >
> >> > > > > > > The first request JMeter send without authentication
> options,
> >> > > because
> >> > > > > > this
> >> > > > > > > options are create after server got a response with 401/407
> >> code.
> >> > > > > > >
> >> > > > > > > In performance test I'll see the following log: (50 % of all
> >> > > requests
> >> > > > > are
> >> > > > > > > send without authentication options) - IMO this is incorrect
> >> load
> >> > > of
> >> > > > > > proxy
> >> > > > > > > server or we lose a lot of time for create authentication
> >> scheme
> >> > > for
> >> > > > > each
> >> > > > > > > request
> >> > > > > > >
> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > ....
> >> > > > > > >
> >> > > > > > > The first request (the response for this request) use by
> >> > httpclient
> >> > > > for
> >> > > > > > > detect Standard authentication type
> >> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> >> > > > > > I
> >> > > > > > > think If we have not dynamic proxy we can *reuse* knowledges
> >> > about
> >> > > > > > > authentication type in the second and subsequent requests.
> >> > > > > > > After such changes we will see the following log:
> >> > > > > > >
> >> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > - TCP_MISS/200 (with proxy authentication)
> >> > > > > > > ....
> >> > > > > > >
> >> > > > > > > What do you think about such changes? If all is OK I can
> >> > contribute
> >> > > > the
> >> > > > > > fix
> >> > > > > > >
> >> > > > > > >
> >> > > > > > > Thanks,
> >> > > > > > > Artem
> >> > > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > --
> >> > > > > > Cordialement.
> >> > > > > > Philippe Mouawad.
> >> > > > > > Ubik-Ingénierie
> >> > > > > >
> >> > > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> >> > > > > >
> >> > > > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> >> > > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > Cordialement.
> >> > > > Philippe Mouawad.
> >> > > >
> >> > >
> >> >
> >> >
> >> > --
> >> > Cordialement.
> >> > Philippe Mouawad.
> >> >
> >>
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
> >
> >
> >
>
> --
> Cordialement.
> Philippe Mouawad.
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <ph...@gmail.com>.
Thanks for last PR update.
We'll merge it once 5.0 is released;

But before, could you describe the use case met that made you see this
issue ?
Is the a possibility to provide  a JMX Test plan that could be used as
integration test ? and if possible a JUnit test ?

Thanks

On Sat, Sep 1, 2018 at 4:02 PM Philippe Mouawad <ph...@gmail.com>
wrote:

> Hello,
> Thanks for latest updates of PR.
> 1/ I would not use Object but AuthState instead.
>
> 2/ Shouldn't we use HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY and
> store AuthState there (transforming Pair to Triple)?
>
> This would be the case for a Thread representing a Virtual User.
> But it would not be correct if a thread is not a Virtual User
>
>
> Regards
>
> On Wed, Aug 29, 2018 at 11:14 AM Artem Fedorov <
> artem.fedorov@blazemeter.com> wrote:
>
>> Fixed.
>>
>> Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have doubts:
>>
>> - minimal number of authstate, that we should store = Number of Requests
>> in
>> Test Plan. (each request can use own proxy). Does the AuthState is Thread
>> Safe and we can share it between threads? I think no and it'll better to
>> store Number of Requests in Plan * Number of Threads AuthStates.
>>
>> - Also in case if we use dynamic proxy we can not reuse saved AuthState:
>>
>> >  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
>> >    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxy);
>> >  }
>>
>> Artem
>>
>> On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
>> philippe.mouawad@gmail.com> wrote:
>>
>> > Thank you Artem,
>> >
>> > I made a little comment on PR.
>> >
>> > Just to be sure I understand the PR:
>> >
>> >    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
>> >    updated
>> >
>> > But is it correct to store it as:
>> >
>> >    - "http.auth.proxy-scope" + this
>> >
>> > Because we'll end per Thread with :
>> >
>> >    - Number of Requests in Plan * Number of Threads AuthStates
>> >
>> > Regards
>> >
>> >
>> > On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
>> > artem.fedorov@blazemeter.com>
>> > wrote:
>> >
>> > > Hi Philippe
>> > >
>> > > https://github.com/apache/jmeter/pull/397
>> > >
>> > > Let's discuss the details in the PR
>> > >
>> > > Thanks,
>> > > Artem
>> > >
>> > > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
>> > > philippe.mouawad@gmail.com> wrote:
>> > >
>> > > > Hello Artem,
>> > > > Go ahead and propose a patch or PR.
>> > > > It will be a clearer base to discuss.
>> > > >
>> > > > Thank you
>> > > >
>> > > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
>> > > > artem.fedorov@blazemeter.com>
>> > > > wrote:
>> > > >
>> > > > > I work with the latest JMeter version from github
>> > > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
>> > > > >
>> > > > > I create a Thread Group with 1 loop and 1 user. This Thread Group
>> > > > contains
>> > > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
>> > > > >
>> > > > > Configuration of HTTP Sampler:
>> > > > >
>> > > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
>> > > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
>> > enabled="true">
>> > > > > >           <elementProp name="HTTPsampler.Arguments"
>> > > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
>> > > > > testclass="Arguments"
>> > > > > > testname="User Defined Variables" enabled="true">
>> > > > > >             <collectionProp name="Arguments.arguments"/>
>> > > > > >           </elementProp>
>> > > > > >           <stringProp name="HTTPSampler.domain"></stringProp>
>> > > > > >           <stringProp name="HTTPSampler.port"></stringProp>
>> > > > > >           <stringProp name="HTTPSampler.protocol"></stringProp>
>> > > > > >           <stringProp
>> > > name="HTTPSampler.contentEncoding"></stringProp>
>> > > > > >           <stringProp name="HTTPSampler.path">
>> http://blazedemo.com
>> > > > > > </stringProp>
>> > > > > >           <stringProp name="HTTPSampler.method">GET</stringProp>
>> > > > > >           <boolProp name="HTTPSampler.follow_
>> > > > redirects">true</boolProp>
>> > > > > >           <boolProp
>> > > name="HTTPSampler.auto_redirects">false</boolProp>
>> > > > > >           <boolProp name="HTTPSampler.use_
>> > keepalive">true</boolProp>
>> > > > > >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</
>> > > > boolProp>
>> > > > > >           <stringProp
>> > > name="HTTPSampler.embedded_url_re"></stringProp>
>> > > > > >           <stringProp name="HTTPSampler.proxyHost">
>> > > > localhost</stringProp>
>> > > > > >           <stringProp name="HTTPSampler.proxyPort">
>> > 3321</stringProp>
>> > > > > >           <stringProp name="HTTPSampler.proxyUser">
>> > artem</stringProp>
>> > > > > >           <stringProp name="HTTPSampler.proxyPass">
>> > artem</stringProp>
>> > > > > >           <stringProp
>> > > name="HTTPSampler.connect_timeout"></stringProp>
>> > > > > >           <stringProp name="HTTPSampler.response_
>> > > > timeout"></stringProp>
>> > > > > >         </HTTPSamplerProxy>
>> > > > >
>> > > > >
>> > > > > When I run this Test Plan I see 1 sample in the View Results Tree,
>> > but
>> > > in
>> > > > > the access.log of squid I see 2 request from JMeter.
>> > > > >
>> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
>> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
>> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
>> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
>> > > > >
>> > > > >
>> > > > > So, in real test each Sampler will send 2 requests:
>> > > > > - 1st without authentication data (and will receive 407 http
>> response
>> > > > code)
>> > > > >  - TCP_DENIED/407
>> > > > > - 2nd with authentication data(username/password/type) - will be a
>> > > > success
>> > > > > - TCP_MISS/200
>> > > > >
>> > > > > JMeter (httpclient) send 1st request for detect authentication
>> type
>> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
>> > > > > If we will have 2 loops the JMeter will send 4 requests, 3 loops
>> = 6
>> > > > > requests etc. I would like to reduce number of request to the
>> proxy
>> > > > server
>> > > > > and make request for detect authentication type once at the start
>> of
>> > > the
>> > > > > loop
>> > > > >
>> > > > > Artem
>> > > > >
>> > > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
>> > > > > p.mouawad@ubik-ingenierie.com> wrote:
>> > > > >
>> > > > > > Hello Artem,
>> > > > > > I am not sure to understand.
>> > > > > >
>> > > > > > Can you clarify with an example or reformulating what you mean
>> by
>> > > HTTP
>> > > > > > Request that use proxy with authentication.
>> > > > > >
>> > > > > > and also clarify what’s after that, it’s really not clear for
>> me.
>> > > > > >
>> > > > > > Thank you
>> > > > > >
>> > > > > > On Tuesday, August 21, 2018, Artem Fedorov <
>> > > > artem.fedorov@blazemeter.com
>> > > > > >
>> > > > > > wrote:
>> > > > > >
>> > > > > > > HI All
>> > > > > > >
>> > > > > > > I configure HTTP Request that use proxy with authentication
>> > > > > > >
>> > > > > > > In proxy log I can see, that JMeter *always send 2
>> requests*:  (I
>> > > > used
>> > > > > > > `squid` in tests)
>> > > > > > >
>> > > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
>> > > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
>> > > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
>> > > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
>> text/html
>> > > > > > >
>> > > > > > >
>> > > > > > > The first request JMeter send without authentication options,
>> > > because
>> > > > > > this
>> > > > > > > options are create after server got a response with 401/407
>> code.
>> > > > > > >
>> > > > > > > In performance test I'll see the following log: (50 % of all
>> > > requests
>> > > > > are
>> > > > > > > send without authentication options) - IMO this is incorrect
>> load
>> > > of
>> > > > > > proxy
>> > > > > > > server or we lose a lot of time for create authentication
>> scheme
>> > > for
>> > > > > each
>> > > > > > > request
>> > > > > > >
>> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > ....
>> > > > > > >
>> > > > > > > The first request (the response for this request) use by
>> > httpclient
>> > > > for
>> > > > > > > detect Standard authentication type
>> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
>> > > > > > I
>> > > > > > > think If we have not dynamic proxy we can *reuse* knowledges
>> > about
>> > > > > > > authentication type in the second and subsequent requests.
>> > > > > > > After such changes we will see the following log:
>> > > > > > >
>> > > > > > > - TCP_DENIED/407 (without proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > - TCP_MISS/200 (with proxy authentication)
>> > > > > > > ....
>> > > > > > >
>> > > > > > > What do you think about such changes? If all is OK I can
>> > contribute
>> > > > the
>> > > > > > fix
>> > > > > > >
>> > > > > > >
>> > > > > > > Thanks,
>> > > > > > > Artem
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > > Cordialement.
>> > > > > > Philippe Mouawad.
>> > > > > > Ubik-Ingénierie
>> > > > > >
>> > > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
>> > > > > >
>> > > > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
>> > > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Cordialement.
>> > > > Philippe Mouawad.
>> > > >
>> > >
>> >
>> >
>> > --
>> > Cordialement.
>> > Philippe Mouawad.
>> >
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>
>
>

-- 
Cordialement.
Philippe Mouawad.

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello,
Thanks for latest updates of PR.
1/ I would not use Object but AuthState instead.

2/ Shouldn't we use HTTPCLIENTS_CACHE_PER_THREAD_AND_HTTPCLIENTKEY and
store AuthState there (transforming Pair to Triple)?

This would be the case for a Thread representing a Virtual User.
But it would not be correct if a thread is not a Virtual User


Regards

On Wed, Aug 29, 2018 at 11:14 AM Artem Fedorov <ar...@blazemeter.com>
wrote:

> Fixed.
>
> Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have doubts:
>
> - minimal number of authstate, that we should store = Number of Requests in
> Test Plan. (each request can use own proxy). Does the AuthState is Thread
> Safe and we can share it between threads? I think no and it'll better to
> store Number of Requests in Plan * Number of Threads AuthStates.
>
> - Also in case if we use dynamic proxy we can not reuse saved AuthState:
>
> >  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
> >    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxy);
> >  }
>
> Artem
>
> On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
> philippe.mouawad@gmail.com> wrote:
>
> > Thank you Artem,
> >
> > I made a little comment on PR.
> >
> > Just to be sure I understand the PR:
> >
> >    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
> >    updated
> >
> > But is it correct to store it as:
> >
> >    - "http.auth.proxy-scope" + this
> >
> > Because we'll end per Thread with :
> >
> >    - Number of Requests in Plan * Number of Threads AuthStates
> >
> > Regards
> >
> >
> > On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
> > artem.fedorov@blazemeter.com>
> > wrote:
> >
> > > Hi Philippe
> > >
> > > https://github.com/apache/jmeter/pull/397
> > >
> > > Let's discuss the details in the PR
> > >
> > > Thanks,
> > > Artem
> > >
> > > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
> > > philippe.mouawad@gmail.com> wrote:
> > >
> > > > Hello Artem,
> > > > Go ahead and propose a patch or PR.
> > > > It will be a clearer base to discuss.
> > > >
> > > > Thank you
> > > >
> > > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> > > > artem.fedorov@blazemeter.com>
> > > > wrote:
> > > >
> > > > > I work with the latest JMeter version from github
> > > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> > > > >
> > > > > I create a Thread Group with 1 loop and 1 user. This Thread Group
> > > > contains
> > > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
> > > > >
> > > > > Configuration of HTTP Sampler:
> > > > >
> > > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> > > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
> > enabled="true">
> > > > > >           <elementProp name="HTTPsampler.Arguments"
> > > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> > > > > testclass="Arguments"
> > > > > > testname="User Defined Variables" enabled="true">
> > > > > >             <collectionProp name="Arguments.arguments"/>
> > > > > >           </elementProp>
> > > > > >           <stringProp name="HTTPSampler.domain"></stringProp>
> > > > > >           <stringProp name="HTTPSampler.port"></stringProp>
> > > > > >           <stringProp name="HTTPSampler.protocol"></stringProp>
> > > > > >           <stringProp
> > > name="HTTPSampler.contentEncoding"></stringProp>
> > > > > >           <stringProp name="HTTPSampler.path">
> http://blazedemo.com
> > > > > > </stringProp>
> > > > > >           <stringProp name="HTTPSampler.method">GET</stringProp>
> > > > > >           <boolProp name="HTTPSampler.follow_
> > > > redirects">true</boolProp>
> > > > > >           <boolProp
> > > name="HTTPSampler.auto_redirects">false</boolProp>
> > > > > >           <boolProp name="HTTPSampler.use_
> > keepalive">true</boolProp>
> > > > > >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</
> > > > boolProp>
> > > > > >           <stringProp
> > > name="HTTPSampler.embedded_url_re"></stringProp>
> > > > > >           <stringProp name="HTTPSampler.proxyHost">
> > > > localhost</stringProp>
> > > > > >           <stringProp name="HTTPSampler.proxyPort">
> > 3321</stringProp>
> > > > > >           <stringProp name="HTTPSampler.proxyUser">
> > artem</stringProp>
> > > > > >           <stringProp name="HTTPSampler.proxyPass">
> > artem</stringProp>
> > > > > >           <stringProp
> > > name="HTTPSampler.connect_timeout"></stringProp>
> > > > > >           <stringProp name="HTTPSampler.response_
> > > > timeout"></stringProp>
> > > > > >         </HTTPSamplerProxy>
> > > > >
> > > > >
> > > > > When I run this Test Plan I see 1 sample in the View Results Tree,
> > but
> > > in
> > > > > the access.log of squid I see 2 request from JMeter.
> > > > >
> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > > > >
> > > > >
> > > > > So, in real test each Sampler will send 2 requests:
> > > > > - 1st without authentication data (and will receive 407 http
> response
> > > > code)
> > > > >  - TCP_DENIED/407
> > > > > - 2nd with authentication data(username/password/type) - will be a
> > > > success
> > > > > - TCP_MISS/200
> > > > >
> > > > > JMeter (httpclient) send 1st request for detect authentication type
> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> > > > > If we will have 2 loops the JMeter will send 4 requests, 3 loops =
> 6
> > > > > requests etc. I would like to reduce number of request to the proxy
> > > > server
> > > > > and make request for detect authentication type once at the start
> of
> > > the
> > > > > loop
> > > > >
> > > > > Artem
> > > > >
> > > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> > > > > p.mouawad@ubik-ingenierie.com> wrote:
> > > > >
> > > > > > Hello Artem,
> > > > > > I am not sure to understand.
> > > > > >
> > > > > > Can you clarify with an example or reformulating what you mean by
> > > HTTP
> > > > > > Request that use proxy with authentication.
> > > > > >
> > > > > > and also clarify what’s after that, it’s really not clear for me.
> > > > > >
> > > > > > Thank you
> > > > > >
> > > > > > On Tuesday, August 21, 2018, Artem Fedorov <
> > > > artem.fedorov@blazemeter.com
> > > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > HI All
> > > > > > >
> > > > > > > I configure HTTP Request that use proxy with authentication
> > > > > > >
> > > > > > > In proxy log I can see, that JMeter *always send 2 requests*:
> (I
> > > > used
> > > > > > > `squid` in tests)
> > > > > > >
> > > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97
> text/html
> > > > > > >
> > > > > > >
> > > > > > > The first request JMeter send without authentication options,
> > > because
> > > > > > this
> > > > > > > options are create after server got a response with 401/407
> code.
> > > > > > >
> > > > > > > In performance test I'll see the following log: (50 % of all
> > > requests
> > > > > are
> > > > > > > send without authentication options) - IMO this is incorrect
> load
> > > of
> > > > > > proxy
> > > > > > > server or we lose a lot of time for create authentication
> scheme
> > > for
> > > > > each
> > > > > > > request
> > > > > > >
> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > ....
> > > > > > >
> > > > > > > The first request (the response for this request) use by
> > httpclient
> > > > for
> > > > > > > detect Standard authentication type
> > > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> > > > > > I
> > > > > > > think If we have not dynamic proxy we can *reuse* knowledges
> > about
> > > > > > > authentication type in the second and subsequent requests.
> > > > > > > After such changes we will see the following log:
> > > > > > >
> > > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > > ....
> > > > > > >
> > > > > > > What do you think about such changes? If all is OK I can
> > contribute
> > > > the
> > > > > > fix
> > > > > > >
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Artem
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Cordialement.
> > > > > > Philippe Mouawad.
> > > > > > Ubik-Ingénierie
> > > > > >
> > > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> > > > > >
> > > > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Cordialement.
> > > > Philippe Mouawad.
> > > >
> > >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
> >
>


-- 
Cordialement.
Philippe Mouawad.

Re: JMeter send double requests when configure proxy with authentication

Posted by Artem Fedorov <ar...@blazemeter.com>.
Fixed.

Regarding (HttpClientContext.PROXY_AUTH_STATE + this) I also have doubts:

- minimal number of authstate, that we should store = Number of Requests in
Test Plan. (each request can use own proxy). Does the AuthState is Thread
Safe and we can share it between threads? I think no and it'll better to
store Number of Requests in Plan * Number of Threads AuthStates.

- Also in case if we use dynamic proxy we can not reuse saved AuthState:

>  if (!isDynamicProxy(getProxyHost(), getProxyPortInt())) {
>    localContext.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxy);
>  }

Artem

On Tue, Aug 28, 2018 at 11:46 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Thank you Artem,
>
> I made a little comment on PR.
>
> Just to be sure I understand the PR:
>
>    - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
>    updated
>
> But is it correct to store it as:
>
>    - "http.auth.proxy-scope" + this
>
> Because we'll end per Thread with :
>
>    - Number of Requests in Plan * Number of Threads AuthStates
>
> Regards
>
>
> On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <
> artem.fedorov@blazemeter.com>
> wrote:
>
> > Hi Philippe
> >
> > https://github.com/apache/jmeter/pull/397
> >
> > Let's discuss the details in the PR
> >
> > Thanks,
> > Artem
> >
> > On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
> > philippe.mouawad@gmail.com> wrote:
> >
> > > Hello Artem,
> > > Go ahead and propose a patch or PR.
> > > It will be a clearer base to discuss.
> > >
> > > Thank you
> > >
> > > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> > > artem.fedorov@blazemeter.com>
> > > wrote:
> > >
> > > > I work with the latest JMeter version from github
> > > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> > > >
> > > > I create a Thread Group with 1 loop and 1 user. This Thread Group
> > > contains
> > > > View Results Tree (Listener) and HTTP Resuest (Sampler)
> > > >
> > > > Configuration of HTTP Sampler:
> > > >
> > > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> > > > > testclass="HTTPSamplerProxy" testname="HTTP Request"
> enabled="true">
> > > > >           <elementProp name="HTTPsampler.Arguments"
> > > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> > > > testclass="Arguments"
> > > > > testname="User Defined Variables" enabled="true">
> > > > >             <collectionProp name="Arguments.arguments"/>
> > > > >           </elementProp>
> > > > >           <stringProp name="HTTPSampler.domain"></stringProp>
> > > > >           <stringProp name="HTTPSampler.port"></stringProp>
> > > > >           <stringProp name="HTTPSampler.protocol"></stringProp>
> > > > >           <stringProp
> > name="HTTPSampler.contentEncoding"></stringProp>
> > > > >           <stringProp name="HTTPSampler.path">http://blazedemo.com
> > > > > </stringProp>
> > > > >           <stringProp name="HTTPSampler.method">GET</stringProp>
> > > > >           <boolProp name="HTTPSampler.follow_
> > > redirects">true</boolProp>
> > > > >           <boolProp
> > name="HTTPSampler.auto_redirects">false</boolProp>
> > > > >           <boolProp name="HTTPSampler.use_
> keepalive">true</boolProp>
> > > > >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</
> > > boolProp>
> > > > >           <stringProp
> > name="HTTPSampler.embedded_url_re"></stringProp>
> > > > >           <stringProp name="HTTPSampler.proxyHost">
> > > localhost</stringProp>
> > > > >           <stringProp name="HTTPSampler.proxyPort">
> 3321</stringProp>
> > > > >           <stringProp name="HTTPSampler.proxyUser">
> artem</stringProp>
> > > > >           <stringProp name="HTTPSampler.proxyPass">
> artem</stringProp>
> > > > >           <stringProp
> > name="HTTPSampler.connect_timeout"></stringProp>
> > > > >           <stringProp name="HTTPSampler.response_
> > > timeout"></stringProp>
> > > > >         </HTTPSamplerProxy>
> > > >
> > > >
> > > > When I run this Test Plan I see 1 sample in the View Results Tree,
> but
> > in
> > > > the access.log of squid I see 2 request from JMeter.
> > > >
> > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > > >
> > > >
> > > > So, in real test each Sampler will send 2 requests:
> > > > - 1st without authentication data (and will receive 407 http response
> > > code)
> > > >  - TCP_DENIED/407
> > > > - 2nd with authentication data(username/password/type) - will be a
> > > success
> > > > - TCP_MISS/200
> > > >
> > > > JMeter (httpclient) send 1st request for detect authentication type
> > > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> > > > If we will have 2 loops the JMeter will send 4 requests, 3 loops = 6
> > > > requests etc. I would like to reduce number of request to the proxy
> > > server
> > > > and make request for detect authentication type once at the start of
> > the
> > > > loop
> > > >
> > > > Artem
> > > >
> > > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> > > > p.mouawad@ubik-ingenierie.com> wrote:
> > > >
> > > > > Hello Artem,
> > > > > I am not sure to understand.
> > > > >
> > > > > Can you clarify with an example or reformulating what you mean by
> > HTTP
> > > > > Request that use proxy with authentication.
> > > > >
> > > > > and also clarify what’s after that, it’s really not clear for me.
> > > > >
> > > > > Thank you
> > > > >
> > > > > On Tuesday, August 21, 2018, Artem Fedorov <
> > > artem.fedorov@blazemeter.com
> > > > >
> > > > > wrote:
> > > > >
> > > > > > HI All
> > > > > >
> > > > > > I configure HTTP Request that use proxy with authentication
> > > > > >
> > > > > > In proxy log I can see, that JMeter *always send 2 requests*:  (I
> > > used
> > > > > > `squid` in tests)
> > > > > >
> > > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > > > > >
> > > > > >
> > > > > > The first request JMeter send without authentication options,
> > because
> > > > > this
> > > > > > options are create after server got a response with 401/407 code.
> > > > > >
> > > > > > In performance test I'll see the following log: (50 % of all
> > requests
> > > > are
> > > > > > send without authentication options) - IMO this is incorrect load
> > of
> > > > > proxy
> > > > > > server or we lose a lot of time for create authentication scheme
> > for
> > > > each
> > > > > > request
> > > > > >
> > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > ....
> > > > > >
> > > > > > The first request (the response for this request) use by
> httpclient
> > > for
> > > > > > detect Standard authentication type
> > > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> > > > > I
> > > > > > think If we have not dynamic proxy we can *reuse* knowledges
> about
> > > > > > authentication type in the second and subsequent requests.
> > > > > > After such changes we will see the following log:
> > > > > >
> > > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > > ....
> > > > > >
> > > > > > What do you think about such changes? If all is OK I can
> contribute
> > > the
> > > > > fix
> > > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Artem
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cordialement.
> > > > > Philippe Mouawad.
> > > > > Ubik-Ingénierie
> > > > >
> > > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> > > > >
> > > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> > > > >
> > > >
> > >
> > >
> > > --
> > > Cordialement.
> > > Philippe Mouawad.
> > >
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <ph...@gmail.com>.
Thank you Artem,

I made a little comment on PR.

Just to be sure I understand the PR:

   - You set HttpClientContext.PROXY_AUTH_STATE so that it is used if
   updated

But is it correct to store it as:

   - "http.auth.proxy-scope" + this

Because we'll end per Thread with :

   - Number of Requests in Plan * Number of Threads AuthStates

Regards


On Mon, Aug 27, 2018 at 3:43 PM Artem Fedorov <ar...@blazemeter.com>
wrote:

> Hi Philippe
>
> https://github.com/apache/jmeter/pull/397
>
> Let's discuss the details in the PR
>
> Thanks,
> Artem
>
> On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
> philippe.mouawad@gmail.com> wrote:
>
> > Hello Artem,
> > Go ahead and propose a patch or PR.
> > It will be a clearer base to discuss.
> >
> > Thank you
> >
> > On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> > artem.fedorov@blazemeter.com>
> > wrote:
> >
> > > I work with the latest JMeter version from github
> > > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> > >
> > > I create a Thread Group with 1 loop and 1 user. This Thread Group
> > contains
> > > View Results Tree (Listener) and HTTP Resuest (Sampler)
> > >
> > > Configuration of HTTP Sampler:
> > >
> > >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> > > > testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
> > > >           <elementProp name="HTTPsampler.Arguments"
> > > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> > > testclass="Arguments"
> > > > testname="User Defined Variables" enabled="true">
> > > >             <collectionProp name="Arguments.arguments"/>
> > > >           </elementProp>
> > > >           <stringProp name="HTTPSampler.domain"></stringProp>
> > > >           <stringProp name="HTTPSampler.port"></stringProp>
> > > >           <stringProp name="HTTPSampler.protocol"></stringProp>
> > > >           <stringProp
> name="HTTPSampler.contentEncoding"></stringProp>
> > > >           <stringProp name="HTTPSampler.path">http://blazedemo.com
> > > > </stringProp>
> > > >           <stringProp name="HTTPSampler.method">GET</stringProp>
> > > >           <boolProp name="HTTPSampler.follow_
> > redirects">true</boolProp>
> > > >           <boolProp
> name="HTTPSampler.auto_redirects">false</boolProp>
> > > >           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
> > > >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</
> > boolProp>
> > > >           <stringProp
> name="HTTPSampler.embedded_url_re"></stringProp>
> > > >           <stringProp name="HTTPSampler.proxyHost">
> > localhost</stringProp>
> > > >           <stringProp name="HTTPSampler.proxyPort">3321</stringProp>
> > > >           <stringProp name="HTTPSampler.proxyUser">artem</stringProp>
> > > >           <stringProp name="HTTPSampler.proxyPass">artem</stringProp>
> > > >           <stringProp
> name="HTTPSampler.connect_timeout"></stringProp>
> > > >           <stringProp name="HTTPSampler.response_
> > timeout"></stringProp>
> > > >         </HTTPSamplerProxy>
> > >
> > >
> > > When I run this Test Plan I see 1 sample in the View Results Tree, but
> in
> > > the access.log of squid I see 2 request from JMeter.
> > >
> > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > >
> > >
> > > So, in real test each Sampler will send 2 requests:
> > > - 1st without authentication data (and will receive 407 http response
> > code)
> > >  - TCP_DENIED/407
> > > - 2nd with authentication data(username/password/type) - will be a
> > success
> > > - TCP_MISS/200
> > >
> > > JMeter (httpclient) send 1st request for detect authentication type
> > > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> > > If we will have 2 loops the JMeter will send 4 requests, 3 loops = 6
> > > requests etc. I would like to reduce number of request to the proxy
> > server
> > > and make request for detect authentication type once at the start of
> the
> > > loop
> > >
> > > Artem
> > >
> > > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> > > p.mouawad@ubik-ingenierie.com> wrote:
> > >
> > > > Hello Artem,
> > > > I am not sure to understand.
> > > >
> > > > Can you clarify with an example or reformulating what you mean by
> HTTP
> > > > Request that use proxy with authentication.
> > > >
> > > > and also clarify what’s after that, it’s really not clear for me.
> > > >
> > > > Thank you
> > > >
> > > > On Tuesday, August 21, 2018, Artem Fedorov <
> > artem.fedorov@blazemeter.com
> > > >
> > > > wrote:
> > > >
> > > > > HI All
> > > > >
> > > > > I configure HTTP Request that use proxy with authentication
> > > > >
> > > > > In proxy log I can see, that JMeter *always send 2 requests*:  (I
> > used
> > > > > `squid` in tests)
> > > > >
> > > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > > > >
> > > > >
> > > > > The first request JMeter send without authentication options,
> because
> > > > this
> > > > > options are create after server got a response with 401/407 code.
> > > > >
> > > > > In performance test I'll see the following log: (50 % of all
> requests
> > > are
> > > > > send without authentication options) - IMO this is incorrect load
> of
> > > > proxy
> > > > > server or we lose a lot of time for create authentication scheme
> for
> > > each
> > > > > request
> > > > >
> > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > ....
> > > > >
> > > > > The first request (the response for this request) use by httpclient
> > for
> > > > > detect Standard authentication type
> > > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> > > > I
> > > > > think If we have not dynamic proxy we can *reuse* knowledges about
> > > > > authentication type in the second and subsequent requests.
> > > > > After such changes we will see the following log:
> > > > >
> > > > > - TCP_DENIED/407 (without proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > - TCP_MISS/200 (with proxy authentication)
> > > > > ....
> > > > >
> > > > > What do you think about such changes? If all is OK I can contribute
> > the
> > > > fix
> > > > >
> > > > >
> > > > > Thanks,
> > > > > Artem
> > > > >
> > > >
> > > >
> > > > --
> > > > Cordialement.
> > > > Philippe Mouawad.
> > > > Ubik-Ingénierie
> > > >
> > > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> > > >
> > > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> > > >
> > >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
> >
>


-- 
Cordialement.
Philippe Mouawad.

Re: JMeter send double requests when configure proxy with authentication

Posted by Artem Fedorov <ar...@blazemeter.com>.
Hi Philippe

https://github.com/apache/jmeter/pull/397

Let's discuss the details in the PR

Thanks,
Artem

On Sun, Aug 26, 2018 at 12:04 AM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Hello Artem,
> Go ahead and propose a patch or PR.
> It will be a clearer base to discuss.
>
> Thank you
>
> On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <
> artem.fedorov@blazemeter.com>
> wrote:
>
> > I work with the latest JMeter version from github
> > (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
> >
> > I create a Thread Group with 1 loop and 1 user. This Thread Group
> contains
> > View Results Tree (Listener) and HTTP Resuest (Sampler)
> >
> > Configuration of HTTP Sampler:
> >
> >         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> > > testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
> > >           <elementProp name="HTTPsampler.Arguments"
> > > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> > testclass="Arguments"
> > > testname="User Defined Variables" enabled="true">
> > >             <collectionProp name="Arguments.arguments"/>
> > >           </elementProp>
> > >           <stringProp name="HTTPSampler.domain"></stringProp>
> > >           <stringProp name="HTTPSampler.port"></stringProp>
> > >           <stringProp name="HTTPSampler.protocol"></stringProp>
> > >           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
> > >           <stringProp name="HTTPSampler.path">http://blazedemo.com
> > > </stringProp>
> > >           <stringProp name="HTTPSampler.method">GET</stringProp>
> > >           <boolProp name="HTTPSampler.follow_
> redirects">true</boolProp>
> > >           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
> > >           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
> > >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</
> boolProp>
> > >           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
> > >           <stringProp name="HTTPSampler.proxyHost">
> localhost</stringProp>
> > >           <stringProp name="HTTPSampler.proxyPort">3321</stringProp>
> > >           <stringProp name="HTTPSampler.proxyUser">artem</stringProp>
> > >           <stringProp name="HTTPSampler.proxyPass">artem</stringProp>
> > >           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
> > >           <stringProp name="HTTPSampler.response_
> timeout"></stringProp>
> > >         </HTTPSamplerProxy>
> >
> >
> > When I run this Test Plan I see 1 sample in the View Results Tree, but in
> > the access.log of squid I see 2 request from JMeter.
> >
> > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> >
> >
> > So, in real test each Sampler will send 2 requests:
> > - 1st without authentication data (and will receive 407 http response
> code)
> >  - TCP_DENIED/407
> > - 2nd with authentication data(username/password/type) - will be a
> success
> > - TCP_MISS/200
> >
> > JMeter (httpclient) send 1st request for detect authentication type
> > (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> > If we will have 2 loops the JMeter will send 4 requests, 3 loops = 6
> > requests etc. I would like to reduce number of request to the proxy
> server
> > and make request for detect authentication type once at the start of the
> > loop
> >
> > Artem
> >
> > On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> > p.mouawad@ubik-ingenierie.com> wrote:
> >
> > > Hello Artem,
> > > I am not sure to understand.
> > >
> > > Can you clarify with an example or reformulating what you mean by HTTP
> > > Request that use proxy with authentication.
> > >
> > > and also clarify what’s after that, it’s really not clear for me.
> > >
> > > Thank you
> > >
> > > On Tuesday, August 21, 2018, Artem Fedorov <
> artem.fedorov@blazemeter.com
> > >
> > > wrote:
> > >
> > > > HI All
> > > >
> > > > I configure HTTP Request that use proxy with authentication
> > > >
> > > > In proxy log I can see, that JMeter *always send 2 requests*:  (I
> used
> > > > `squid` in tests)
> > > >
> > > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > > >
> > > >
> > > > The first request JMeter send without authentication options, because
> > > this
> > > > options are create after server got a response with 401/407 code.
> > > >
> > > > In performance test I'll see the following log: (50 % of all requests
> > are
> > > > send without authentication options) - IMO this is incorrect load of
> > > proxy
> > > > server or we lose a lot of time for create authentication scheme for
> > each
> > > > request
> > > >
> > > > - TCP_DENIED/407 (without proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > - TCP_DENIED/407 (without proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > - TCP_DENIED/407 (without proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > ....
> > > >
> > > > The first request (the response for this request) use by httpclient
> for
> > > > detect Standard authentication type
> > (Basic/Digest/NTLM/SPNEGO/Kerberos).
> > > I
> > > > think If we have not dynamic proxy we can *reuse* knowledges about
> > > > authentication type in the second and subsequent requests.
> > > > After such changes we will see the following log:
> > > >
> > > > - TCP_DENIED/407 (without proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > - TCP_MISS/200 (with proxy authentication)
> > > > ....
> > > >
> > > > What do you think about such changes? If all is OK I can contribute
> the
> > > fix
> > > >
> > > >
> > > > Thanks,
> > > > Artem
> > > >
> > >
> > >
> > > --
> > > Cordialement.
> > > Philippe Mouawad.
> > > Ubik-Ingénierie
> > >
> > > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> > >
> > > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> > >
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello Artem,
Go ahead and propose a patch or PR.
It will be a clearer base to discuss.

Thank you

On Wed, Aug 22, 2018 at 10:56 AM Artem Fedorov <ar...@blazemeter.com>
wrote:

> I work with the latest JMeter version from github
> (revision f27c31590cf07bc8427663b62fc22d6d650b95af)
>
> I create a Thread Group with 1 loop and 1 user. This Thread Group contains
> View Results Tree (Listener) and HTTP Resuest (Sampler)
>
> Configuration of HTTP Sampler:
>
>         <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> > testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
> >           <elementProp name="HTTPsampler.Arguments"
> > elementType="Arguments" guiclass="HTTPArgumentsPanel"
> testclass="Arguments"
> > testname="User Defined Variables" enabled="true">
> >             <collectionProp name="Arguments.arguments"/>
> >           </elementProp>
> >           <stringProp name="HTTPSampler.domain"></stringProp>
> >           <stringProp name="HTTPSampler.port"></stringProp>
> >           <stringProp name="HTTPSampler.protocol"></stringProp>
> >           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
> >           <stringProp name="HTTPSampler.path">http://blazedemo.com
> > </stringProp>
> >           <stringProp name="HTTPSampler.method">GET</stringProp>
> >           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
> >           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
> >           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
> >           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
> >           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
> >           <stringProp name="HTTPSampler.proxyHost">localhost</stringProp>
> >           <stringProp name="HTTPSampler.proxyPort">3321</stringProp>
> >           <stringProp name="HTTPSampler.proxyUser">artem</stringProp>
> >           <stringProp name="HTTPSampler.proxyPass">artem</stringProp>
> >           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
> >           <stringProp name="HTTPSampler.response_timeout"></stringProp>
> >         </HTTPSamplerProxy>
>
>
> When I run this Test Plan I see 1 sample in the View Results Tree, but in
> the access.log of squid I see 2 request from JMeter.
>
> 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > http://blazedemo.com/ - HIER_NONE/- text/html
> > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
>
>
> So, in real test each Sampler will send 2 requests:
> - 1st without authentication data (and will receive 407 http response code)
>  - TCP_DENIED/407
> - 2nd with authentication data(username/password/type) - will be a success
> - TCP_MISS/200
>
> JMeter (httpclient) send 1st request for detect authentication type
> (Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
> If we will have 2 loops the JMeter will send 4 requests, 3 loops = 6
> requests etc. I would like to reduce number of request to the proxy server
> and make request for detect authentication type once at the start of the
> loop
>
> Artem
>
> On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
> p.mouawad@ubik-ingenierie.com> wrote:
>
> > Hello Artem,
> > I am not sure to understand.
> >
> > Can you clarify with an example or reformulating what you mean by HTTP
> > Request that use proxy with authentication.
> >
> > and also clarify what’s after that, it’s really not clear for me.
> >
> > Thank you
> >
> > On Tuesday, August 21, 2018, Artem Fedorov <artem.fedorov@blazemeter.com
> >
> > wrote:
> >
> > > HI All
> > >
> > > I configure HTTP Request that use proxy with authentication
> > >
> > > In proxy log I can see, that JMeter *always send 2 requests*:  (I used
> > > `squid` in tests)
> > >
> > > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> > >
> > >
> > > The first request JMeter send without authentication options, because
> > this
> > > options are create after server got a response with 401/407 code.
> > >
> > > In performance test I'll see the following log: (50 % of all requests
> are
> > > send without authentication options) - IMO this is incorrect load of
> > proxy
> > > server or we lose a lot of time for create authentication scheme for
> each
> > > request
> > >
> > > - TCP_DENIED/407 (without proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > - TCP_DENIED/407 (without proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > - TCP_DENIED/407 (without proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > ....
> > >
> > > The first request (the response for this request) use by httpclient for
> > > detect Standard authentication type
> (Basic/Digest/NTLM/SPNEGO/Kerberos).
> > I
> > > think If we have not dynamic proxy we can *reuse* knowledges about
> > > authentication type in the second and subsequent requests.
> > > After such changes we will see the following log:
> > >
> > > - TCP_DENIED/407 (without proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > - TCP_MISS/200 (with proxy authentication)
> > > ....
> > >
> > > What do you think about such changes? If all is OK I can contribute the
> > fix
> > >
> > >
> > > Thanks,
> > > Artem
> > >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
> > Ubik-Ingénierie
> >
> > UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
> >
> > UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
> >
>


-- 
Cordialement.
Philippe Mouawad.

Re: JMeter send double requests when configure proxy with authentication

Posted by Artem Fedorov <ar...@blazemeter.com>.
I work with the latest JMeter version from github
(revision f27c31590cf07bc8427663b62fc22d6d650b95af)

I create a Thread Group with 1 loop and 1 user. This Thread Group contains
View Results Tree (Listener) and HTTP Resuest (Sampler)

Configuration of HTTP Sampler:

        <HTTPSamplerProxy guiclass="HttpTestSampleGui"
> testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
>           <elementProp name="HTTPsampler.Arguments"
> elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments"
> testname="User Defined Variables" enabled="true">
>             <collectionProp name="Arguments.arguments"/>
>           </elementProp>
>           <stringProp name="HTTPSampler.domain"></stringProp>
>           <stringProp name="HTTPSampler.port"></stringProp>
>           <stringProp name="HTTPSampler.protocol"></stringProp>
>           <stringProp name="HTTPSampler.contentEncoding"></stringProp>
>           <stringProp name="HTTPSampler.path">http://blazedemo.com
> </stringProp>
>           <stringProp name="HTTPSampler.method">GET</stringProp>
>           <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
>           <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
>           <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
>           <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
>           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
>           <stringProp name="HTTPSampler.proxyHost">localhost</stringProp>
>           <stringProp name="HTTPSampler.proxyPort">3321</stringProp>
>           <stringProp name="HTTPSampler.proxyUser">artem</stringProp>
>           <stringProp name="HTTPSampler.proxyPass">artem</stringProp>
>           <stringProp name="HTTPSampler.connect_timeout"></stringProp>
>           <stringProp name="HTTPSampler.response_timeout"></stringProp>
>         </HTTPSamplerProxy>


When I run this Test Plan I see 1 sample in the View Results Tree, but in
the access.log of squid I see 2 request from JMeter.

1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> http://blazedemo.com/ - HIER_NONE/- text/html
> 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html


So, in real test each Sampler will send 2 requests:
- 1st without authentication data (and will receive 407 http response code)
 - TCP_DENIED/407
- 2nd with authentication data(username/password/type) - will be a success
- TCP_MISS/200

JMeter (httpclient) send 1st request for detect authentication type
(Basic/Digest/NTLM/SPNEGO/Kerberos) which use proxy server.
If we will have 2 loops the JMeter will send 4 requests, 3 loops = 6
requests etc. I would like to reduce number of request to the proxy server
and make request for detect authentication type once at the start of the
loop

Artem

On Wed, Aug 22, 2018 at 12:26 AM, Philippe Mouawad <
p.mouawad@ubik-ingenierie.com> wrote:

> Hello Artem,
> I am not sure to understand.
>
> Can you clarify with an example or reformulating what you mean by HTTP
> Request that use proxy with authentication.
>
> and also clarify what’s after that, it’s really not clear for me.
>
> Thank you
>
> On Tuesday, August 21, 2018, Artem Fedorov <ar...@blazemeter.com>
> wrote:
>
> > HI All
> >
> > I configure HTTP Request that use proxy with authentication
> >
> > In proxy log I can see, that JMeter *always send 2 requests*:  (I used
> > `squid` in tests)
> >
> > 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > > http://blazedemo.com/ - HIER_NONE/- text/html
> > > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
> >
> >
> > The first request JMeter send without authentication options, because
> this
> > options are create after server got a response with 401/407 code.
> >
> > In performance test I'll see the following log: (50 % of all requests are
> > send without authentication options) - IMO this is incorrect load of
> proxy
> > server or we lose a lot of time for create authentication scheme for each
> > request
> >
> > - TCP_DENIED/407 (without proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > - TCP_DENIED/407 (without proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > - TCP_DENIED/407 (without proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > ....
> >
> > The first request (the response for this request) use by httpclient for
> > detect Standard authentication type (Basic/Digest/NTLM/SPNEGO/Kerberos).
> I
> > think If we have not dynamic proxy we can *reuse* knowledges about
> > authentication type in the second and subsequent requests.
> > After such changes we will see the following log:
> >
> > - TCP_DENIED/407 (without proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > - TCP_MISS/200 (with proxy authentication)
> > ....
> >
> > What do you think about such changes? If all is OK I can contribute the
> fix
> >
> >
> > Thanks,
> > Artem
> >
>
>
> --
> Cordialement.
> Philippe Mouawad.
> Ubik-Ingénierie
>
> UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>
>
> UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>
>

Re: JMeter send double requests when configure proxy with authentication

Posted by Philippe Mouawad <p....@ubik-ingenierie.com>.
Hello Artem,
I am not sure to understand.

Can you clarify with an example or reformulating what you mean by HTTP
Request that use proxy with authentication.

and also clarify what’s after that, it’s really not clear for me.

Thank you

On Tuesday, August 21, 2018, Artem Fedorov <ar...@blazemeter.com>
wrote:

> HI All
>
> I configure HTTP Request that use proxy with authentication
>
> In proxy log I can see, that JMeter *always send 2 requests*:  (I used
> `squid` in tests)
>
> 1534844834.248      0 127.0.0.1 TCP_DENIED/407 4056 GET
> > http://blazedemo.com/ - HIER_NONE/- text/html
> > 1534844834.320     52 127.0.0.1 TCP_MISS/200 8077 GET
> > http://blazedemo.com/ artem HIER_DIRECT/54.93.131.97 text/html
>
>
> The first request JMeter send without authentication options, because this
> options are create after server got a response with 401/407 code.
>
> In performance test I'll see the following log: (50 % of all requests are
> send without authentication options) - IMO this is incorrect load of proxy
> server or we lose a lot of time for create authentication scheme for each
> request
>
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> ....
>
> The first request (the response for this request) use by httpclient for
> detect Standard authentication type (Basic/Digest/NTLM/SPNEGO/Kerberos). I
> think If we have not dynamic proxy we can *reuse* knowledges about
> authentication type in the second and subsequent requests.
> After such changes we will see the following log:
>
> - TCP_DENIED/407 (without proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> - TCP_MISS/200 (with proxy authentication)
> ....
>
> What do you think about such changes? If all is OK I can contribute the fix
>
>
> Thanks,
> Artem
>


-- 
Cordialement.
Philippe Mouawad.
Ubik-Ingénierie

UBIK LOAD PACK Web Site <http://www.ubikloadpack.com/>

UBIK LOAD PACK on TWITTER <https://twitter.com/ubikloadpack>