[jcifs] Why would auth work on one server and not on another?

eglass1 at comcast.net eglass1 at comcast.net
Fri Jul 11 05:20:09 EST 2003


> 
> Any suggestions why it might a connection under 1 server and work fine on
> another?  If a packet capture of a working server is needed, I can provide
> that as well.
> 

I actually should have picked up on this earlier (given that it worked under
Tomcat, and the packet trace indicates an HTML body in the error response).
The container is treating the setStatus(401) as an error (the same as 
a sendError); it closes the connection and sends a default error page.  What
*should* be happening is that you set the status to 401, set the content
length to 0, and the user gets a blank page with a 401 status and a persistent
connection.

Your last-ditch attempt would maybe be to explicitly do:

    resp.setHeader("Connection", "Keep-Alive");

Try putting it right before the resp.setContentLength(0), or maybe right after
the resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED).

Chances are, however, that the container will ignore it and close the
connection, in which case you don't have too many options. :(

You could always take out the NTLM authentication offers and just use basic,
but that's probably not the answer you were looking for.

Eric



More information about the jcifs mailing list