hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phasse <pha...@gmail.com>
Subject Proxy Authentication 407
Date Fri, 30 Nov 2007 08:31:07 GMT

Hi

I have the following code:
		Credentials credentials =  new
org.apache.commons.httpclient.NTCredentials("my username","my password", "my
machine name", "my domain");
        GetMethod defaultpage = new GetMethod("http://webcss.c.com/");
        defaultpage.setFollowRedirects(true);
       
httpclient.getHostConfiguration().getParams().setParameter("http.protocol.cookie-policy",
CookiePolicy.BROWSER_COMPATIBILITY);
        HttpState httpstate=new HttpState();
        httpstate.setProxyCredentials(new AuthScope("my.proxy.server",
AuthScope.ANY_PORT, AuthScope.ANY_REALM),credentials);
		  try {
        httpclient.executeMethod(conf, defaultpage, httpstate);		
		  } catch(Exception e){
			  System.out.println(e.toString());
			  
		  }finally {
			  defaultpage.releaseConnection();
		  }	

I get a return code of 407. I'm not sure how to deal with this problem? Any
help appreciated.

2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Java version: 1.5.0_09
2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Java vendor: Sun
Microsystems Inc.
2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Java class path:
H:\AppData\Eclipse-NLE1\httpProj;H:\User\httpClient\commons-codec.jar;H:\User\httpClient\commons-logging.jar;H:\User\httpClient\commons-httpclient-3.1.jar;H:\User\httpClient\nyc-ssl-0.3.9.jar
2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Operating system name:
Windows XP
2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Operating system
architecture: x86
2007/11/30 09:27:52:168 CET [DEBUG] HttpClient - Operating system version:
5.1
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SUN 1.5: SUN (DSA
key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom;
X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX
CertPathBuilder; LDAP, Collection CertStores)
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA
signature provider
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SunJCE 1.5: SunJCE Provider
(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE,
Diffie-Hellman, HMAC)
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos
v5)
2007/11/30 09:27:52:278 CET [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL,
PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
2007/11/30 09:27:52:293 CET [DEBUG] DefaultHttpParams - Set parameter
http.useragent = Jakarta Commons-HttpClient/3.1
2007/11/30 09:27:52:293 CET [DEBUG] DefaultHttpParams - Set parameter
http.protocol.version = HTTP/1.1
2007/11/30 09:27:52:309 CET [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager
2007/11/30 09:27:52:309 CET [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = default
2007/11/30 09:27:52:309 CET [DEBUG] DefaultHttpParams - Set parameter
http.protocol.element-charset = US-ASCII
2007/11/30 09:27:52:309 CET [DEBUG] DefaultHttpParams - Set parameter
http.protocol.content-charset = ISO-8859-1
2007/11/30 09:27:52:324 CET [DEBUG] DefaultHttpParams - Set parameter
http.method.retry-handler =
org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@7b6889
2007/11/30 09:27:52:324 CET [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]
2007/11/30 09:27:52:465 CET [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = compatibility
2007/11/30 09:27:52:512 CET [DEBUG] HttpConnection - Open connection to
proxy:8080
2007/11/30 09:27:52:528 CET [DEBUG] header - >> "GET http://webcss.c.com/
HTTP/1.1[\r][\n]"
2007/11/30 09:27:52:528 CET [DEBUG] HttpMethodBase - Adding Host request
header
2007/11/30 09:27:52:653 CET [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"
2007/11/30 09:27:52:653 CET [DEBUG] header - >> "Host: webcss.c.com[\r][\n]"
2007/11/30 09:27:52:653 CET [DEBUG] header - >> "Proxy-Connection:
Keep-Alive[\r][\n]"
2007/11/30 09:27:52:653 CET [DEBUG] header - >> "[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Proxy-Authenticate:
NTLM[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Proxy-Authenticate: BASIC
realm="Internet proxy  "[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Cache-Control:
no-cache[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Pragma: no-cache[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Content-Type:
text/html[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Proxy-Connection:
close[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Set-Cookie:
BCSI-CSA48C986C=2; Path=/[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "Content-Length:
1001[\r][\n]"
2007/11/30 09:27:52:668 CET [DEBUG] header - << "[\r][\n]"
2007/11/30 09:27:52:684 CET [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; BCSI-CSA48C986C=2; $Path=/"
2007/11/30 09:27:52:699 CET [DEBUG] HttpMethodDirector - Authorization
required
2007/11/30 09:27:52:778 CET [DEBUG] AuthChallengeProcessor - Supported
authentication schemes in the order of preference: [ntlm, digest, basic]
2007/11/30 09:27:52:778 CET [INFO] AuthChallengeProcessor - ntlm
authentication scheme selected
2007/11/30 09:27:52:778 CET [DEBUG] AuthChallengeProcessor - Using
authentication scheme: ntlm
2007/11/30 09:27:52:778 CET [DEBUG] AuthChallengeProcessor - Authorization
challenge processed
2007/11/30 09:27:52:778 CET [DEBUG] HttpMethodDirector - Proxy
authentication scope: NTLM <any realm>@proxy:8080
2007/11/30 09:27:52:778 CET [DEBUG] HttpMethodDirector - Retry
authentication
2007/11/30 09:27:52:778 CET [DEBUG] HttpMethodBase - Should close connection
in response to directive: close
2007/11/30 09:27:52:778 CET [DEBUG] HttpConnection - Connection is locked. 
Call to releaseConnection() ignored.
2007/11/30 09:27:52:778 CET [DEBUG] HttpMethodDirector - Authenticating with
NTLM <any realm>@proxy:8080
2007/11/30 09:27:52:778 CET [DEBUG] HttpMethodParams - Credential charset
not configured, using HTTP element charset
2007/11/30 09:27:52:793 CET [DEBUG] HttpConnection - Open connection to
proxy:8080
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "GET http://webcss.c.com/
HTTP/1.1[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodBase - Adding Host request
header
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "Proxy-Connection:
Keep-Alive[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "Proxy-Authorization: NTLM
TlRMTVNTUAABAAAABlIAAAMAAwA7AAAAGwAbACAAAABXUEQyNDYyMS5WQVIuTkwuRk9SVElTLkJBTktJTlQ=[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "Host: webcss.c.com[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "Cookie: $Version=0;
BCSI-CSA48C986C=2; $Path=/[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - >> "[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Proxy-Authenticate: NTLM
TlRMTVNTUAACAAAACAAIADAAAAAGAgEAdc7LoJ/8VrIAAAAAAAAAAAAAAAA4AAAAREJBRDAwMDA=[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Cache-Control:
no-cache[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Pragma: no-cache[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Content-Type:
text/html[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Proxy-Connection:
Keep-Alive[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Set-Cookie:
BCSI-CSA48C986C=2; Path=/[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Connection:
Keep-Alive[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "Content-Length:
1021[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] header - << "[\r][\n]"
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; BCSI-CSA48C986C=2; $Path=/"
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodDirector - Authorization
required
2007/11/30 09:27:52:793 CET [DEBUG] AuthChallengeProcessor - Using
authentication scheme: ntlm
2007/11/30 09:27:52:793 CET [DEBUG] AuthChallengeProcessor - Authorization
challenge processed
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodDirector - Proxy
authentication scope: NTLM <any realm>@proxy:8080
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodDirector - Retry
authentication
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodBase - Should NOT close
connection in response to directive: Keep-Alive
2007/11/30 09:27:52:793 CET [DEBUG] HttpConnection - Connection is locked. 
Call to releaseConnection() ignored.
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodDirector - Authenticating with
NTLM <any realm>@proxy:8080
2007/11/30 09:27:52:793 CET [DEBUG] HttpMethodParams - Credential charset
not configured, using HTTP element charset
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "GET http://webcss.c.com/
HTTP/1.1[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] HttpMethodBase - Adding Host request
header
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "Proxy-Connection:
Keep-Alive[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "Proxy-Authorization: NTLM
TlRMTVNTUAADAAAAGAAYAGQAAAAAAAAAfAAAAAMAAwBAAAAABgAGAEMAAAAbABsASQAAAAAAAAB8AAAABlIAAElOVFgxOTUzNldQRDI0NjIxLlZBUi5OTC5GT1JUSVMuQkFOS8B0u7R7X5ASTEO9fYsMIzXInEKDIIZ9Uw==[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "Host: webcss.c.com[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "Cookie: $Version=0;
BCSI-CSA48C986C=2; $Path=/[\r][\n]"
2007/11/30 09:27:53:028 CET [DEBUG] header - >> "[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "HTTP/1.1 407 Proxy
Authentication Required[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Proxy-Authenticate:
NTLM[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Proxy-Authenticate: BASIC
realm="Internet proxy  "[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Cache-Control:
no-cache[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Pragma: no-cache[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Content-Type:
text/html[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Proxy-Connection:
close[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Set-Cookie:
BCSI-CSA48C986C=2; Path=/[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "Content-Length:
1054[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] header - << "[\r][\n]"
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=0; BCSI-CSA48C986C=2; $Path=/"
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodDirector - Authorization
required
2007/11/30 09:27:56:074 CET [DEBUG] AuthChallengeProcessor - Using
authentication scheme: ntlm
2007/11/30 09:27:56:074 CET [DEBUG] AuthChallengeProcessor - Authorization
challenge processed
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodDirector - Proxy
authentication scope: NTLM <any realm>@proxy:8080
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodDirector - Proxy credentials
required
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodDirector - Proxy credentials
provider not available
2007/11/30 09:27:56:074 CET [INFO] HttpMethodDirector - Failure
authenticating with NTLM <any realm>@proxy:8080
return code: 407
2007/11/30 09:27:56:074 CET [DEBUG] HttpMethodBase - Should close connection
in response to directive: close
2007/11/30 09:27:56:074 CET [DEBUG] HttpConnection - Releasing connection
back to connection manager.


thanks
-- 
View this message in context: http://www.nabble.com/Proxy-Authentication-407-tf4902125.html#a14042374
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Mime
View raw message