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 Oleg Kalnichevski <ol...@apache.org> on 2005/05/02 21:42:29 UTC
Re: HttpClient 3.0-rc2: problem reading ssl encrypted data via
proxy
Gebhard,
Simply put HttpClient fails to find the required proxy credentials:
> [INFO] HttpMethodDirector - No credentials available for BASIC
'XGATE'@10.5.8.66:3128
Just wondering if there is any particular reason you are using this
deprecated method?
> httpclient.getState().setProxyCredentials("XGATE", " 10.5.8.66",
new UsernamePasswordCredentials("uid", "pwd"));
Besides, please note a superfluous blank in the host name:
" 10.5.8.66" whereas it should probably be "10.5.8.66".
Hope this helps
Oleg
On Mon, 2005-05-02 at 17:02 +0200, Gebhard Gaukler wrote:
> HttpClient 3.0-rc2 API
> j2sdk1.4.2_08
> Windows XP
>
> Hi,
>
> accessing ssl data via our proxy (basic authentication) I get the message:
> HTTP/1.0 407 Proxy Authentication Required
>
> I used the program code from the HttpClient SSL Guide and the example
> worked fine:
> Our proxy does not need authenification to access VERISIGN.
> But trying other urls I got the error message.
> (The urls are accessible via Mozilla and IE without problems)
>
> Here is my program code with the urls I tried:
>
> import org.apache.commons.httpclient.*;
> import org.apache.commons.httpclient.methods.*;
>
> public void example() throws Exception
> {
> //MultiThreadedHttpConnectionManager connectionManager = new
> MultiThreadedHttpConnectionManager();
> //HttpClient httpclient = new HttpClient(connectionManager);
> HttpClient httpclient = new HttpClient();
> //httpclient.setTimeout(30000);
> //httpclient.setConnectionTimeout(30000);
> //httpclient.getHostConfiguration().setHost("www.pairnic.com");
> httpclient.getHostConfiguration().setProxy("10.5.8.66", 3128);
> httpclient.getState().setProxyCredentials("XGATE", " 10.5.8.66", new
> UsernamePasswordCredentials("uid", "pwd"));
> //httpclient.getState().setAuthenticationPreemptive(true);
>
> //GetMethod httpget = new GetMethod("https://www.verisign.com/");
> //GetMethod httpget = new GetMethod("
> https://stats.ecb.int/stats/download/bsi_emoney/bsi_emoney.zip");
> //GetMethod httpget = new GetMethod("https://www.pairnic.com/main.m");
> GetMethod httpget = new GetMethod("https://www.pairnic.com:443/main.m");
>
> try
> {
> httpclient.executeMethod(httpget);
> System.out.println(httpget.getStatusLine());
> }
> finally
> {
> httpget.releaseConnection();
> }
> }
>
>
> RESULT:
>
> 2005/05/02 15:33:57:718 CEST [DEBUG] HttpClient - Java version: 1.4.2_08
> 2005/05/02 15:33:57:718 CEST [DEBUG] HttpClient - Java vendor: Sun
> Microsystems Inc.
> 2005/05/02 15:33:57:718 CEST [DEBUG] HttpClient - Java class path:
> C:\projekte\Experimente\Gaukler\TestHttpClient\classes;O:\DBR_SHARED_LIBRARY\3rdParty\commons\commons-logging-1.0.4\commons-logging.jar;O:\DBR_SHARED_LIBRARY\3rdParty\commons\commons-logging-1.0.4\commons-logging-api.jar;O:\DBR_SHARED_LIBRARY\3rdParty\commons\commons-codec-1.3\commons-codec-1.3.jar;O:\DBR_SHARED_LIBRARY\3rdParty\httpClient\commons-httpclient-3.0-rc2.jar;C:\j2sdk1.4.2_08\demo\jfc\Java2D\Java2Demo.jar;C:\j2sdk1.4.2_08\demo\plugin\jfc\Java2D\Java2Demo.jar;C:\j2sdk1.4.2_08\jre\javaws\javaws.jar;C:\j2sdk1.4.2_08\jre\lib\charsets.jar;C:\j2sdk1.4.2_08\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_08\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_08\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_08\jre\lib\ext\sunjce_provider.jar;C:\j2sdk1.4.2_08\jre\lib\im\indicim.jar;C:\j2sdk1.4.2_08\jre\lib\im\thaiim.jar;C:\j2sdk1.4.2_08\jre\lib\jce.jar;C:\j2sdk1.4.2_08\jre\lib\jsse.jar;C:\j2sdk1.4.2_08\jre\lib\plugin.jar;C:\j2sdk1.4.2_08\jre\lib\rt.jar;C:\j2sdk1.4.2_08\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_08\lib\dt.jar;C:\j2sdk1.4.2_08\lib\htmlconverter.jar;C:\j2sdk1.4.2_08\lib\tools.jar
> 2005/05/02 15:33:57:750 CEST [DEBUG] HttpClient - Operating system name:
> Windows XP
> 2005/05/02 15:33:57:750 CEST [DEBUG] HttpClient - Operating system
> architecture: x86
> 2005/05/02 15:33:57:750 CEST [DEBUG] HttpClient - Operating system
> version: 5.1
> 2005/05/02 15:33:57:906 CEST [DEBUG] HttpClient - SUN 1.42: SUN (DSA
> key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom;
> X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX
> CertPathBuilder; LDAP, Collection CertStores)
> 2005/05/02 15:33:57:906 CEST [DEBUG] HttpClient - SunJSSE 1.42: Sun JSSE
> provider(implements RSA Signatures, PKCS12, SunX509 key/trust factories,
> SSLv3, TLSv1)
> 2005/05/02 15:33:57:906 CEST [DEBUG] HttpClient - SunRsaSign 1.42: SUN's
> provider for RSA signatures
> 2005/05/02 15:33:57:906 CEST [DEBUG] HttpClient - SunJCE 1.42: SunJCE
> Provider (implements DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman,
> HMAC-MD5, HMAC-SHA1)
> 2005/05/02 15:33:57:906 CEST [DEBUG] HttpClient - SunJGSS 1.0: Sun
> (Kerberos v5)
> 2005/05/02 15:33:57:906 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.useragent = Jakarta Commons-HttpClient/3.0-rc2
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.version = HTTP/1.1
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.connection-manager.class = class
> org.apache.commons.httpclient.SimpleHttpConnectionManager
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.cookie-policy = rfc2109
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.element-charset = US-ASCII
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.content-charset = ISO-8859-1
> 2005/05/02 15:33:57:921 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.method.retry-handler =
> org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@17fa65e
> 2005/05/02 15:33:57:937 CEST [DEBUG] DefaultHttpParams - Set parameter
> http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
> HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE,
> dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy
> HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE
> dd-MMM-yy HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z,
> EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
> 2005/05/02 15:33:58:093 CEST [DEBUG] HttpConnection - Open connection to
> 10.5.8.66:3128
> 2005/05/02 15:33:58:125 CEST [DEBUG] header - >> "CONNECT
> www.pairnic.com:443 HTTP/1.1"
> 2005/05/02 15:33:58:140 CEST [DEBUG] HttpMethodBase - Adding Host request
> header
> 2005/05/02 15:33:58:140 CEST [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.0-rc2[\r][\n]"
> 2005/05/02 15:33:58:140 CEST [DEBUG] header - >> "Host:
> www.pairnic.com[\r][\n]"
> 2005/05/02 15:33:58:140 CEST [DEBUG] header - >> "Proxy-Connection:
> Keep-Alive[\r][\n]"
> 2005/05/02 15:33:58:140 CEST [DEBUG] header - >> "[\r][\n]"
> 2005/05/02 15:33:58:140 CEST [DEBUG] header - << "HTTP/1.0 407 Proxy
> Authentication Required[\r][\n]"
> 2005/05/02 15:33:58:156 CEST [DEBUG] header - << "Date: Mon, 02 May 2005
> 13:36:08 GMT[\r][\n]"
> 2005/05/02 15:33:58:156 CEST [DEBUG] header - << "Content-Length:
> 257[\r][\n]"
> 2005/05/02 15:33:58:156 CEST [DEBUG] header - << "Content-Type:
> text/html[\r][\n]"
> 2005/05/02 15:33:58:156 CEST [DEBUG] header - << "Server: NetCache
> appliance (NetApp/5.6.2)[\r][\n]"
> 2005/05/02 15:33:58:156 CEST [DEBUG] header - << "Proxy-Authenticate:
> Basic realm="XGATE"[\r][\n]"
> 2005/05/02 15:33:58:187 CEST [DEBUG] ConnectMethod - CONNECT status code
> 407
> 2005/05/02 15:33:58:218 CEST [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 2005/05/02 15:33:58:218 CEST [DEBUG] AuthChallengeProcessor - Challenge
> for ntlm authentication scheme not available
> 2005/05/02 15:33:58:218 CEST [DEBUG] AuthChallengeProcessor - Challenge
> for digest authentication scheme not available
> 2005/05/02 15:33:58:218 CEST [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 2005/05/02 15:33:58:218 CEST [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 2005/05/02 15:33:58:250 CEST [DEBUG] AuthChallengeProcessor -
> Authorization challenge processed
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodDirector - Proxy
> authentication scope: BASIC 'XGATE'@10.5.8.66:3128
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodDirector - Proxy
> credentials required
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodDirector - Proxy
> credentials provider not available
> 2005/05/02 15:33:58:250 CEST [INFO] HttpMethodDirector - No credentials
> available for BASIC 'XGATE'@10.5.8.66:3128
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodDirector - CONNECT failed,
> fake the response for the original method
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodBase - Resorting to
> protocol version default close connection policy
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpMethodBase - Should close
> connection, using HTTP/1.0
> 2005/05/02 15:33:58:250 CEST [DEBUG] HttpConnection - Releasing connection
> back to connection manager.HTTP/1.0
>
> 407 Proxy Authentication Required
>
>
> What is the problem ?
>
> Thanks in advance.
>
> Kind regards
> Gebhard Gaukler
>
>
> --
>
> Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org