Apache Solr open-source search software
SOLR-17876: Http2SolrClient: followRedirects=true flaky (#3505)
David Smiley7301af08f901
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex a347487d8ee..b0db1b41664 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -263,6 +263,10 @@ Bug Fixes* SOLR-17871: Http2SolrClient wasn't honoring idle timeout configuration above 30 seconds -- a regression. (Thomas Wöckinger, David Smiley)+* SOLR-17876: Http2SolrClient: followRedirects=true: if Http2SolrClient was created with followRedirects=true,+ and then was used to create future clients (via builder.withHttpClient), then redirect processing was wrongly+ disabled on the shared instance. (David Smiley)+Dependency Upgrades---------------------(No changes)diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.javaindex 8e7b871236f..6123fa5ea98 100644--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java@@ -152,11 +152,12 @@ public class Http2SolrClient extends HttpSolrClientBase {this.httpClient = createHttpClient(builder);this.closeClient = true;}+ // note: do not manipulate httpClient below this point; it could be a shared instance+if (builder.listenerFactory != null) {this.listenerFactory.addAll(builder.listenerFactory);}updateDefaultMimeTypeForParser();- this.httpClient.setFollowRedirects(Boolean.TRUE.equals(builder.followRedirects));this.idleTimeoutMillis = builder.getIdleTimeoutMillis();try {@@ -291,7 +292,7 @@ public class Http2SolrClient extends HttpSolrClientBase {httpClient.setExecutor(this.executor);httpClient.setStrictEventOrdering(false);httpClient.setConnectBlocking(true);- httpClient.setFollowRedirects(false);+ httpClient.setFollowRedirects(Boolean.TRUE.equals(builder.followRedirects));httpClient.setMaxRequestsQueuedPerDestination(asyncTracker.getMaxRequestsQueuedPerDestination());httpClient.setUserAgentField(new HttpField(HttpHeader.USER_AGENT, USER_AGENT));