You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Thomas Kunnumpurath <th...@db.com> on 2011/09/08 16:46:36 UTC

RE: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

Classification: For internal use only 

Parameters we use:
httpClient.maxTotalConnections = 10
httpClient.maxConnectionsPerRoute = 10
httpClient.keepAliveTime = 60000

Only define it once on the route I am using.

Thanks for the pointer around the [null] state. Digging through the httpClient code, this indicates the UserToken which is supposed to be set by the client. 
As such, I've added a UserToken to DefaultHttpClient as follows:
httpclient.setUserTokenHandler(new UserTokenHandler() {
                public Object getUserToken(HttpContext context) {
                    return "TESLAPOP";
                }
            });

The null is gone, but I'm still not reusing sockets.

Now interesting tidbid from the HttpClient docs:

7.2.2.1. Persistent stateful connections Please note that a persistent connection that carries a state object can be reused only if the same state object is bound to the execution context when requests are executed. So, it is really important to ensure the either same context is reused for execution of subsequent HTTP requests by the same user or the user token is bound to the context prior to request execution.



Which I am doing now, but its still not working... any other ideas?

Thanks,
____________________________________________________



Thomas Kunnumpurath



-----Original Message-----
From: Sam Crawford [mailto:samcrawford@gmail.com]
Sent: Thursday, September 08, 2011 10:02 AM
To: HttpClient User Discussion
Subject: Re: ThreadSafeClientConnectionManager and KeepAlive connnections

Thomas,

SO_REUSEADDRESS is not really relevent to HttpClient's connection pooling mechanism; it's a hint to the OS's TCP stack to reuse an existing TCP socket to the same target in the TIME_WAIT state.

I cannot see anything obviously wrong with what you are doing. Sanity check:
What parameters are you using for the TSCCM? i.e. What have you passed to TSCCM.setMaxTotal(), setDefaultMaxPerRoute(), etc, or are you defining seperately on each HttpRoute?

One potential cause:
The third line of your log says "Getting free connection [HttpRoute[{s}->https://xxxx.intranet.com:410]][null]", where the 'null' is 'state'. When you come to pool the connection on the final line, it looks like the state has been set to some DN (perhaps a client/server SSL certificate?). I'm not sure what this state variable indicates, but I suspect the fact that you're requesting the connection with a null state and pooling it with a non-null state may be the cause of your problem.

Thanks,

Sam



On 8 September 2011 14:21, Thomas Kunnumpurath
<th...@db.com>wrote:

> Classification: *Public *
>
> Hi,
>
> I am using the ThreadSafeClientConnectionManager in the HttpClient 4.1 
> API to submit secure requests to a webserver (nginx). From the debug 
> logs, I do see that the connections are being pooled and reused, 
> however, if I use netstat or tcpview I see that new TCP connections 
> are constantly being created in the ESTABLISHED state and the old ones 
> are put in TIME_WAIT state with no further activity. What I would 
> expect to see is that the same TCP handle would be reused for a period 
> of time. Can someone explain to me why a KeepAlive connection kicked 
> off by HttpClient would not be reused? I can confirm that the web 
> server supports keep alive and that the server is reporting that my 
> program is closing the keep-alive connections****
>
> ** **
>
> Please see a sample of my DEBUG logs below:****
>
> ** **
>
> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.t.ConnPoolByRoute - [HttpRoute[{s 
> https://xxxx.intranet.com:410]] total kept alive: 10, total issued: 0, 
> total allocated: 10 out of 10****
>
> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultClientConnection - Connection closed****
>
> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.t.ConnPoolByRoute - Getting free connection [HttpRoute[{s}->
> https://xxxx.intranet.com:410]][null]****
>
> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultClientConnectionOperator - Connecting to :// 
> xxxx.intranet.com:410 DEBUG 03:07:03.549 - 08/09/2011 
> [pool-1-thread-43] [] o.a.h.c.p.RequestAddCookies - CookieSpec 
> selected: best-match****
>
> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.c.p.RequestAuthCache - Auth cache not set in the context****
>
> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultHttpClient - Attempt 1 to execute request****
>
> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultClientConnection - Sending request: PUT 
> /bla/put?name=TG_AUD_3M  HTTP/1.1****
>
> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultClientConnection - Receiving response: HTTP/1.1 201 
> Created
> ****
>
> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.DefaultHttpClient - Connection can be kept alive for 60000
> MILLISECONDS****
>
> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.t.ThreadSafeClientConnManager - Released connection is reusable.
> ****
>
> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.t.ConnPoolByRoute - Releasing connection 
> [HttpRoute[{s}->https://xxxx.intranet.com:410
> ]][CN=xxxxx.uk.db.com:Tesla, O=xxxx, DC=xx, DC=com]****
>
> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] [] 
> o.a.h.i.c.t.ConnPoolByRoute - Pooling connection 
> [[HttpRoute[{s}->https://xxxx.intranet.com:410
> ]][CN=xxxxx.uk.db.com:Tesla, O=xxxx, DC=xx, DC=com];keep alive for 
> 60000 MILLISECONDS
>
> I have a PUT request twice every second and I see that on average 2 
> TCP connections are established on the server every second, with the 
> previous 2 being put in TIME_WAIT state.
>
> The Response received from the server is as follows:
>
> Response headers:****
>
> HTTP/1.1 201 Created****
>
> Server: nginx/1.0.4****
>
> Date: Thu, 08 Sep 2011 05:00:52 GMT****
>
> Content-Type: application/octet-stream****
>
> Content-Length: 8****
>
> Connection: keep-alive****
>
> ** **
>
> ** **
>
> HTTPSampleResult fields:****
>
> ContentType: application/octet-stream****
>
> DataEncoding: null****
>
> ** **
>
> Wire Logs below:****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >> "PUT /tesla/put?name=TG_AUD_3M HTTP/1.1[\r][\n]"****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "Content-Length: 3160[\r][\n]"****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "Host: xxxxx:410[\r][\n]"****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "Connection: Keep-Alive[\r][\n]"****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "User-Agent: Apache-HttpClient/4.1.2 (java 1.5)[\r][\n]"****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "[\r][\n]"****
>
> ..........****
>
> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> >>
> "[\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "HTTP/1.1 201 Created[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "Server: nginx/1.0.4[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "Date: Thu, 08 Sep 2011 13:17:17 GMT[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "Content-Type: application/octet-stream[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "Content-Length: 8[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "Connection: keep-alive[\r][\n]"****
>
> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire - 
> <<
> "[\r][\n]"****
>
> ** **
>
> Shouldn't the default behavior be to reuse the existing sockets (I've 
> even set the SO_REUSEADDRESS to true, but to no avail). Assistance in 
> troubleshooting this issue would be greatly appreciated.****
>
> ** **
>
> ** **
>
> Thanks,****
>
> ____________________________________________________
>
> [image: https://brandportal.intranet.db.com/img/modules/logo.gif]
>
> Thomas Kunnumpurath
> Assistant Vice President | Application Developer - AS Pricing
>
> Deutsche Bank AG, Filiale New York
> Global Rates IT
> 60 Wall Street, 10005-2836 New York, NY, USA Tel. +1(212)250-2269 
> Email thomas.kunnumpurath@db.com****
>
>
> [image: https://brandportal.intranet.db.com/img/modules/claim.gif]****
>
> ** **
>
> ---
>
> This communication may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this 
> communication in error) please notify the sender immediately and 
> destroy this communication. Any unauthorized copying, disclosure or 
> distribution of the material in this communication is strictly forbidden.
>
> Deutsche Bank does not render legal or tax advice, and the information 
> contained in this communication should not be regarded as such.
>
>
>

---
This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden.
Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.

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


RE: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-09-08 at 12:10 -0500, Thomas Kunnumpurath wrote:
> Classification: For internal use only 
> 
> Oleg/Sam,
> 
> Thanks a lot for both your help! The issue is now resolved.
> 
> Question though is why does the logs show that the connection is reusable, 

Because the connection is perfectly reusable. However, since the
connection carries a certain state (a user identity) it can be re-used
by the same user only.

> getting free connection etc when in fact it is opening a new socket?
> 

If the connection pool is full, the connection manager has no other
choice but to drop stateful persistent connections in order to make room
for new connections. 

> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.t.ConnPoolByRoute - [HttpRoute[{s https://xxxx.intranet.com:410]] total kept alive: 10, total issued: 0, total allocated: 10 out of 10 DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.DefaultClientConnection - Connection closed DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.t.ConnPoolByRoute - Getting free connection [HttpRoute[{s}->https://xxxx.intranet.com:410]][null]
> 
> 
> Should there not be a debug statement in there that says "Cannot find free connection with context [null], creating a new one"
> 
> I think this would make things more clear.
> 

I'll look into it.

Cheers

Oleg


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


Re: Confused about target host and proxy authentication

Posted by Vasile Alin <al...@gmail.com>.
Maybe you can implement your own
org.apache.http.client.RedirectStrategy and provide it using
DefaultHttpClient.setRedirectStrategy. Also you can have a look at
LaxRedirectStrategy available in 4.2:

https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/LaxRedirectStrategy.java

On 12 September 2011 17:50, Michael Remijan <mj...@yahoo.com> wrote:
> It is a POST!  So would I need to configure HttpClient to redirect on a POST?
>
>
>
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Saturday, September 10, 2011 7:15 AM
> Subject: Re: Confused about target host and proxy authentication
>
> On Fri, 2011-09-09 at 11:23 -0700, Michael Remijan wrote:
>> OK, I have the proxy working.
>>
>>
>> Now I think I have a redirect problem.  I've read in the documentation HttpClient automatically handles redirects however I'm getting response which looks like this:
>>
>>
>
> What request method are you using? Please note that entity enclosing
> methods such as POST and PUT may not be redirected automatically per
> requirements of the HTTP spec.
>
> Oleg
>
>>
>> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
>> <HTML><HEAD>
>> <TITLE>302 Found</TITLE>
>> </HEAD><BODY>
>> <H1>Found</H1>
>> The document has moved <A HREF="https://www.server.com/path/">here</A>.<P>
>> </BODY></HTML>
>>
>>
>>
>> ________________________________
>> From: Oleg Kalnichevski <ol...@apache.org>
>> To: Michael Remijan <mj...@yahoo.com>
>> Cc: HttpClient User Discussion <ht...@hc.apache.org>
>> Sent: Friday, September 9, 2011 11:43 AM
>> Subject: Re: Confused about target host and proxy authentication
>>
>> On Fri, 2011-09-09 at 07:32 -0700, Michael Remijan wrote:
>> > Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:
>> >
>> >                 HttpHost proxy
>> >                     = new HttpHost("proxy.server.com", 8080);
>> >
>> >                 httpClient.getParams().setParameter(
>> >                     ConnRoutePNames.DEFAULT_PROXY, proxy
>> >                 );
>> >
>> >
>> >                 AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
>> >                 Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
>> >                 httpClient.getCredentialsProvider().setCredentials(
>> >                         proxyAuthScope, proxyCredentials
>> >                 );
>> >
>> >
>> > Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.
>> >
>>
>> You'd better be sure because if any of those is wrong authentication
>> will fail.
>>
>> > Any additional thoughts?
>> >
>>
>> Use wire / context logging to examine HTTP packets generated by
>> HttpClient and see whether the proxy requests the user to authenticate,
>> whether or not HttpClient attempts authentication and what kind of
>> response the proxy returns.
>>
>> http://hc.apache.org/httpcomponents-client-ga/logging.html
>>
>> Oleg
>>
>>
>> >
>> >
>> > ________________________________
>> > From: Oleg Kalnichevski <ol...@apache.org>
>> > To: Michael Remijan <mj...@yahoo.com>
>> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
>> > Sent: Thursday, September 8, 2011 4:57 PM
>> > Subject: Re: Confused about target host and proxy authentication
>> >
>> > On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
>> > > Do you call
>> > >
>> > > httpclient.getCredentialsProvider().setCredentials(..)
>> > >
>> > > multiple times then for however many credentials you have?
>> > >
>> > >
>> >
>> > Absolutely. HttpClient will make use of them as needed.
>> >
>> > Oleg
>> >
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > ________________________________
>> > > From: Oleg Kalnichevski <ol...@apache.org>
>> > > To: Michael Remijan <mj...@yahoo.com>
>> > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
>> > > Sent: Thursday, September 8, 2011 2:11 PM
>> > > Subject: Re: Confused about target host and proxy authentication
>> > >
>> > > On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
>> > > >
>> > > > I'm sorry, I forgot to include that information...
>> > > >
>> > > >     <dependency>
>> > > >       <groupId>org.apache.httpcomponents</groupId>
>> > > >       <artifactId>httpclient</artifactId>
>> > > >       <version>4.1.2</version>
>> > > >     </dependency>
>> > > >
>> > > >
>> > >
>> > > Then, I am not sure I understand the problem. All you have to do is to
>> > > configure the auth credentials provider with two sets of credentials
>> > > (one or target server and another one for the proxy) as described here
>> > > [1] and HttpClient will take care of the rest.
>> > >
>> > > Oleg
>> > >
>> > > [1]
>> > > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971
>> > >
>> > >
>> > >
>> > >
>> > > >
>> > > > ________________________________
>> > > > From: Oleg Kalnichevski <ol...@apache.org>
>> > > > To: Michael Remijan <mj...@yahoo.com>
>> > > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
>> > > > Sent: Thursday, September 8, 2011 1:22 PM
>> > > > Subject: Re: Confused about target host and proxy authentication
>> > > >
>> > > > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
>> > > > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
>> > > >
>> > > > What version of HttpClient are you using?
>> > > >
>> > > > Oleg
>> > > >
>> > > >
>> > > > ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> > >
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org

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


Re: Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.
It is a POST!  So would I need to configure HttpClient to redirect on a POST?



________________________________
From: Oleg Kalnichevski <ol...@apache.org>
To: Michael Remijan <mj...@yahoo.com>
Cc: HttpClient User Discussion <ht...@hc.apache.org>
Sent: Saturday, September 10, 2011 7:15 AM
Subject: Re: Confused about target host and proxy authentication

On Fri, 2011-09-09 at 11:23 -0700, Michael Remijan wrote:
> OK, I have the proxy working. 
> 
> 
> Now I think I have a redirect problem.  I've read in the documentation HttpClient automatically handles redirects however I'm getting response which looks like this:
> 
> 

What request method are you using? Please note that entity enclosing
methods such as POST and PUT may not be redirected automatically per
requirements of the HTTP spec.

Oleg

> 
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <HTML><HEAD>
> <TITLE>302 Found</TITLE>
> </HEAD><BODY>
> <H1>Found</H1>
> The document has moved <A HREF="https://www.server.com/path/">here</A>.<P>
> </BODY></HTML>
> 
> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Friday, September 9, 2011 11:43 AM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Fri, 2011-09-09 at 07:32 -0700, Michael Remijan wrote:
> > Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:
> > 
> >                 HttpHost proxy 
> >                     = new HttpHost("proxy.server.com", 8080);
> > 
> >                 httpClient.getParams().setParameter(
> >                     ConnRoutePNames.DEFAULT_PROXY, proxy
> >                 );
> > 
> > 
> >                 AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
> >                 Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
> >                 httpClient.getCredentialsProvider().setCredentials(
> >                         proxyAuthScope, proxyCredentials
> >                 );
> > 
> > 
> > Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.
> > 
> 
> You'd better be sure because if any of those is wrong authentication
> will fail.
> 
> > Any additional thoughts?
> > 
> 
> Use wire / context logging to examine HTTP packets generated by
> HttpClient and see whether the proxy requests the user to authenticate,
> whether or not HttpClient attempts authentication and what kind of
> response the proxy returns.
> 
> http://hc.apache.org/httpcomponents-client-ga/logging.html
> 
> Oleg
> 
> 
> > 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 4:57 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> > > Do you call
> > > 
> > > httpclient.getCredentialsProvider().setCredentials(..)
> > > 
> > > multiple times then for however many credentials you have?
> > > 
> > > 
> > 
> > Absolutely. HttpClient will make use of them as needed.
> > 
> > Oleg
> > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ________________________________
> > > From: Oleg Kalnichevski <ol...@apache.org>
> > > To: Michael Remijan <mj...@yahoo.com>
> > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > Sent: Thursday, September 8, 2011 2:11 PM
> > > Subject: Re: Confused about target host and proxy authentication
> > > 
> > > On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > > > 
> > > > I'm sorry, I forgot to include that information...
> > > > 
> > > >     <dependency>      
> > > >       <groupId>org.apache.httpcomponents</groupId>
> > > >       <artifactId>httpclient</artifactId>
> > > >       <version>4.1.2</version>
> > > >     </dependency>
> > > > 
> > > > 
> > > 
> > > Then, I am not sure I understand the problem. All you have to do is to
> > > configure the auth credentials provider with two sets of credentials
> > > (one or target server and another one for the proxy) as described here
> > > [1] and HttpClient will take care of the rest. 
> > > 
> > > Oleg
> > > 
> > > [1]
> > > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > ________________________________
> > > > From: Oleg Kalnichevski <ol...@apache.org>
> > > > To: Michael Remijan <mj...@yahoo.com>
> > > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > > Sent: Thursday, September 8, 2011 1:22 PM
> > > > Subject: Re: Confused about target host and proxy authentication
> > > > 
> > > > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > > > 
> > > > What version of HttpClient are you using?
> > > > 
> > > > Oleg
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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

Re: Confused about target host and proxy authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2011-09-09 at 11:23 -0700, Michael Remijan wrote:
> OK, I have the proxy working. 
> 
> 
> Now I think I have a redirect problem.  I've read in the documentation HttpClient automatically handles redirects however I'm getting response which looks like this:
> 
> 

What request method are you using? Please note that entity enclosing
methods such as POST and PUT may not be redirected automatically per
requirements of the HTTP spec.

Oleg

> 
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <HTML><HEAD>
> <TITLE>302 Found</TITLE>
> </HEAD><BODY>
> <H1>Found</H1>
> The document has moved <A HREF="https://www.server.com/path/">here</A>.<P>
> </BODY></HTML>
> 
> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Friday, September 9, 2011 11:43 AM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Fri, 2011-09-09 at 07:32 -0700, Michael Remijan wrote:
> > Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:
> > 
> >                 HttpHost proxy 
> >                     = new HttpHost("proxy.server.com", 8080);
> > 
> >                 httpClient.getParams().setParameter(
> >                     ConnRoutePNames.DEFAULT_PROXY, proxy
> >                 );
> > 
> > 
> >                 AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
> >                 Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
> >                 httpClient.getCredentialsProvider().setCredentials(
> >                         proxyAuthScope, proxyCredentials
> >                 );
> > 
> > 
> > Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.
> > 
> 
> You'd better be sure because if any of those is wrong authentication
> will fail.
> 
> > Any additional thoughts?
> > 
> 
> Use wire / context logging to examine HTTP packets generated by
> HttpClient and see whether the proxy requests the user to authenticate,
> whether or not HttpClient attempts authentication and what kind of
> response the proxy returns.
> 
> http://hc.apache.org/httpcomponents-client-ga/logging.html
> 
> Oleg
> 
> 
> > 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 4:57 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> > > Do you call
> > > 
> > > httpclient.getCredentialsProvider().setCredentials(..)
> > > 
> > > multiple times then for however many credentials you have?
> > > 
> > > 
> > 
> > Absolutely. HttpClient will make use of them as needed.
> > 
> > Oleg
> > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ________________________________
> > > From: Oleg Kalnichevski <ol...@apache.org>
> > > To: Michael Remijan <mj...@yahoo.com>
> > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > Sent: Thursday, September 8, 2011 2:11 PM
> > > Subject: Re: Confused about target host and proxy authentication
> > > 
> > > On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > > > 
> > > > I'm sorry, I forgot to include that information...
> > > > 
> > > >     <dependency>      
> > > >       <groupId>org.apache.httpcomponents</groupId>
> > > >       <artifactId>httpclient</artifactId>
> > > >       <version>4.1.2</version>
> > > >     </dependency>
> > > > 
> > > > 
> > > 
> > > Then, I am not sure I understand the problem. All you have to do is to
> > > configure the auth credentials provider with two sets of credentials
> > > (one or target server and another one for the proxy) as described here
> > > [1] and HttpClient will take care of the rest. 
> > > 
> > > Oleg
> > > 
> > > [1]
> > > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> > > 
> > > 
> > > 
> > > 
> > > > 
> > > > ________________________________
> > > > From: Oleg Kalnichevski <ol...@apache.org>
> > > > To: Michael Remijan <mj...@yahoo.com>
> > > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > > Sent: Thursday, September 8, 2011 1:22 PM
> > > > Subject: Re: Confused about target host and proxy authentication
> > > > 
> > > > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > > > 
> > > > What version of HttpClient are you using?
> > > > 
> > > > Oleg
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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


Re: Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.
OK, I have the proxy working. 


Now I think I have a redirect problem.  I've read in the documentation HttpClient automatically handles redirects however I'm getting response which looks like this:



<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
The document has moved <A HREF="https://www.server.com/path/">here</A>.<P>
</BODY></HTML>



________________________________
From: Oleg Kalnichevski <ol...@apache.org>
To: Michael Remijan <mj...@yahoo.com>
Cc: HttpClient User Discussion <ht...@hc.apache.org>
Sent: Friday, September 9, 2011 11:43 AM
Subject: Re: Confused about target host and proxy authentication

On Fri, 2011-09-09 at 07:32 -0700, Michael Remijan wrote:
> Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:
> 
>                 HttpHost proxy 
>                     = new HttpHost("proxy.server.com", 8080);
> 
>                 httpClient.getParams().setParameter(
>                     ConnRoutePNames.DEFAULT_PROXY, proxy
>                 );
> 
> 
>                 AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
>                 Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
>                 httpClient.getCredentialsProvider().setCredentials(
>                         proxyAuthScope, proxyCredentials
>                 );
> 
> 
> Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.
> 

You'd better be sure because if any of those is wrong authentication
will fail.

> Any additional thoughts?
> 

Use wire / context logging to examine HTTP packets generated by
HttpClient and see whether the proxy requests the user to authenticate,
whether or not HttpClient attempts authentication and what kind of
response the proxy returns.

http://hc.apache.org/httpcomponents-client-ga/logging.html

Oleg


> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 4:57 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> > Do you call
> > 
> > httpclient.getCredentialsProvider().setCredentials(..)
> > 
> > multiple times then for however many credentials you have?
> > 
> > 
> 
> Absolutely. HttpClient will make use of them as needed.
> 
> Oleg
> 
> > 
> > 
> > 
> > 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 2:11 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > > 
> > > I'm sorry, I forgot to include that information...
> > > 
> > >     <dependency>      
> > >       <groupId>org.apache.httpcomponents</groupId>
> > >       <artifactId>httpclient</artifactId>
> > >       <version>4.1.2</version>
> > >     </dependency>
> > > 
> > > 
> > 
> > Then, I am not sure I understand the problem. All you have to do is to
> > configure the auth credentials provider with two sets of credentials
> > (one or target server and another one for the proxy) as described here
> > [1] and HttpClient will take care of the rest. 
> > 
> > Oleg
> > 
> > [1]
> > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> > 
> > 
> > 
> > 
> > > 
> > > ________________________________
> > > From: Oleg Kalnichevski <ol...@apache.org>
> > > To: Michael Remijan <mj...@yahoo.com>
> > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > Sent: Thursday, September 8, 2011 1:22 PM
> > > Subject: Re: Confused about target host and proxy authentication
> > > 
> > > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > > 
> > > What version of HttpClient are you using?
> > > 
> > > Oleg
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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

Re: Confused about target host and proxy authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2011-09-09 at 07:32 -0700, Michael Remijan wrote:
> Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:
> 
>                 HttpHost proxy 
>                     = new HttpHost("proxy.server.com", 8080);
> 
>                 httpClient.getParams().setParameter(
>                     ConnRoutePNames.DEFAULT_PROXY, proxy
>                 );
> 
> 
>                 AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
>                 Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
>                 httpClient.getCredentialsProvider().setCredentials(
>                         proxyAuthScope, proxyCredentials
>                 );
> 
> 
> Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.
> 

You'd better be sure because if any of those is wrong authentication
will fail.

> Any additional thoughts?
> 

Use wire / context logging to examine HTTP packets generated by
HttpClient and see whether the proxy requests the user to authenticate,
whether or not HttpClient attempts authentication and what kind of
response the proxy returns.

http://hc.apache.org/httpcomponents-client-ga/logging.html

Oleg


> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 4:57 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> > Do you call
> > 
> > httpclient.getCredentialsProvider().setCredentials(..)
> > 
> > multiple times then for however many credentials you have?
> > 
> > 
> 
> Absolutely. HttpClient will make use of them as needed.
> 
> Oleg
> 
> > 
> > 
> > 
> > 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 2:11 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > > 
> > > I'm sorry, I forgot to include that information...
> > > 
> > >     <dependency>      
> > >       <groupId>org.apache.httpcomponents</groupId>
> > >       <artifactId>httpclient</artifactId>
> > >       <version>4.1.2</version>
> > >     </dependency>
> > > 
> > > 
> > 
> > Then, I am not sure I understand the problem. All you have to do is to
> > configure the auth credentials provider with two sets of credentials
> > (one or target server and another one for the proxy) as described here
> > [1] and HttpClient will take care of the rest. 
> > 
> > Oleg
> > 
> > [1]
> > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> > 
> > 
> > 
> > 
> > > 
> > > ________________________________
> > > From: Oleg Kalnichevski <ol...@apache.org>
> > > To: Michael Remijan <mj...@yahoo.com>
> > > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > > Sent: Thursday, September 8, 2011 1:22 PM
> > > Subject: Re: Confused about target host and proxy authentication
> > > 
> > > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > > 
> > > What version of HttpClient are you using?
> > > 
> > > Oleg
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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


Re: Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.
Unfortunately, the proxy connection is still not working.  I'm in the position where I guess I have to use an NTLM proxy.  This proxy does not require authentication (for example, I can configure my web browser to point to proxy.server.com:8080 and the web browser connects fine)  However, whenever I try to do this from my Java app, I always get a "access denied" page from the proxy.  Here is what I've tried for my HttpClient proxy configuration:

                HttpHost proxy 
                    = new HttpHost("proxy.server.com", 8080);

                httpClient.getParams().setParameter(
                    ConnRoutePNames.DEFAULT_PROXY, proxy
                );


                AuthScope authScope = new AuthScope("proxy.server.com", 8080, "[REALM]", "ntlm");
                Credentials credentials = new NTCredentials("[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
                httpClient.getCredentialsProvider().setCredentials(
                        proxyAuthScope, proxyCredentials
                );


Now, I'm not exactly sure what the exact values are suppose to used for "[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and "[DOMAIN]", but I have tried a number of different combinations and have yet to hit a working solution.

Any additional thoughts?



________________________________
From: Oleg Kalnichevski <ol...@apache.org>
To: Michael Remijan <mj...@yahoo.com>
Cc: HttpClient User Discussion <ht...@hc.apache.org>
Sent: Thursday, September 8, 2011 4:57 PM
Subject: Re: Confused about target host and proxy authentication

On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> Do you call
> 
> httpclient.getCredentialsProvider().setCredentials(..)
> 
> multiple times then for however many credentials you have?
> 
> 

Absolutely. HttpClient will make use of them as needed.

Oleg

> 
> 
> 
> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 2:11 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > 
> > I'm sorry, I forgot to include that information...
> > 
> >     <dependency>      
> >       <groupId>org.apache.httpcomponents</groupId>
> >       <artifactId>httpclient</artifactId>
> >       <version>4.1.2</version>
> >     </dependency>
> > 
> > 
> 
> Then, I am not sure I understand the problem. All you have to do is to
> configure the auth credentials provider with two sets of credentials
> (one or target server and another one for the proxy) as described here
> [1] and HttpClient will take care of the rest. 
> 
> Oleg
> 
> [1]
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> 
> 
> 
> 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 1:22 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > 
> > What version of HttpClient are you using?
> > 
> > Oleg
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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

Re: Confused about target host and proxy authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> Do you call
> 
> httpclient.getCredentialsProvider().setCredentials(..)
> 
> multiple times then for however many credentials you have?
> 
> 

Absolutely. HttpClient will make use of them as needed.

Oleg

> 
> 
> 
> 
> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 2:11 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> > 
> > I'm sorry, I forgot to include that information...
> > 
> >     <dependency>      
> >       <groupId>org.apache.httpcomponents</groupId>
> >       <artifactId>httpclient</artifactId>
> >       <version>4.1.2</version>
> >     </dependency>
> > 
> > 
> 
> Then, I am not sure I understand the problem. All you have to do is to
> configure the auth credentials provider with two sets of credentials
> (one or target server and another one for the proxy) as described here
> [1] and HttpClient will take care of the rest. 
> 
> Oleg
> 
> [1]
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 
> 
> 
> 
> 
> > 
> > ________________________________
> > From: Oleg Kalnichevski <ol...@apache.org>
> > To: Michael Remijan <mj...@yahoo.com>
> > Cc: HttpClient User Discussion <ht...@hc.apache.org>
> > Sent: Thursday, September 8, 2011 1:22 PM
> > Subject: Re: Confused about target host and proxy authentication
> > 
> > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> > 
> > What version of HttpClient are you using?
> > 
> > Oleg
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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


Re: Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.
Do you call

httpclient.getCredentialsProvider().setCredentials(..)

multiple times then for however many credentials you have?







________________________________
From: Oleg Kalnichevski <ol...@apache.org>
To: Michael Remijan <mj...@yahoo.com>
Cc: HttpClient User Discussion <ht...@hc.apache.org>
Sent: Thursday, September 8, 2011 2:11 PM
Subject: Re: Confused about target host and proxy authentication

On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> 
> I'm sorry, I forgot to include that information...
> 
>     <dependency>      
>       <groupId>org.apache.httpcomponents</groupId>
>       <artifactId>httpclient</artifactId>
>       <version>4.1.2</version>
>     </dependency>
> 
> 

Then, I am not sure I understand the problem. All you have to do is to
configure the auth credentials provider with two sets of credentials
(one or target server and another one for the proxy) as described here
[1] and HttpClient will take care of the rest. 

Oleg

[1]
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 




> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 1:22 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> 
> What version of HttpClient are you using?
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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

Re: Confused about target host and proxy authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> 
> I'm sorry, I forgot to include that information...
> 
>     <dependency>      
>       <groupId>org.apache.httpcomponents</groupId>
>       <artifactId>httpclient</artifactId>
>       <version>4.1.2</version>
>     </dependency>
> 
> 

Then, I am not sure I understand the problem. All you have to do is to
configure the auth credentials provider with two sets of credentials
(one or target server and another one for the proxy) as described here
[1] and HttpClient will take care of the rest. 

Oleg

[1]
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971 




> 
> ________________________________
> From: Oleg Kalnichevski <ol...@apache.org>
> To: Michael Remijan <mj...@yahoo.com>
> Cc: HttpClient User Discussion <ht...@hc.apache.org>
> Sent: Thursday, September 8, 2011 1:22 PM
> Subject: Re: Confused about target host and proxy authentication
> 
> On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.
> 
> What version of HttpClient are you using?
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org



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


Re: Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.

I'm sorry, I forgot to include that information...

    <dependency>      
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.1.2</version>
    </dependency>



________________________________
From: Oleg Kalnichevski <ol...@apache.org>
To: Michael Remijan <mj...@yahoo.com>
Cc: HttpClient User Discussion <ht...@hc.apache.org>
Sent: Thursday, September 8, 2011 1:22 PM
Subject: Re: Confused about target host and proxy authentication

On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.

What version of HttpClient are you using?

Oleg


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

Re: Confused about target host and proxy authentication

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.

What version of HttpClient are you using?

Oleg


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


Confused about target host and proxy authentication

Posted by Michael Remijan <mj...@yahoo.com>.
I am working in an environment where I need to specify a proxy as well as login to the proxy.  After I have the connection to the proxy, I then need to also provide BASIC authentication to target host I'm contacting. I'm confused how to do this configuration.  I have followed the examples and I know how to get a non-authenticating proxy to work and I have also followed the examples to provide BASIC authentication to my target host.  In my case the usernames/passwords for both are different so I'm confused how to provide authenticating information for the proxy as well.  Any help would be appreciated.

RE: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

Posted by Thomas Kunnumpurath <th...@db.com>.
Classification: For internal use only 

Oleg/Sam,

Thanks a lot for both your help! The issue is now resolved.

Question though is why does the logs show that the connection is reusable, getting free connection etc when in fact it is opening a new socket?

DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.t.ConnPoolByRoute - [HttpRoute[{s https://xxxx.intranet.com:410]] total kept alive: 10, total issued: 0, total allocated: 10 out of 10 DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.DefaultClientConnection - Connection closed DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] [] o.a.h.i.c.t.ConnPoolByRoute - Getting free connection [HttpRoute[{s}->https://xxxx.intranet.com:410]][null]


Should there not be a debug statement in there that says "Cannot find free connection with context [null], creating a new one"

I think this would make things more clear.

Thanks,
____________________________________________________


Thomas Kunnumpurath




-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Thursday, September 08, 2011 12:08 PM
To: HttpClient User Discussion
Subject: Re: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

On Thu, 2011-09-08 at 16:06 +0100, Sam Crawford wrote:
> I've not used the UserToken class myself (and don't have a readily 
> available test environment), but if the approach you've got isn't 
> working (what do the ConnPoolByRoute logs show?) then from reading the 
> docs I'd suggest you have two options:
> 
> 1. Do it as per 7.2.2.1 on
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html.
> i.e. Run the first request without setting the UserToken, pull it from 
> the context after the response, and then reuse it forever more.
> 2. Reuse the same HttpContext across all requests (although you'll 
> want to be careful in a multi-threaded setup of course).
> 
> Thanks,
> 
> Sam
> 

Thomas and Sam,

It is all quite simple. There is no way of knowing for HttpClient that requests are logically related and share the same user identity per default. One must use the _same_ HttpContext instance in order to inform HttpClient that requests are logically related and belong to the same user. Once a user token is bound to the context HttpClient will automatically use the token when obtaining connections from the pool.
Without the token the pool manager cannot lease connections that carry a state and will have to create a new connection instead of re-using persistent connections from the pool.

Hope this helps

Oleg 




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


---
This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden.
Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.

Re: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-09-08 at 16:06 +0100, Sam Crawford wrote:
> I've not used the UserToken class myself (and don't have a readily
> available test environment), but if the approach you've got isn't
> working (what do the ConnPoolByRoute logs show?) then from reading the
> docs I'd suggest you have two options:
> 
> 1. Do it as per 7.2.2.1 on
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html.
> i.e. Run the first request without setting the UserToken, pull it from
> the context after the response, and then reuse it forever more.
> 2. Reuse the same HttpContext across all requests (although you'll
> want to be careful in a multi-threaded setup of course).
> 
> Thanks,
> 
> Sam
> 

Thomas and Sam,

It is all quite simple. There is no way of knowing for HttpClient that
requests are logically related and share the same user identity per
default. One must use the _same_ HttpContext instance in order to inform
HttpClient that requests are logically related and belong to the same
user. Once a user token is bound to the context HttpClient will
automatically use the token when obtaining connections from the pool.
Without the token the pool manager cannot lease connections that carry a
state and will have to create a new connection instead of re-using
persistent connections from the pool.

Hope this helps

Oleg 




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


Re: ThreadSafeClientConnectionManager and KeepAlive connnections [I]

Posted by Sam Crawford <sa...@gmail.com>.
I've not used the UserToken class myself (and don't have a readily
available test environment), but if the approach you've got isn't
working (what do the ConnPoolByRoute logs show?) then from reading the
docs I'd suggest you have two options:

1. Do it as per 7.2.2.1 on
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html.
i.e. Run the first request without setting the UserToken, pull it from
the context after the response, and then reuse it forever more.
2. Reuse the same HttpContext across all requests (although you'll
want to be careful in a multi-threaded setup of course).

Thanks,

Sam


On 8 September 2011 15:46, Thomas Kunnumpurath
<th...@db.com> wrote:
> Classification: For internal use only
>
> Parameters we use:
> httpClient.maxTotalConnections = 10
> httpClient.maxConnectionsPerRoute = 10
> httpClient.keepAliveTime = 60000
>
> Only define it once on the route I am using.
>
> Thanks for the pointer around the [null] state. Digging through the httpClient code, this indicates the UserToken which is supposed to be set by the client.
> As such, I've added a UserToken to DefaultHttpClient as follows:
> httpclient.setUserTokenHandler(new UserTokenHandler() {
>                public Object getUserToken(HttpContext context) {
>                    return "TESLAPOP";
>                }
>            });
>
> The null is gone, but I'm still not reusing sockets.
>
> Now interesting tidbid from the HttpClient docs:
>
> 7.2.2.1. Persistent stateful connections Please note that a persistent connection that carries a state object can be reused only if the same state object is bound to the execution context when requests are executed. So, it is really important to ensure the either same context is reused for execution of subsequent HTTP requests by the same user or the user token is bound to the context prior to request execution.
>
>
>
> Which I am doing now, but its still not working... any other ideas?
>
> Thanks,
> ____________________________________________________
>
>
>
> Thomas Kunnumpurath
>
>
>
> -----Original Message-----
> From: Sam Crawford [mailto:samcrawford@gmail.com]
> Sent: Thursday, September 08, 2011 10:02 AM
> To: HttpClient User Discussion
> Subject: Re: ThreadSafeClientConnectionManager and KeepAlive connnections
>
> Thomas,
>
> SO_REUSEADDRESS is not really relevent to HttpClient's connection pooling mechanism; it's a hint to the OS's TCP stack to reuse an existing TCP socket to the same target in the TIME_WAIT state.
>
> I cannot see anything obviously wrong with what you are doing. Sanity check:
> What parameters are you using for the TSCCM? i.e. What have you passed to TSCCM.setMaxTotal(), setDefaultMaxPerRoute(), etc, or are you defining seperately on each HttpRoute?
>
> One potential cause:
> The third line of your log says "Getting free connection [HttpRoute[{s}->https://xxxx.intranet.com:410]][null]", where the 'null' is 'state'. When you come to pool the connection on the final line, it looks like the state has been set to some DN (perhaps a client/server SSL certificate?). I'm not sure what this state variable indicates, but I suspect the fact that you're requesting the connection with a null state and pooling it with a non-null state may be the cause of your problem.
>
> Thanks,
>
> Sam
>
>
>
> On 8 September 2011 14:21, Thomas Kunnumpurath
> <th...@db.com>wrote:
>
>> Classification: *Public *
>>
>> Hi,
>>
>> I am using the ThreadSafeClientConnectionManager in the HttpClient 4.1
>> API to submit secure requests to a webserver (nginx). From the debug
>> logs, I do see that the connections are being pooled and reused,
>> however, if I use netstat or tcpview I see that new TCP connections
>> are constantly being created in the ESTABLISHED state and the old ones
>> are put in TIME_WAIT state with no further activity. What I would
>> expect to see is that the same TCP handle would be reused for a period
>> of time. Can someone explain to me why a KeepAlive connection kicked
>> off by HttpClient would not be reused? I can confirm that the web
>> server supports keep alive and that the server is reporting that my
>> program is closing the keep-alive connections****
>>
>> ** **
>>
>> Please see a sample of my DEBUG logs below:****
>>
>> ** **
>>
>> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.t.ConnPoolByRoute - [HttpRoute[{s
>> https://xxxx.intranet.com:410]] total kept alive: 10, total issued: 0,
>> total allocated: 10 out of 10****
>>
>> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultClientConnection - Connection closed****
>>
>> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.t.ConnPoolByRoute - Getting free connection [HttpRoute[{s}->
>> https://xxxx.intranet.com:410]][null]****
>>
>> DEBUG 03:07:03.490 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultClientConnectionOperator - Connecting to ://
>> xxxx.intranet.com:410 DEBUG 03:07:03.549 - 08/09/2011
>> [pool-1-thread-43] [] o.a.h.c.p.RequestAddCookies - CookieSpec
>> selected: best-match****
>>
>> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.c.p.RequestAuthCache - Auth cache not set in the context****
>>
>> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultHttpClient - Attempt 1 to execute request****
>>
>> DEBUG 03:07:03.549 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultClientConnection - Sending request: PUT
>> /bla/put?name=TG_AUD_3M  HTTP/1.1****
>>
>> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultClientConnection - Receiving response: HTTP/1.1 201
>> Created
>> ****
>>
>> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.DefaultHttpClient - Connection can be kept alive for 60000
>> MILLISECONDS****
>>
>> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.t.ThreadSafeClientConnManager - Released connection is reusable.
>> ****
>>
>> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.t.ConnPoolByRoute - Releasing connection
>> [HttpRoute[{s}->https://xxxx.intranet.com:410
>> ]][CN=xxxxx.uk.db.com:Tesla, O=xxxx, DC=xx, DC=com]****
>>
>> DEBUG 03:07:03.552 - 08/09/2011 [pool-1-thread-43] []
>> o.a.h.i.c.t.ConnPoolByRoute - Pooling connection
>> [[HttpRoute[{s}->https://xxxx.intranet.com:410
>> ]][CN=xxxxx.uk.db.com:Tesla, O=xxxx, DC=xx, DC=com];keep alive for
>> 60000 MILLISECONDS
>>
>> I have a PUT request twice every second and I see that on average 2
>> TCP connections are established on the server every second, with the
>> previous 2 being put in TIME_WAIT state.
>>
>> The Response received from the server is as follows:
>>
>> Response headers:****
>>
>> HTTP/1.1 201 Created****
>>
>> Server: nginx/1.0.4****
>>
>> Date: Thu, 08 Sep 2011 05:00:52 GMT****
>>
>> Content-Type: application/octet-stream****
>>
>> Content-Length: 8****
>>
>> Connection: keep-alive****
>>
>> ** **
>>
>> ** **
>>
>> HTTPSampleResult fields:****
>>
>> ContentType: application/octet-stream****
>>
>> DataEncoding: null****
>>
>> ** **
>>
>> Wire Logs below:****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >> "PUT /tesla/put?name=TG_AUD_3M HTTP/1.1[\r][\n]"****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "Content-Length: 3160[\r][\n]"****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "Host: xxxxx:410[\r][\n]"****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "Connection: Keep-Alive[\r][\n]"****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "User-Agent: Apache-HttpClient/4.1.2 (java 1.5)[\r][\n]"****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "[\r][\n]"****
>>
>> ..........****
>>
>> DEBUG 09:17:18.034 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> >>
>> "[\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "HTTP/1.1 201 Created[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "Server: nginx/1.0.4[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "Date: Thu, 08 Sep 2011 13:17:17 GMT[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "Content-Type: application/octet-stream[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "Content-Length: 8[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "Connection: keep-alive[\r][\n]"****
>>
>> DEBUG 09:17:18.112 - 08/09/2011 [pool-1-thread-1] [] o.a.http.wire -
>> <<
>> "[\r][\n]"****
>>
>> ** **
>>
>> Shouldn't the default behavior be to reuse the existing sockets (I've
>> even set the SO_REUSEADDRESS to true, but to no avail). Assistance in
>> troubleshooting this issue would be greatly appreciated.****
>>
>> ** **
>>
>> ** **
>>
>> Thanks,****
>>
>> ____________________________________________________
>>
>> [image: https://brandportal.intranet.db.com/img/modules/logo.gif]
>>
>> Thomas Kunnumpurath
>> Assistant Vice President | Application Developer - AS Pricing
>>
>> Deutsche Bank AG, Filiale New York
>> Global Rates IT
>> 60 Wall Street, 10005-2836 New York, NY, USA Tel. +1(212)250-2269
>> Email thomas.kunnumpurath@db.com****
>>
>>
>> [image: https://brandportal.intranet.db.com/img/modules/claim.gif]****
>>
>> ** **
>>
>> ---
>>
>> This communication may contain confidential and/or privileged information.
>> If you are not the intended recipient (or have received this
>> communication in error) please notify the sender immediately and
>> destroy this communication. Any unauthorized copying, disclosure or
>> distribution of the material in this communication is strictly forbidden.
>>
>> Deutsche Bank does not render legal or tax advice, and the information
>> contained in this communication should not be regarded as such.
>>
>>
>>
>
> ---
> This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden.
> Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

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