• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpsURLConnection Proxy auth problem

 
Andreas Niemeyeer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I want to do a https request with an proxy and authorisation.

Here an example code and values (the user/pass is correct):

String vProxy = "localproxy";
String vProxyPort = "80";
String vProxyUser = "user";
String vProxyPass = "pass";
System.setProperty("https.proxyHost", vProxy);
System.setProperty("https.proxyPort", vProxyPort);

URL vURL = new URL("https://www.google.com:443/");
HttpsURLConnection vCon = (HttpsURLConnection) vURL.openConnection();
String vAccount = vProxyUser + ":" + vProxyPass;
String vEncodedAccount = new sun.misc.BASE64Encoder().encode(vAccount.getBytes());
vCon.setRequestProperty("Https-Proxy-Authorization", "Basic "+encodedAuth);

vResponseCode = vCon.getResponseCode();
vResponseMessage = vCon.getResponseMessage();


The response message is always `Proxy Authentication Required'.

Has anyone the same problem solved? Might it be a digest auth scheme or another thing?


Thank you in advance,
Andreas
 
Andreas Niemeyer
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I solved the problem by reading this thread:

https://cis.med.ucalgary.ca/http/forum.java.sun.com/thread.jspa?threadID=188930&tstart=45

and use now this great package:

http://jakarta.apache.org/commons/httpclient

:-)

Thanks for your attention,
Andreas
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!