Index: org/apache/commons/httpclient/TestAuthenticator.java =================================================================== RCS file: /home/cvspublic/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestAuthenticator.java,v retrieving revision 1.24 diff -u -r1.24 TestAuthenticator.java --- org/apache/commons/httpclient/TestAuthenticator.java 7 Apr 2003 19:23:36 -0000 1.24 +++ org/apache/commons/httpclient/TestAuthenticator.java 21 Apr 2003 00:08:08 -0000 @@ -484,6 +484,32 @@ assertEquals(expected, method.getRequestHeader("Authorization").getValue()); } + + public void testNTLMAuthenticationRetry() throws Exception { + NTCredentials cred = new NTCredentials("username", "password", "host", "domain"); + HttpState state = new HttpState(); + state.setCredentials(null, null, cred); + HttpMethod method = new SimpleHttpMethod(); + SimpleHttpConnection conn = new SimpleHttpConnection(); + conn.addResponse( + "HTTP/1.1 401 Unauthorized\r\n" + + "WWW-Authenticate: NTLM\r\n" + + "Connection: close\r\n" + + "Server: HttpClient Test/2.0\r\n"); + conn.addResponse( + "HTTP/1.1 401 Unauthorized\r\n" + + "WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA==\r\n" + + "Connection: close\r\n" + + "Server: HttpClient Test/2.0\r\n"); + conn.addResponse( + "HTTP/1.1 200 OK\r\n" + + "Connection: close\r\n" + + "Server: HttpClient Test/2.0\r\n\r\n" + + "stuff\r\n"); + method.execute(state, conn); + assertNull(method.getResponseHeader("WWW-Authenticate")); + assertEquals(200, method.getStatusCode()); + } /** * Test that the Unauthorized response is returned when doAuthentication is false.