Additional test case is connecting host without proxy setting. I got an exception msg: Exception in thread "main" java.net.ConnectException: Connection timed out: conn ect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c reateSocket(DefaultProtocolSocketFactory.java:86) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java :651) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:628) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:497) at auth.main(auth.java:173)
I think this error makes sense because internet access is required to go through a proxy server from this IP address. So it looks like the proxy setting I added though client.getState().setAuthenticationPreemptive(true); client.getHostConfiguration().setProxy(proxyhost, 80); client.getState().setProxyCredentials(null, proxyhost, new UsernamePasswordCredentials(proxyusername, proxypwd)); does not satisfy the proxy requirement for the IP address. Our old code using HTTPURLConnection (which means "System.getProperties().put("proxySet", "true");....") worked fine. -----Original Message----- From: Lili Liu [mailto:[EMAIL PROTECTED] Sent: Monday, May 10, 2004 10:02 AM To: 'Commons HttpClient Project' Subject: RE: proxy authentication The log msg is attached. The program waits for a while after "Proxy-Connection: Keep-Alive" line and throws a 504 error (connection time out). lili Thanks. -----Original Message----- From: Michael Becke [mailto:[EMAIL PROTECTED] Sent: Sunday, May 09, 2004 6:21 PM To: Commons HttpClient Project Subject: Re: proxy authentication Hi lili, It sounds like an internal problem with the proxy server, but it's difficult to tell. If you post a wire log <http://jakarta.apache.org/commons/httpclient/logging.html> we should be able to get a better idea of what's happening. Mike On May 9, 2004, at 7:30 PM, Lili Liu wrote: > > My proxy authentication code (basic host) works well unless I ran it > on a > special IP address. > The internet traffic on this special IP has to go through a proxy > server > (The same proxy I used in the code). > In another word, if I access internet using a browser, I have to > specify a > valid proxy server. Otherwise, there is no internet access. > > My proxy authentication code is as follows: > > client.getState().setAuthenticationPreemptive(true); > client.getHostConfiguration().setProxy(proxyhost, > 80); > client.getState().setProxyCredentials(null, > proxyhost, > new > UsernamePasswordCredentials(proxyusername, proxypwd)); > > And I got the follwing error msg: > > May 9, 2004 4:13:01 PM org.apache.commons.httpclient.HttpMethodBase > readResponseBody > WARNING: Response content length is not known > status is .....504 > Proxy Error ( Connection timed out ) > Via: 1.1 PROXY02 > > Pragma: no-cache > > Cache-Control: no-cache > > Content-Type: text/html > > If I ran the program not from the special IP address, I got following > success msg: > > May 9, 2004 4:07:01 PM org.apache.commons.httpclient.HttpMethodBase > processAuthenticationResponse > Via: 1.1 PROXY02 > > Proxy-Connection: Keep-Alive > > Content-Length: 4431 > > Content-Type: text/html > > Server: Microsoft-IIS/5.1 > > Date: Sun, 09 May 2004 23:07:01 GMT > > WWW-Authenticate: Basic realm="INXIGHT" > > ---------------Basic realm="INXIGHT" > Trying basic authetication > OK > 200 > > > Any help is appreciated! > lili > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]