Hi all, I don't seem to make the ClientProxyAuthentication [1] example work with BASIC authentication. I've tried HttpClient 4.1, 4.2-a, 4.2-a2. I've tested the proxy using curl and it works fine. Below is my log output.
I appreciate any guidance you can give me, Best regards, Luciano. executing request: GET / HTTP/1.1 via proxy: http://144.72.225.21:80 to target: https://www.google.com:443 2012/01/22 15:12:14:142 VET [DEBUG] PoolingClientConnectionManager - Connection request: [route: {tls}->http://144.72.225.21:80->https://www.google.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] 2012/01/22 15:12:14:157 VET [DEBUG] PoolingClientConnectionManager - Connection leased: [id: 0][route: {tls}->http://144.72.225.21:80->https://www.google.com:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20] 2012/01/22 15:12:14:161 VET [DEBUG] DefaultClientConnectionOperator - Connecting to 144.72.225.21:80 2012/01/22 15:12:14:381 VET [DEBUG] RequestAuthCache - Auth cache not set in the context 2012/01/22 15:12:14:381 VET [DEBUG] RequestProxyAuthentication - Proxy auth state: UNCHALLENGED 2012/01/22 15:12:14:381 VET [DEBUG] DefaultClientConnection - Sending request: CONNECT www.google.com:443 HTTP/1.1 2012/01/22 15:12:14:382 VET [DEBUG] wire - >> "CONNECT www.google.com:443 HTTP/1.1[\r][\n]" 2012/01/22 15:12:14:383 VET [DEBUG] wire - >> "Host: www.google.com:443[\r][\n]" 2012/01/22 15:12:14:383 VET [DEBUG] wire - >> "Proxy-Connection: Keep-Alive[\r][\n]" 2012/01/22 15:12:14:383 VET [DEBUG] wire - >> "User-Agent: Apache-HttpClient/4.2-alpha2-SNAPSHOT (java 1.5)[\r][\n]" 2012/01/22 15:12:14:383 VET [DEBUG] wire - >> "[\r][\n]" 2012/01/22 15:12:14:689 VET [DEBUG] wire - << "HTTP/1.1 407 Proxy Authentication Required[\r][\n]" 2012/01/22 15:12:14:692 VET [DEBUG] wire - << "Proxy-Authenticate: NTLM[\r][\n]" 2012/01/22 15:12:14:692 VET [DEBUG] wire - << "Cache-Control: no-cache[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Pragma: no-cache[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Content-Type: text/html; charset=utf-8[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Proxy-Connection: close[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Set-Cookie: BCSI-CS-55C094B95EA91622=2; Path=/[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Connection: close[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "Content-Length: 813[\r][\n]" 2012/01/22 15:12:14:693 VET [DEBUG] wire - << "[\r][\n]" 2012/01/22 15:12:14:694 VET [DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 407 Proxy Authentication Required 2012/01/22 15:12:14:695 VET [DEBUG] ResponseProcessCookies - Cookie spec not specified in HTTP context 2012/01/22 15:12:14:695 VET [DEBUG] DefaultHttpClient - 144.72.225.21:80 requested authentication 2012/01/22 15:12:14:696 VET [DEBUG] ProxyAuthenticationStrategy - Authentication schemes in the order of preference: [Negotiate, Kerberos, NTLM, Digest, Basic] 2012/01/22 15:12:14:696 VET [DEBUG] ProxyAuthenticationStrategy - Challenge for Negotiate authentication scheme not available 2012/01/22 15:12:14:696 VET [DEBUG] ProxyAuthenticationStrategy - Challenge for Kerberos authentication scheme not available 2012/01/22 15:12:14:700 VET [DEBUG] ProxyAuthenticationStrategy - Challenge for Digest authentication scheme not available 2012/01/22 15:12:14:700 VET [DEBUG] ProxyAuthenticationStrategy - Challenge for Basic authentication scheme not available 2012/01/22 15:12:14:701 VET [DEBUG] DefaultHttpClient - Selected authentication options: [NTLM] 2012/01/22 15:12:14:702 VET [DEBUG] DefaultClientConnection - Connection 0.0.0.0:53537<->144.72.225.21:80 closed 2012/01/22 15:12:14:702 VET [DEBUG] DefaultClientConnectionOperator - Connecting to 144.72.225.21:80 2012/01/22 15:12:15:357 VET [DEBUG] RequestAuthCache - Auth cache not set in the context 2012/01/22 15:12:15:357 VET [DEBUG] RequestProxyAuthentication - Proxy auth state: CHALLENGED 2012/01/22 15:12:15:357 VET [DEBUG] RequestProxyAuthentication - Generating response to an authentication challenge using ntlm scheme 2012/01/22 15:12:15:358 VET [WARN] RequestProxyAuthentication - NTLM authentication error: Credentials cannot be used for NTLM authentication: org.apache.http.auth.UsernamePasswordCredentials 2012/01/22 15:12:15:358 VET [DEBUG] DefaultClientConnection - Sending request: CONNECT www.google.com:443 HTTP/1.1 2012/01/22 15:12:15:358 VET [DEBUG] wire - >> "CONNECT www.google.com:443 HTTP/1.1[\r][\n]" 2012/01/22 15:12:15:358 VET [DEBUG] wire - >> "Host: www.google.com:443[\r][\n]" 2012/01/22 15:12:15:358 VET [DEBUG] wire - >> "Proxy-Connection: Keep-Alive[\r][\n]" 2012/01/22 15:12:15:358 VET [DEBUG] wire - >> "User-Agent: Apache-HttpClient/4.2-alpha2-SNAPSHOT (java 1.5)[\r][\n]" 2012/01/22 15:12:15:358 VET [DEBUG] wire - >> "[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "HTTP/1.1 407 Proxy Authentication Required[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "Proxy-Authenticate: NTLM[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "Cache-Control: no-cache[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "Pragma: no-cache[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "Content-Type: text/html; charset=utf-8[\r][\n]" 2012/01/22 15:12:15:660 VET [DEBUG] wire - << "Proxy-Connection: close[\r][\n]" 2012/01/22 15:12:15:661 VET [DEBUG] wire - << "Set-Cookie: BCSI-CS-55C094B95EA91622=2; Path=/[\r][\n]" 2012/01/22 15:12:15:661 VET [DEBUG] wire - << "Connection: close[\r][\n]" 2012/01/22 15:12:15:661 VET [DEBUG] wire - << "Content-Length: 813[\r][\n]" 2012/01/22 15:12:15:661 VET [DEBUG] wire - << "[\r][\n]" 2012/01/22 15:12:15:661 VET [DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 407 Proxy Authentication Required 2012/01/22 15:12:15:661 VET [DEBUG] ResponseProcessCookies - Cookie spec not specified in HTTP context 2012/01/22 15:12:15:661 VET [DEBUG] DefaultHttpClient - 144.72.225.21:80 requested authentication 2012/01/22 15:12:15:661 VET [DEBUG] DefaultHttpClient - Authorization challenge processed 2012/01/22 15:12:15:661 VET [DEBUG] DefaultHttpClient - Authentication failed 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<HTML><HEAD>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<TITLE>Access Denied</TITLE>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "</HEAD>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<BODY>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<big><strong></strong></big><BR>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<blockquote>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<TABLE border=0 cellPadding=1 width="80%">[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<TR><TD>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<big>Access Denied (authentication_failed)</big>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<BR>[\n]" 2012/01/22 15:12:15:663 VET [DEBUG] wire - << "<BR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</TD></TR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "<TR><TD>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</TD></TR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "<TR><TD>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "This is typically caused by an incorrect username and/or password, but could also be caused by network problems.[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</TD></TR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "<TR><TD>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "<BR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "For assistance, contact your network support team.[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</TD></TR>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</TABLE>[\n]" 2012/01/22 15:12:15:664 VET [DEBUG] wire - << "</blockquote>[\n]" 2012/01/22 15:12:15:665 VET [DEBUG] wire - << "[\n]" 2012/01/22 15:12:15:665 VET [DEBUG] wire - << "</BODY></HTML>[\n]" 2012/01/22 15:12:15:665 VET [DEBUG] DefaultClientConnection - Connection 0.0.0.0:53538<->144.72.225.21:80 closed ---------------------------------------- HTTP/1.1 407 Proxy Authentication Required Response content length: 813 2012/01/22 15:12:15:665 VET [DEBUG] DefaultHttpClient - CONNECT refused by proxy: HTTP/1.1 407 Proxy Authentication Required 2012/01/22 15:12:15:665 VET [DEBUG] PoolingClientConnectionManager - Connection [id: 0][route: {tls}->http://144.72.225.21:80->https://www.google.com:443] can be kept alive for 9223372036854775807 MILLISECONDS 2012/01/22 15:12:15:665 VET [DEBUG] DefaultClientConnection - Connection 0.0.0.0:53538<->144.72.225.21:80 closed 2012/01/22 15:12:15:665 VET [DEBUG] PoolingClientConnectionManager - Connection released: [id: 0][route: {tls}->http://144.72.225.21:80->https://www.google.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20] 2012/01/22 15:12:15:665 VET [DEBUG] PoolingClientConnectionManager - Connection manager is shutting down 2012/01/22 15:12:15:666 VET [DEBUG] PoolingClientConnectionManager - Connection manager shut down [1] http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientProxyAuthentication.java -- View this message in context: http://old.nabble.com/Challenge-for-Basic-authentication-scheme-not-available-%28-%29-tp33184745p33184745.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
