Looks like the mail list removes attachments...it can be viewed here:

http://www.anassina.com/~arustad/httpclient.jpg


-----Original Message-----
From: Rustad, Aaron 
Sent: September 25, 2003 9:33 AM
To: '[EMAIL PROTECTED]'
Subject: How do I get passed my NT Proxy?



OK, I know this questioned has been asked many times, and I am afraid that I
have to ask once more. I have looked through the archived mailing list, and
investigated the JavaDocs, but I just can't get it to work. 

If I can get this figured out with your help, I promise to put an end to
NTML questions buy writing up a good HOWTO and either put it on my website
or submit to the HTTPClient project to include in their documentation.

Here is the code that I have right now (pretty standard I think):

---
HttpClient client = new HttpClient();

client.getHostConfiguration().setProxy("proxy.comp.com", 80);
client.getHostConfiguration().setHost("blackcomb", 80);

NTCredentials credentials = new NTCredentials("username", "password",
"blackcomb", "comp.com");

client.getState().setProxyCredentials(null, credentials);

GetMethod get = new GetMethod("http://www.yahoo.com";);
client.executeMethod(get);
---

When I execute the above code, I get these debug statements:

---

2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Java version: 1.4.2
2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Java vendor: Sun
Microsystems Inc.
2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Java class path:
.;httpclient.jar;commons-logging.jar
2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Operating system name:
Windows NT
2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Operating system
architecture: x86
2003/09/25 08:13:57:724 PDT [DEBUG] HttpClient - -Operating system version:
4.0
2003/09/25 08:13:58:083 PDT [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)
2003/09/25 08:13:58:083 PDT [DEBUG] HttpClient - -SunJSSE 1.42: Sun JSSE
provider(implements RSA Signatures, PKCS12, SunX509 key/trust factories,
SSLv3, TLSv1)
2003/09/25 08:13:58:083 PDT [DEBUG] HttpClient - -SunRsaSign 1.42: SUN's
provider for RSA signatures
2003/09/25 08:13:58:083 PDT [DEBUG] HttpClient - -SunJCE 1.42: SunJCE
Provider (implements DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman,
HMAC-MD5, HMAC-SHA1)
2003/09/25 08:13:58:099 PDT [DEBUG] HttpClient - -SunJGSS 1.0: Sun (Kerberos
v5)
2003/09/25 08:13:58:240 PDT [DEBUG] HttpConnection -
-HttpConnection.setSoTimeout(0)
2003/09/25 08:13:58:271 PDT [DEBUG] HttpMethodBase - -Execute loop try 1
2003/09/25 08:13:58:286 PDT [DEBUG] wire - ->> "GET http://www.yahoo.com/
HTTP/1.1[\r][\n]"
2003/09/25 08:13:58:302 PDT [DEBUG] HttpMethodBase - -Adding Host request
header
2003/09/25 08:13:58:318 PDT [DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0rc1[\r][\n]"
2003/09/25 08:13:58:318 PDT [DEBUG] wire - ->> "Host: www.yahoo.com[\r][\n]"
2003/09/25 08:13:58:318 PDT [DEBUG] wire - ->> "Proxy-Connection:
Keep-Alive[\r][\n]"
2003/09/25 08:13:58:318 PDT [DEBUG] wire - ->> "[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] wire - -<< "HTTP/1.1 407 Proxy Access
Denied[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] wire - -<< "Server:
Microsoft-IIS/4.0[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] wire - -<< "Date: Thu, 25 Sep 2003
15:14:00 GMT[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] wire - -<< "Connection: close[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] wire - -<< "Proxy-Authenticate:
NTLM[\r][\n]"
2003/09/25 08:13:58:333 PDT [DEBUG] HttpMethodBase - -Authorization required
2003/09/25 08:13:58:349 PDT [DEBUG] HttpAuthenticator - -Using
'www.yahoo.com' authentication realm
2003/09/25 08:13:58:365 PDT [DEBUG] HttpMethodBase -
-HttpMethodBase.execute(): Server demanded authentication credentials, will
try again.
2003/09/25 08:13:58:365 PDT [DEBUG] HttpMethodBase - -Should forcefully
close connection.
2003/09/25 08:13:58:365 PDT [DEBUG] HttpMethodBase - -Execute loop try 2
2003/09/25 08:13:58:365 PDT [DEBUG] HttpMethodBase - -Opening the
connection.
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "GET http://www.yahoo.com/
HTTP/1.1[\r][\n]"
2003/09/25 08:13:58:380 PDT [DEBUG] HttpMethodBase - -Request to add Host
header ignored: header already added
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0rc1[\r][\n]"
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "Host: www.yahoo.com[\r][\n]"
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "Proxy-Authorization: NTLM
TlRMTVNTUAABAAAABlIAAAgACAApAAAACQAJACAAAABCTEFDS0NPTUJCQ0dBU0RPTQ==[\r][\n]
"
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "Proxy-Connection:
Keep-Alive[\r][\n]"
2003/09/25 08:13:58:380 PDT [DEBUG] wire - ->> "[\r][\n]"
2003/09/25 08:13:58:396 PDT [DEBUG] wire - -<< "HTTP/1.1 407 Proxy
authentication required[\r][\n]"
2003/09/25 08:13:58:411 PDT [DEBUG] wire - -<< "Proxy-Authenticate: NTLM
TlRMTVNTUAACAAAACAAIADAAAAAGAgEAhhgbEPEbj/IAAAAAAAAAAAAAAAA4AAAAQkNHQVNET00=
[\r][\n]"
2003/09/25 08:13:58:411 PDT [DEBUG] wire - -<< "Content-Length: 503[\r][\n]"
2003/09/25 08:13:58:411 PDT [DEBUG] wire - -<< "Content-Type:
text/html[\r][\n]"
2003/09/25 08:13:58:411 PDT [DEBUG] HttpMethodBase - -Authorization required
2003/09/25 08:13:58:411 PDT [DEBUG] HttpAuthenticator - -Using
'www.yahoo.com' authentication realm
2003/09/25 08:13:59:177 PDT [DEBUG] HttpMethodBase -
-HttpMethodBase.execute(): Server demanded authentication credentials, will
try again.
2003/09/25 08:13:59:177 PDT [DEBUG] wire - -<< "<html><head><title>Error
407</title>[\r][\n]"
2003/09/25 08:13:59:177 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:177 PDT [DEBUG] wire - -<< "<meta name="robots"
content="noindex">[\r][\n]"
2003/09/25 08:13:59:177 PDT [DEBUG] wire - -<< "<META
HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1"></head>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "<body>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "<h2>HTTP Error
407</h2>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "<p><strong>407 Proxy
Authentication Required</strong></p>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "<p>You must authenticate
with a proxy server before this request can be serviced.  Please log on to
your proxy server, and then try again.</p>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "<p>Please contact the Web
server's administrator if this problem persists.</p>[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "[\r][\n]"
2003/09/25 08:13:59:193 PDT [DEBUG] wire - -<< "</body></html>"
2003/09/25 08:13:59:193 PDT [DEBUG] HttpMethodBase - -Should forcefully
close connection.
2003/09/25 08:13:59:193 PDT [DEBUG] HttpMethodBase - -Execute loop try 3
2003/09/25 08:13:59:193 PDT [DEBUG] HttpMethodBase - -Opening the
connection.
2003/09/25 08:13:59:208 PDT [DEBUG] wire - ->> "GET http://www.yahoo.com/
HTTP/1.1[\r][\n]"
2003/09/25 08:13:59:208 PDT [DEBUG] HttpMethodBase - -Request to add Host
header ignored: header already added
2003/09/25 08:13:59:208 PDT [DEBUG] wire - ->> "User-Agent: Jakarta
Commons-HttpClient/2.0rc1[\r][\n]"
2003/09/25 08:13:59:208 PDT [DEBUG] wire - ->> "Host: www.yahoo.com[\r][\n]"
2003/09/25 08:13:59:208 PDT [DEBUG] wire - ->> "Proxy-Authorization: NTLM
TlRMTVNTUAADAAAAGAAYAFgAAAAAAAAAcAAAAAgACABAAAAABwAHAEgAAAAJAAkATwAAAAAAAABw
AAAABlIAAEJDR0FTRE9NQVJVU1RBREJMQUNLQ09NQgimJK4q/qLiJ5c734kNuET+zYwi24NCgQ==
[\r][\n]"
2003/09/25 08:13:59:224 PDT [DEBUG] wire - ->> "Proxy-Connection:
Keep-Alive[\r][\n]"
2003/09/25 08:13:59:224 PDT [DEBUG] wire - ->> "[\r][\n]"
2003/09/25 08:13:59:286 PDT [DEBUG] wire - -<< "HTTP/1.1 407 Proxy
authentication required[\r][\n]"
2003/09/25 08:13:59:302 PDT [DEBUG] wire - -<< "Proxy-Authenticate:
NTLM[\r][\n]"
2003/09/25 08:13:59:302 PDT [DEBUG] wire - -<< "Proxy-Connection:
close[\r][\n]"
2003/09/25 08:13:59:302 PDT [DEBUG] wire - -<< "Content-Length: 503[\r][\n]"
2003/09/25 08:13:59:302 PDT [DEBUG] wire - -<< "Content-Type:
text/html[\r][\n]"
2003/09/25 08:13:59:302 PDT [DEBUG] HttpMethodBase - -Authorization required
2003/09/25 08:13:59:302 PDT [INFO] HttpMethodBase - -Already tried to
authenticate to "www.yahoo.com#" but still receiving 407.
Status: 407

-----


I have also attached a small JPG to this e-mail, it illustrates the
configuration of the various components/computers involved, with arrows
pointing to the code.

If someone could look at this and see if I have the code correct, it would
be of great assistence. 

Thanks for all your help!
Aaron.

---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to