hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Azwan Adli Abdullah" <az...@slackweb.net>
Subject Http basic auth through proxy
Date Tue, 07 Feb 2006 11:14:27 GMT
Hi All,

I'm having problem to post to http server which has basic auth enabled and
java client is going through proxy.  I got response authentication
failure.  It seems that no username/password sent to that http server. 
When i remove the proxy, it is ok.

The proxy i'm using is from apache http server 1.3.x, the config is as below:
ProxyRequests On
<Directory proxy:*>
  Order Deny,Allow
  Allow from all
</Directory>


My code is as below:
========================================================
httpClient = new HttpClient();
if (useProxy) {
   HostConfiguration hc = httpClient.getHostConfiguration();
   hc.setProxy(getFwdProxyHost(), Integer.parseInt(getFwdProxyPort()));
}

httpClient.getState().setAuthenticationPreemptive(true);
Credentials defaultcreds = new UsernamePasswordCredentials(httpUsername,
httpPassword);
httpClient.getState().setCredentials(realm, hostName, defaultcreds);
============================================================

I'm using commons-httpclient-2.0.2.jar.  Is there anyone facing this
problem and solved it?

Thanks.


-- 
Azwan Adli Abdullah
Slackweb.net


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


Mime
View raw message