From 6f4053cab701d40aeb1fdcf8c8fea7004d5116a5 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Thu, 19 Jul 2012 13:15:27 -0700 Subject: [PATCH] HER-2016 FetchHTTP tries every url twice without credentials before sending credentials * FetchHTTP.java configureHttp() - enable preemptive authentication parameter innerProcess() - do not call method.setDoAuthentication() (it's for automatic 401 handling which is not what we want) --- .../src/main/java/org/archive/modules/fetcher/FetchHTTP.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/src/main/java/org/archive/modules/fetcher/FetchHTTP.java b/modules/src/main/java/org/archive/modules/fetcher/FetchHTTP.java index f0580160..1c020759 100644 --- a/modules/src/main/java/org/archive/modules/fetcher/FetchHTTP.java +++ b/modules/src/main/java/org/archive/modules/fetcher/FetchHTTP.java @@ -633,7 +633,6 @@ public class FetchHTTP extends Processor implements Lifecycle { if (http.getState().getProxyCredentials(new AuthScope(getProxyHost(), getProxyPort())) != null) { addedCredentials = true; } - method.setDoAuthentication(addedCredentials); // set hardMax on bytes (if set by operator) long hardMax = getMaxLengthBytes(); @@ -1451,6 +1450,8 @@ public class FetchHTTP extends Processor implements Lifecycle { hcp.setSoTimeout(timeout); // Set client to be version 1.0. hcp.setVersion(HttpVersion.HTTP_1_0); + // We handle 401s, so when we do auth, we want it preemptive. + hcp.setAuthenticationPreemptive(true); // configureHttpCookies(defaults);