hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Onofer Dusan <Dusan.Ono...@st.sk>
Subject Proxy-Authorization header received on server side
Date Thu, 24 Feb 2011 09:15:26 GMT

Hi,

I'm following example 
http://hc.apache.org/httpcomponents-client-ga/examples.html
Proxy authentication

but it seems that not only proxy is receiving credentials for proxy.
In log, which is generated at target.host I can see header
Proxy-Authorization: Basic ....
		
  httpclient.getCredentialsProvider().setCredentials(
    new AuthScope("proxy.host", 80),
    new UsernamePasswordCredentials("proxy_user", "proxy_pass"));
  List<String> authpref = new ArrayList<String>();
  authpref.add(AuthPolicy.BASIC);
  httpclient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, authpref);

  HttpHost targetHost = new HttpHost("target.host", 443, "https");
  HttpHost proxy = new HttpHost("proxy.host", 80);

  httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
  HttpGet httpget = new HttpGet("/path/logrequest.php");
  HttpResponse response = httpclient.execute(targetHost, httpget);

I'm using httpclient-4.1.

--d.

-- 
Dusan Onofer
Mime
View raw message