Issue #3234 - AuthenticationProtocolHandler should not cache the failed results.

Fixed failing test.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-02-02 18:56:58 +01:00
parent 33bceb3cc8
commit 9af4707556
2 changed files with 6 additions and 5 deletions

View File

@ -103,6 +103,7 @@ public class BasicAuthentication extends AbstractAuthentication
@Override @Override
public void apply(Request request) public void apply(Request request)
{ {
if (!request.getHeaders().contains(header, value))
request.header(header, value); request.header(header, value);
} }

View File

@ -18,8 +18,6 @@
package org.eclipse.jetty.client; package org.eclipse.jetty.client;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -41,6 +39,8 @@ import org.eclipse.jetty.util.B64Code;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.provider.ArgumentsSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HttpClientProxyTest extends AbstractHttpClientServerTest public class HttpClientProxyTest extends AbstractHttpClientServerTest
{ {
@ParameterizedTest @ParameterizedTest
@ -315,7 +315,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
assertEquals(status, response1.getStatus()); assertEquals(status, response1.getStatus());
assertEquals(3, requests.get()); assertEquals(3, requests.get());
// Make again the request, authentication is cached, expect 204. // Make again the request, only the server authentication is cached, expect 407 + 204.
requests.set(0); requests.set(0);
ContentResponse response2 = client.newRequest(serverHost, serverPort) ContentResponse response2 = client.newRequest(serverHost, serverPort)
.scheme(scenario.getScheme()) .scheme(scenario.getScheme())
@ -323,7 +323,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
.send(); .send();
assertEquals(status, response2.getStatus()); assertEquals(status, response2.getStatus());
assertEquals(1, requests.get()); assertEquals(2, requests.get());
} }
@ParameterizedTest @ParameterizedTest