[jcifs] problem when use jcifs ntlm auth for http connection

eglass1 at comcast.net eglass1 at comcast.net
Tue Jun 15 07:51:35 GMT 2004


I'll take a look at this (I think this is a pretty easy one to fix, and I've been
planning to look at the NtlmHttpURLConnection to address an open issue
regarding POSTs as well).

As an immediate workaround, setting the system property "http.maxRedirects"
to a lower value should remediate this behavior (currently, this setting is
used to determine how many times authentication is attempted).  This will
also affect the number of redirects your HTTP client will follow, however.  You
can also set up a java.net.Authenticator to prompt the end user for new
credentials, if appropriate in your environment (i.e., an end user is there
to enter the credentials).

Eric


> Hi,
> 
> I tried the example program: NtlmHttpClient.java, it works for me except when I 
> tried the failure test case, it takes for a while ( ~15 sec) to retrun back to 
> me and got the exception:
> 
> Caused by: java.net.ProtocolException: Server redirected too many  times (20)
> 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream
> (HttpURLConnection.java:800)
> 	at sun.net.www.protocol.http.HttpURLConnection.getHeaderField
> (HttpURLConnection.java:1479)
> 	at jcifs.http.NtlmHttpURLConnection.parseResponseCode
> (NtlmHttpURLConnection.java:408)
> 	at jcifs.http.NtlmHttpURLConnection.doConnect
> (NtlmHttpURLConnection.java:439)
> ...
> 
> 
> I tried jcifs.smb.client.soTimeout to set to smaller number (2000) but it 
> doesn't seem to work. I need the control to return back much faster when login 
> failed, else, it will cause big issue in heavily loaded system
> 
> thanks
> 


More information about the jcifs mailing list