Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17872: Remove org.apache.http dependency from compile scope (#3498)

David Smileyd5aaf27ba5e1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b0db1b41664..dee3965495b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -149,6 +149,10 @@ Deprecation Removals
* SOLR-17742: Removed the handleSelect option of <requestDispatcher>. (Gaurav Tuli, David Smiley)
+* SOLR-17872: Solr no longer uses Apache HttpClient. Nonetheless SolrJ still includes deprecated SolrClient implementations
+ for that (which will be removed eventually), and many tests still use it. Also, there were server metrics
+ relating to HTTP client connection pools that no longer exist. (David Smiley)
+
Dependency Upgrades
---------------------
diff --git a/solr/api/gradle.lockfile b/solr/api/gradle.lockfile
index b55a8365352..c30e5506f90 100644
--- a/solr/api/gradle.lockfile
+++ b/solr/api/gradle.lockfile
@@ -105,9 +105,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=jarValidation,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=jarValidation,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=jarValidation,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,testRuntimeClasspath
diff --git a/solr/benchmark/gradle.lockfile b/solr/benchmark/gradle.lockfile
index d780ad0799e..805cc1a7ae6 100644
--- a/solr/benchmark/gradle.lockfile
+++ b/solr/benchmark/gradle.lockfile
@@ -76,9 +76,9 @@ org.apache.commons:commons-math3:3.6.1=annotationProcessor,compileClasspath,jarV
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,runtimeClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,runtimeClasspath,testRuntimeClasspath
diff --git a/solr/core/build.gradle b/solr/core/build.gradle
index 0390710a170..5f0d78f2d4e 100644
--- a/solr/core/build.gradle
+++ b/solr/core/build.gradle
@@ -117,9 +117,6 @@ dependencies {
implementation libs.fasterxml.jackson.dataformat.smile
implementation libs.fasterxml.jackson.dataformat.cbor
- implementation libs.apache.httpcomponents.httpclient
- implementation libs.apache.httpcomponents.httpcore
-
implementation libs.eclipse.jetty.client
implementation libs.eclipse.jetty.http
implementation libs.eclipse.jetty.io
@@ -210,4 +207,6 @@ dependencies {
testRuntimeOnly(libs.mockito.subclass, {
exclude group: "net.bytebuddy", module: "byte-buddy-agent"
})
+ testImplementation libs.apache.httpcomponents.httpclient
+ testImplementation libs.apache.httpcomponents.httpcore
}
diff --git a/solr/core/gradle.lockfile b/solr/core/gradle.lockfile
index 818d61f584f..f3a0e831467 100644
--- a/solr/core/gradle.lockfile
+++ b/solr/core/gradle.lockfile
@@ -88,9 +88,9 @@ org.apache.commons:commons-math3:3.6.1=apiHelper,compileClasspath,jarValidation,
org.apache.curator:curator-client:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 83f7657bc51..f79148804b4 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -55,9 +55,6 @@ import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import org.apache.http.auth.AuthSchemeProvider;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.config.Lookup;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.Directory;
@@ -67,11 +64,6 @@ import org.apache.solr.api.ContainerPluginsRegistry;
import org.apache.solr.api.JerseyResource;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder;
-import org.apache.solr.client.solrj.impl.SolrHttpClientContextBuilder;
-import org.apache.solr.client.solrj.impl.SolrHttpClientContextBuilder.AuthSchemeRegistryProvider;
-import org.apache.solr.client.solrj.impl.SolrHttpClientContextBuilder.CredentialsProviderProvider;
import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.util.SolrIdentifierValidator;
import org.apache.solr.cloud.CloudDescriptor;
@@ -148,7 +140,6 @@ import org.apache.solr.security.AllowListUrlChecker;
import org.apache.solr.security.AuditLoggerPlugin;
import org.apache.solr.security.AuthenticationPlugin;
import org.apache.solr.security.AuthorizationPlugin;
-import org.apache.solr.security.HttpClientBuilderPlugin;
import org.apache.solr.security.PKIAuthenticationPlugin;
import org.apache.solr.security.PublicKeyHandler;
import org.apache.solr.security.SecurityPluginHolder;
@@ -594,58 +585,10 @@ public class CoreContainer {
}
private void setupHttpClientForAuthPlugin(Object authcPlugin) {
- if (authcPlugin instanceof HttpClientBuilderPlugin builderPlugin) {
- // Setup HttpClient for internode communication
- SolrHttpClientBuilder builder =
- builderPlugin.getHttpClientBuilder(HttpClientUtil.getHttpClientBuilder());
-
- // The Hadoop Auth Plugin was removed in SOLR-17540, however leaving the below reference
- // for future readers, as there may be an option to simplify this logic.
- //
- // this caused plugins like KerberosPlugin to register its intercepts, but this intercept
- // logic is also handled by the pki authentication code when it decides to let the plugin
- // handle auth via its intercept - so you would end up with two intercepts
- // -->
- // shardHandlerFactory.setSecurityBuilder(builderPlugin); // calls setup for the authcPlugin
- // updateShardHandler.setSecurityBuilder(builderPlugin);
- // <--
-
- // This should not happen here at all - it's only currently required due to its effect on
- // http1 clients in a test or two incorrectly counting on it for their configuration.
- // -->
-
- SolrHttpClientContextBuilder httpClientBuilder = new SolrHttpClientContextBuilder();
- if (builder.getCredentialsProviderProvider() != null) {
- httpClientBuilder.setDefaultCredentialsProvider(
- new CredentialsProviderProvider() {
-
- @Override
- public CredentialsProvider getCredentialsProvider() {
- return builder.getCredentialsProviderProvider().getCredentialsProvider();
- }
- });
- }
- if (builder.getAuthSchemeRegistryProvider() != null) {
- httpClientBuilder.setAuthSchemeRegistryProvider(
- new AuthSchemeRegistryProvider() {
-
- @Override
- public Lookup<AuthSchemeProvider> getAuthSchemeRegistry() {
- return builder.getAuthSchemeRegistryProvider().getAuthSchemeRegistry();
- }
- });
- }
-
- HttpClientUtil.setHttpClientRequestContextBuilder(httpClientBuilder);
-
- // <--
- }
-
// Always register PKI auth interceptor, which will then delegate the decision of who should
// secure each request to the configured authentication plugin.
if (pkiAuthenticationSecurityBuilder != null
&& !pkiAuthenticationSecurityBuilder.isInterceptorRegistered()) {
- pkiAuthenticationSecurityBuilder.getHttpClientBuilder(HttpClientUtil.getHttpClientBuilder());
shardHandlerFactory.setSecurityBuilder(pkiAuthenticationSecurityBuilder);
updateShardHandler.setSecurityBuilder(pkiAuthenticationSecurityBuilder);
solrClientProvider.setSecurityBuilder(pkiAuthenticationSecurityBuilder);
diff --git a/solr/core/src/java/org/apache/solr/metrics/prometheus/node/SolrNodeHandlerMetric.java b/solr/core/src/java/org/apache/solr/metrics/prometheus/node/SolrNodeHandlerMetric.java
index 25f014d677c..bb4b84bd52e 100644
--- a/solr/core/src/java/org/apache/solr/metrics/prometheus/node/SolrNodeHandlerMetric.java
+++ b/solr/core/src/java/org/apache/solr/metrics/prometheus/node/SolrNodeHandlerMetric.java
@@ -17,7 +17,6 @@
package org.apache.solr.metrics.prometheus.node;
import com.codahale.metrics.Counter;
-import com.codahale.metrics.Gauge;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Metric;
import org.apache.solr.metrics.prometheus.SolrMetric;
@@ -27,7 +26,6 @@ import org.apache.solr.metrics.prometheus.SolrPrometheusFormatter;
public class SolrNodeHandlerMetric extends SolrNodeMetric {
public static final String NODE_REQUESTS = "solr_metrics_node_requests";
public static final String NODE_SECONDS_TOTAL = "solr_metrics_node_requests_time";
- public static final String NODE_CONNECTIONS = "solr_metrics_node_connections";
public SolrNodeHandlerMetric(Metric dropwizardMetric, String metricName) {
super(dropwizardMetric, metricName);
@@ -36,7 +34,6 @@ public class SolrNodeHandlerMetric extends SolrNodeMetric {
/*
* Metric examples being exported
* ADMIN./admin/collections.requests
- * UPDATE.updateShardHandler.maxConnections
*/
@Override
@@ -53,8 +50,6 @@ public class SolrNodeHandlerMetric extends SolrNodeMetric {
if (metricName.endsWith(".totalTime")) {
labels.remove("type");
formatter.exportCounter(NODE_SECONDS_TOTAL, (Counter) dropwizardMetric, getLabels());
- } else if (metricName.endsWith("Connections")) {
- formatter.exportGauge(NODE_CONNECTIONS, (Gauge<?>) dropwizardMetric, getLabels());
} else if (dropwizardMetric instanceof Meter) {
formatter.exportMeter(NODE_REQUESTS, (Meter) dropwizardMetric, getLabels());
} else if (dropwizardMetric instanceof Counter) {
diff --git a/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java b/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
index c453b25b788..5a847cef0c4 100644
--- a/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
@@ -27,8 +27,6 @@ import java.security.Principal;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.http.HttpRequest;
-import org.apache.http.protocol.HttpContext;
import org.apache.solr.core.SolrInfoBean;
import org.apache.solr.metrics.SolrMetricsContext;
import org.eclipse.jetty.client.Request;
@@ -117,25 +115,6 @@ public abstract class AuthenticationPlugin implements SolrInfoBean {
};
}
- /**
- * Override this method to intercept internode requests. This allows your authentication plugin to
- * decide on per-request basis whether it should handle inter-node requests or delegate to {@link
- * PKIAuthenticationPlugin}. Return true to indicate that your plugin did handle the request, or
- * false to signal that PKI plugin should handle it. This method will be called by {@link
- * PKIAuthenticationPlugin}'s interceptor.
- *
- * <p>If not overridden, this method will return true for plugins implementing {@link
- * HttpClientBuilderPlugin}. This method can be overridden by subclasses e.g. to set HTTP headers,
- * even if you don't use a clientBuilder.
- *
- * @param httpRequest the httpRequest that is about to be sent to another internal Solr node
- * @param httpContext the context of that request.
- * @return true if this plugin handled authentication for the request, else false
- */
- protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
- return this instanceof HttpClientBuilderPlugin;
- }
-
/**
* Override this method to intercept internode requests. This allows your authentication plugin to
* decide on per-request basis whether it should handle inter-node requests or delegate to {@link
diff --git a/solr/core/src/java/org/apache/solr/security/AuthorizationUtils.java b/solr/core/src/java/org/apache/solr/security/AuthorizationUtils.java
index d5489843f7b..d551c4eddc8 100644
--- a/solr/core/src/java/org/apache/solr/security/AuthorizationUtils.java
+++ b/solr/core/src/java/org/apache/solr/security/AuthorizationUtils.java
@@ -30,9 +30,9 @@ import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.http.HttpStatus;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.core.CoreContainer;
+import org.eclipse.jetty.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,7 +113,7 @@ public class AuthorizationUtils {
return new AuthorizationFailure(
statusCode, "Unauthorized request, Response code: " + statusCode);
}
- if (!(statusCode == HttpStatus.SC_ACCEPTED) && !(statusCode == HttpStatus.SC_OK)) {
+ if (!(statusCode == HttpStatus.ACCEPTED_202) && !(statusCode == HttpStatus.OK_200)) {
log.warn(
"ERROR {} during authentication: {}", statusCode, authResponse.getMessage()); // nowarn
if (shouldAudit(cores, AuditEvent.EventType.ERROR)) {
diff --git a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
index 1d656d34b93..753a19ad0d1 100644
--- a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
@@ -33,14 +33,6 @@ import java.util.Objects;
import java.util.Set;
import java.util.StringTokenizer;
import javax.security.auth.Subject;
-import org.apache.http.Header;
-import org.apache.http.HttpHeaders;
-import org.apache.http.HttpRequest;
-import org.apache.http.annotation.Contract;
-import org.apache.http.annotation.ThreadingBehavior;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.HttpContext;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
@@ -48,6 +40,8 @@ import org.apache.solr.common.SpecProvider;
import org.apache.solr.common.util.CommandOperation;
import org.apache.solr.common.util.ValidatingJsonMap;
import org.eclipse.jetty.client.Request;
+import org.eclipse.jetty.http.HttpField;
+import org.eclipse.jetty.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +49,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin
implements ConfigEditablePlugin, SpecProvider {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private AuthenticationProvider authenticationProvider;
- private static final ThreadLocal<Header> authHeader = new ThreadLocal<>();
+ private static final ThreadLocal<HttpField> authHeader = new ThreadLocal<>();
private static final String X_REQUESTED_WITH_HEADER = "X-Requested-With";
private boolean blockUnknown = true;
private boolean forwardCredentials = false;
@@ -128,7 +122,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin
boolean isAjaxRequest = isAjaxRequest(request);
if (authHeader != null) {
- BasicAuthPlugin.authHeader.set(new BasicHeader("Authorization", authHeader));
+ BasicAuthPlugin.authHeader.set(new HttpField("Authorization", authHeader));
StringTokenizer st = new StringTokenizer(authHeader);
if (st.hasMoreTokens()) {
String basic = st.nextToken();
@@ -192,13 +186,14 @@ public class BasicAuthPlugin extends AuthenticationPlugin
*/
private Map<String, String> getPromptHeaders(boolean isAjaxRequest) {
Map<String, String> headers = new HashMap<>(authenticationProvider.getPromptHeaders());
+ String WWW_AUTH = HttpHeader.WWW_AUTHENTICATE.asString();
if (isAjaxRequest
- && headers.containsKey(HttpHeaders.WWW_AUTHENTICATE)
- && headers.get(HttpHeaders.WWW_AUTHENTICATE).startsWith("Basic ")) {
- headers.put(HttpHeaders.WWW_AUTHENTICATE, "x" + headers.get(HttpHeaders.WWW_AUTHENTICATE));
+ && headers.containsKey(WWW_AUTH)
+ && headers.get(WWW_AUTH).startsWith("Basic ")) {
+ headers.put(WWW_AUTH, "x" + headers.get(WWW_AUTH));
log.debug(
"Prefixing {} header for Basic Auth with 'x' to prevent browser basic auth popup",
- HttpHeaders.WWW_AUTHENTICATE);
+ WWW_AUTH);
}
return headers;
}
@@ -219,24 +214,6 @@ public class BasicAuthPlugin extends AuthenticationPlugin
Map<String, String> getPromptHeaders();
}
- @Override
- protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
- if (forwardCredentials) {
- if (httpContext instanceof HttpClientContext httpClientContext) {
- if (httpClientContext.getUserToken() instanceof BasicAuthUserPrincipal principal) {
- String userPassBase64 =
- Base64.getEncoder()
- .encodeToString(
- (principal.getName() + ":" + principal.getPassword())
- .getBytes(StandardCharsets.UTF_8));
- httpRequest.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + userPassBase64);
- return true;
- }
- }
- }
- return false;
- }
-
@Override
protected boolean interceptInternodeRequest(Request request) {
if (forwardCredentials) {
@@ -248,7 +225,8 @@ public class BasicAuthPlugin extends AuthenticationPlugin
(principal.getName() + ":" + principal.getPassword())
.getBytes(StandardCharsets.UTF_8));
request.headers(
- httpFields -> httpFields.add(HttpHeaders.AUTHORIZATION, "Basic " + userPassBase64));
+ httpFields ->
+ httpFields.add(HttpHeader.AUTHORIZATION.asString(), "Basic " + userPassBase64));
return true;
}
}
@@ -280,7 +258,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin
return "XMLHttpRequest".equalsIgnoreCase(request.getHeader(X_REQUESTED_WITH_HEADER));
}
- @Contract(threading = ThreadingBehavior.IMMUTABLE)
+ // IMMUTABLE
private static class BasicAuthUserPrincipal implements Principal, Serializable {
private String username;
private final String password;
diff --git a/solr/core/src/java/org/apache/solr/security/CertAuthPlugin.java b/solr/core/src/java/org/apache/solr/security/CertAuthPlugin.java
index e8ce28c14a2..091191fd409 100644
--- a/solr/core/src/java/org/apache/solr/security/CertAuthPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/CertAuthPlugin.java
@@ -23,10 +23,10 @@ import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.security.cert.X509Certificate;
import java.util.Map;
-import org.apache.http.HttpHeaders;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.security.cert.CertPrincipalResolver;
+import org.eclipse.jetty.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -116,7 +116,7 @@ public class CertAuthPlugin extends AuthenticationPlugin {
private boolean sendError(HttpServletResponse response, String msg) throws IOException {
numMissingCredentials.inc();
- response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Certificate");
+ response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), "Certificate");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, msg);
return false;
}
diff --git a/solr/core/src/java/org/apache/solr/security/HttpClientBuilderPlugin.java b/solr/core/src/java/org/apache/solr/security/HttpClientBuilderPlugin.java
index b43d5f22190..bc8495e9416 100644
--- a/solr/core/src/java/org/apache/solr/security/HttpClientBuilderPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/HttpClientBuilderPlugin.java
@@ -17,7 +17,6 @@
package org.apache.solr.security;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder;
/**
* Plugin interface for configuring internal HttpClients. This relies on the internal HttpClient
@@ -26,12 +25,6 @@ import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder;
* @lucene.experimental
*/
public interface HttpClientBuilderPlugin {
- /**
- * @return Returns an instance of a SolrHttpClientBuilder to be used for configuring the
- * HttpClients for use with SolrJ clients.
- * @lucene.experimental
- */
- public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder);
public default void setup(Http2SolrClient client) {}
}
diff --git a/solr/core/src/java/org/apache/solr/security/MultiAuthPlugin.java b/solr/core/src/java/org/apache/solr/security/MultiAuthPlugin.java
index be9bf3e21e7..f8a557c9e8d 100644
--- a/solr/core/src/java/org/apache/solr/security/MultiAuthPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/MultiAuthPlugin.java
@@ -27,9 +27,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import org.apache.http.HttpHeaders;
-import org.apache.http.HttpRequest;
-import org.apache.http.protocol.HttpContext;
import org.apache.lucene.util.ResourceLoader;
import org.apache.solr.api.AnnotatedApi;
import org.apache.solr.api.Api;
@@ -43,6 +40,7 @@ import org.apache.solr.core.CoreContainer;
import org.apache.solr.handler.admin.api.ModifyMultiPluginAuthConfigAPI;
import org.apache.solr.metrics.SolrMetricsContext;
import org.eclipse.jetty.client.Request;
+import org.eclipse.jetty.http.HttpHeader;
/**
* Authentication plugin that supports multiple Authorization schemes, such as Bearer and Basic. The
@@ -191,7 +189,7 @@ public class MultiAuthPlugin extends AuthenticationPlugin
private void addWWWAuthenticateHeaders(HttpServletResponse response) {
for (String wwwAuthHeader : WWWAuthenticateHeaders) {
- response.addHeader(HttpHeaders.WWW_AUTHENTICATE, wwwAuthHeader);
+ response.addHeader(HttpHeader.WWW_AUTHENTICATE.asString(), wwwAuthHeader);
}
}
@@ -272,16 +270,6 @@ public class MultiAuthPlugin extends AuthenticationPlugin
}
}
- @Override
- protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
- for (AuthenticationPlugin plugin : pluginMap.values()) {
- if (plugin.interceptInternodeRequest(httpRequest, httpContext)) {
- return true; // first one to fire wins
- }
- }
- return false;
- }
-
@Override
protected boolean interceptInternodeRequest(Request request) {
for (AuthenticationPlugin plugin : pluginMap.values()) {
diff --git a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
index ba62ae67f2c..3a7009682fd 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -40,28 +40,20 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpException;
-import org.apache.http.HttpHeaders;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.auth.BasicUserPrincipal;
-import org.apache.http.protocol.HttpContext;
+import java.util.function.BiConsumer;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.client.solrj.impl.HttpListenerFactory;
-import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.SuppressForbidden;
-import org.apache.solr.common.util.Utils;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.request.SolrRequestInfo;
import org.apache.solr.util.CryptoKeys;
import org.eclipse.jetty.client.Request;
+import org.eclipse.jetty.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,7 +94,6 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
private final LoadingCache<String, String> generatedV2TokenCache;
private static final int MAX_VALIDITY = Integer.getInteger("pkiauth.ttl", 10000);
private final String myNodeName;
- private final HttpHeaderClientInterceptor interceptor = new HttpHeaderClientInterceptor();
private boolean interceptorRegistered = false;
private boolean acceptPkiV1 = false;
@@ -214,7 +205,7 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
final Principal principal =
"$".equals(headerData.userName)
? CLUSTER_MEMBER_NODE
- : new BasicUserPrincipal(headerData.userName);
+ : new SimplePrincipal(headerData.userName);
numAuthenticated.inc();
filterChain.doFilter(wrapWithPrincipal(request, principal), response);
@@ -235,7 +226,7 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
throws IOException {
numErrors.mark();
log.error(message);
- response.setHeader(HttpHeaders.WWW_AUTHENTICATE, v2 ? HEADER_V2 : HEADER);
+ response.setHeader(HttpHeader.WWW_AUTHENTICATE.asString(), v2 ? HEADER_V2 : HEADER);
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
return false;
}
@@ -384,7 +375,6 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
return null;
}
String url = cores.getZkController().getZkStateReader().getBaseUrlForNodeName(nodename);
- HttpEntity entity = null;
try {
final var solrParams = new ModifiableSolrParams();
solrParams.add("wt", "json");
@@ -409,8 +399,6 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
} catch (Exception e) {
log.error("Exception trying to get public key from: {}", url, e);
return null;
- } finally {
- Utils.consumeFully(entity);
}
}
@@ -475,42 +463,10 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
client.addListenerFactory(() -> listener);
}
- @Override
- public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder) {
- HttpClientUtil.addRequestInterceptor(interceptor);
- interceptorRegistered = true;
- return builder;
- }
-
public boolean needsAuthorization(HttpServletRequest req) {
return req.getUserPrincipal() != CLUSTER_MEMBER_NODE;
}
- private class HttpHeaderClientInterceptor implements HttpRequestInterceptor {
-
- public HttpHeaderClientInterceptor() {}
-
- @Override
- public void process(HttpRequest httpRequest, HttpContext httpContext)
- throws HttpException, IOException {
- if (cores.getAuthenticationPlugin() == null) {
- return;
- }
- if (!cores.getAuthenticationPlugin().interceptInternodeRequest(httpRequest, httpContext)) {
- if (log.isDebugEnabled()) {
- log.debug("{} secures this internode request", this.getClass().getSimpleName());
- }
- setHeader(httpRequest);
- } else {
- if (log.isDebugEnabled()) {
- log.debug(
- "{} secures this internode request",
- cores.getAuthenticationPlugin().getClass().getSimpleName());
- }
- }
- }
- }
-
private Optional<String> getUser() {
SolrRequestInfo reqInfo = getRequestInfo();
if (reqInfo != null && !reqInfo.useServerToken()) {
@@ -557,15 +513,16 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
return s + " " + base64Signature;
}
- void setHeader(HttpRequest httpRequest) {
+ @VisibleForTesting
+ void setHeader(BiConsumer<String, String> httpRequest) {
if ("v1".equals(System.getProperty(SEND_VERSION))) {
getUser()
.map(generatedV1TokenCache::get)
- .ifPresent(token -> httpRequest.setHeader(HEADER, token));
+ .ifPresent(token -> httpRequest.accept(HEADER, token));
} else {
getUser()
.map(generatedV2TokenCache::get)
- .ifPresent(token -> httpRequest.setHeader(HEADER_V2, token));
+ .ifPresent(token -> httpRequest.accept(HEADER_V2, token));
}
}
@@ -579,7 +536,6 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
@Override
public void close() throws IOException {
- HttpClientUtil.removeRequestInterceptor(interceptor);
interceptorRegistered = false;
}
@@ -592,5 +548,5 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
public static final String HEADER_V2 = "SolrAuthV2";
public static final String NODE_IS_USER = "$";
// special principal to denote the cluster member
- public static final Principal CLUSTER_MEMBER_NODE = new BasicUserPrincipal("$");
+ public static final Principal CLUSTER_MEMBER_NODE = new SimplePrincipal("$");
}
diff --git a/solr/core/src/java/org/apache/solr/security/SimplePrincipal.java b/solr/core/src/java/org/apache/solr/security/SimplePrincipal.java
new file mode 100644
index 00000000000..f6840db3758
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/security/SimplePrincipal.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.solr.security;
+
+import java.security.Principal;
+import java.util.Objects;
+
+/** A basic name-only {@link Principal}. */
+public final class SimplePrincipal implements Principal {
+ // TODO use a record. But javadoc tooling complained as it was confused (Java version issue?)
+ private final String name;
+
+ public SimplePrincipal(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) return true;
+ if (obj == null || obj.getClass() != this.getClass()) return false;
+ var that = (SimplePrincipal) obj;
+ return Objects.equals(this.name, that.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name);
+ }
+
+ @Override
+ public String toString() {
+ return "SimplePrincipal[" + "name=" + name + ']';
+ }
+}
diff --git a/solr/core/src/java/org/apache/solr/security/cert/PathBasedCertPrincipalResolver.java b/solr/core/src/java/org/apache/solr/security/cert/PathBasedCertPrincipalResolver.java
index 24640c0685e..4fc1718ae64 100644
--- a/solr/core/src/java/org/apache/solr/security/cert/PathBasedCertPrincipalResolver.java
+++ b/solr/core/src/java/org/apache/solr/security/cert/PathBasedCertPrincipalResolver.java
@@ -24,8 +24,8 @@ import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.net.ssl.SSLPeerUnverifiedException;
-import org.apache.http.auth.BasicUserPrincipal;
import org.apache.solr.common.SolrException;
+import org.apache.solr.security.SimplePrincipal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -138,7 +138,7 @@ public class PathBasedCertPrincipalResolver extends PathBasedCertResolverBase
String principal = extractPrincipal(basePrincipal);
log.debug("Resolved principal: {}", principal);
- return new BasicUserPrincipal(principal);
+ return new SimplePrincipal(principal);
}
private String extractPrincipal(String str) {
diff --git a/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java b/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java
index b1d6d7bbac2..e02f6802f93 100644
--- a/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java
+++ b/solr/core/src/java/org/apache/solr/servlet/ServletUtils.java
@@ -37,12 +37,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.http.HttpHeaders;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.util.Utils;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.util.tracing.TraceUtils;
+import org.eclipse.jetty.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -254,7 +254,7 @@ public abstract class ServletUtils {
try {
Utils.readFully(req.getInputStream());
} catch (IOException e) {
- if (req.getHeader(HttpHeaders.EXPECT) != null && response.isCommitted()) {
+ if (req.getHeader(HttpHeader.EXPECT.asString()) != null && response.isCommitted()) {
log.debug("No input stream to consume from client");
} else {
log.info("Could not consume full client request", e);
diff --git a/solr/core/src/java/org/apache/solr/update/PeerSync.java b/solr/core/src/java/org/apache/solr/update/PeerSync.java
index 1de7cbe3d6a..006ba4f3297 100644
--- a/solr/core/src/java/org/apache/solr/update/PeerSync.java
+++ b/solr/core/src/java/org/apache/solr/update/PeerSync.java
@@ -26,6 +26,7 @@ import com.codahale.metrics.Timer;
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
+import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
@@ -33,8 +34,6 @@ import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-import org.apache.http.NoHttpResponseException;
-import org.apache.http.conn.ConnectTimeoutException;
import org.apache.lucene.util.BytesRef;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.cloud.ZkController;
@@ -365,9 +364,7 @@ public class PeerSync implements SolrMetricProducer {
boolean connectTimeoutExceptionInChain =
connectTimeoutExceptionInChain(srsp.getException());
if (connectTimeoutExceptionInChain
- || solrException instanceof ConnectTimeoutException
|| solrException instanceof SocketTimeoutException
- || solrException instanceof NoHttpResponseException
|| solrException instanceof SocketException) {
log.warn(
@@ -427,7 +424,7 @@ public class PeerSync implements SolrMetricProducer {
private boolean connectTimeoutExceptionInChain(Throwable exception) {
Throwable t = exception;
while (true) {
- if (t instanceof ConnectTimeoutException) {
+ if (t instanceof ConnectException) { // note: Apache HttpClient used "ConnectTimeoutException"
return true;
}
Throwable cause = t.getCause();
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index 287c4857d95..02b88932154 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -32,7 +32,6 @@ import java.util.Set;
import java.util.concurrent.CompletionService;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.Future;
-import org.apache.http.NoHttpResponseException;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.ConcurrentUpdateHttp2SolrClient;
@@ -584,9 +583,7 @@ public class SolrCmdDistributor implements Closeable {
* @return true if Solr should retry in case of hitting this exception false otherwise
*/
private boolean isRetriableException(Throwable t) {
- return t instanceof SocketException
- || t instanceof NoHttpResponseException
- || t instanceof SocketTimeoutException;
+ return t instanceof SocketException || t instanceof SocketTimeoutException;
}
@Override
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
index d3901eee182..04a529a4bdf 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
@@ -16,8 +16,6 @@
*/
package org.apache.solr.update;
-import static org.apache.solr.util.stats.InstrumentedHttpRequestExecutor.KNOWN_METRIC_NAME_STRATEGIES;
-
import com.google.common.annotations.VisibleForTesting;
import java.lang.invoke.MethodHandles;
import java.util.Set;
@@ -25,9 +23,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import org.apache.http.client.HttpClient;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.common.SolrException;
@@ -41,10 +36,7 @@ import org.apache.solr.metrics.SolrMetricsContext;
import org.apache.solr.security.HttpClientBuilderPlugin;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.apache.solr.update.processor.DistributingUpdateProcessorFactory;
-import org.apache.solr.util.stats.HttpClientMetricNameStrategy;
import org.apache.solr.util.stats.InstrumentedHttpListenerFactory;
-import org.apache.solr.util.stats.InstrumentedHttpRequestExecutor;
-import org.apache.solr.util.stats.InstrumentedPoolingHttpClientConnectionManager;
import org.apache.solr.util.stats.MetricUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,12 +69,6 @@ public class UpdateShardHandler implements SolrInfoBean {
private final Http2SolrClient recoveryOnlyClient;
- private final CloseableHttpClient defaultClient;
-
- private final InstrumentedPoolingHttpClientConnectionManager defaultConnectionManager;
-
- private final InstrumentedHttpRequestExecutor httpRequestExecutor;
-
private final InstrumentedHttpListenerFactory trackHttpSolrMetrics;
private SolrMetricsContext solrMetricsContext;
@@ -91,13 +77,9 @@ public class UpdateShardHandler implements SolrInfoBean {
private int connectionTimeout = HttpClientUtil.DEFAULT_CONNECT_TIMEOUT;
public UpdateShardHandler(UpdateShardHandlerConfig cfg) {
- defaultConnectionManager =
- new InstrumentedPoolingHttpClientConnectionManager(
- HttpClientUtil.getSocketFactoryRegistryProvider().getSocketFactoryRegistry());
+
ModifiableSolrParams clientParams = new ModifiableSolrParams();
if (cfg != null) {
- defaultConnectionManager.setMaxTotal(cfg.getMaxUpdateConnections());
- defaultConnectionManager.setDefaultMaxPerRoute(cfg.getMaxUpdateConnectionsPerHost());
clientParams.set(HttpClientUtil.PROP_SO_TIMEOUT, cfg.getDistributedSocketTimeout());
clientParams.set(
HttpClientUtil.PROP_CONNECTION_TIMEOUT, cfg.getDistributedConnectionTimeout());
@@ -112,13 +94,8 @@ public class UpdateShardHandler implements SolrInfoBean {
}
log.debug("Created default UpdateShardHandler HTTP client with params: {}", clientParams);
- httpRequestExecutor = new InstrumentedHttpRequestExecutor(getMetricNameStrategy(cfg));
trackHttpSolrMetrics = new InstrumentedHttpListenerFactory(getNameStrategy(cfg));
- defaultClient =
- HttpClientUtil.createClient(
- clientParams, defaultConnectionManager, false, httpRequestExecutor);
-
Set<String> urlParamNames =
Set.of(
DistributedUpdateProcessor.DISTRIB_FROM,
@@ -158,23 +135,6 @@ public class UpdateShardHandler implements SolrInfoBean {
}
}
- private HttpClientMetricNameStrategy getMetricNameStrategy(UpdateShardHandlerConfig cfg) {
- HttpClientMetricNameStrategy metricNameStrategy =
- KNOWN_METRIC_NAME_STRATEGIES.get(UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY);
- if (cfg != null) {
- metricNameStrategy = KNOWN_METRIC_NAME_STRATEGIES.get(cfg.getMetricNameStrategy());
- if (metricNameStrategy == null) {
- throw new SolrException(
- SolrException.ErrorCode.SERVER_ERROR,
- "Unknown metricNameStrategy: "
- + cfg.getMetricNameStrategy()
- + " found. Must be one of: "
- + KNOWN_METRIC_NAME_STRATEGIES.keySet());
- }
- }
- return metricNameStrategy;
- }
-
private InstrumentedHttpListenerFactory.NameStrategy getNameStrategy(
UpdateShardHandlerConfig cfg) {
InstrumentedHttpListenerFactory.NameStrategy nameStrategy =
@@ -191,7 +151,7 @@ public class UpdateShardHandler implements SolrInfoBean {
"Unknown metricNameStrategy: "
+ cfg.getMetricNameStrategy()
+ " found. Must be one of: "
- + KNOWN_METRIC_NAME_STRATEGIES.keySet());
+ + InstrumentedHttpListenerFactory.KNOWN_METRIC_NAME_STRATEGIES.keySet());
}
}
return nameStrategy;
@@ -207,7 +167,6 @@ public class UpdateShardHandler implements SolrInfoBean {
solrMetricsContext = parentContext.getChildContext(this);
String expandedScope = SolrMetricManager.mkName(scope, getCategory().name());
trackHttpSolrMetrics.initializeMetrics(solrMetricsContext, expandedScope);
- defaultConnectionManager.initializeMetrics(solrMetricsContext, expandedScope);
updateExecutor =
MetricUtils.instrumentedExecutorService(
updateExecutor,
@@ -237,21 +196,6 @@ public class UpdateShardHandler implements SolrInfoBean {
return solrMetricsContext;
}
- /**
- * Returns the default HTTP client for general-purpose usage.
- *
- * <p>This method is deprecated as the default client is now provided by {@link
- * org.apache.solr.core.CoreContainer#getDefaultHttpSolrClient()}. Users should prefer that method
- * to retrieve the default Solr client.
- *
- * @return the default {@link HttpClient}.
- * @deprecated Use {@link org.apache.solr.core.CoreContainer#getDefaultHttpSolrClient()} instead.
- */
- @Deprecated
- public HttpClient getDefaultHttpClient() {
- return defaultClient;
- }
-
// don't introduce a bug, this client is for sending updates only!
public Http2SolrClient getUpdateOnlyHttpClient() {
return updateOnlyClient;
@@ -271,10 +215,6 @@ public class UpdateShardHandler implements SolrInfoBean {
return updateExecutor;
}
- public PoolingHttpClientConnectionManager getDefaultConnectionManager() {
- return defaultConnectionManager;
- }
-
/**
* @return executor for recovery operations
*/
@@ -298,8 +238,6 @@ public class UpdateShardHandler implements SolrInfoBean {
}
IOUtils.closeQuietly(updateOnlyClient);
IOUtils.closeQuietly(recoveryOnlyClient);
- HttpClientUtil.close(defaultClient);
- defaultConnectionManager.close();
}
}
diff --git a/solr/core/src/java/org/apache/solr/util/stats/HttpClientMetricNameStrategy.java b/solr/core/src/java/org/apache/solr/util/stats/HttpClientMetricNameStrategy.java
deleted file mode 100644
index e0cabecbfe4..00000000000
--- a/solr/core/src/java/org/apache/solr/util/stats/HttpClientMetricNameStrategy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.util.stats;
-
-import org.apache.http.HttpRequest;
-
-/** Strategy for creating metric names for HttpClient Copied from metrics-httpclient library */
-public interface HttpClientMetricNameStrategy {
- String getNameFor(String scope, HttpRequest request);
-}
diff --git a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java b/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
deleted file mode 100644
index e4be2d9b2fa..00000000000
--- a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedHttpRequestExecutor.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.util.stats;
-
-import static org.apache.solr.metrics.SolrMetricManager.mkName;
-
-import com.codahale.metrics.Timer;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Locale;
-import java.util.Map;
-import org.apache.http.HttpClientConnection;
-import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpResponse;
-import org.apache.http.RequestLine;
-import org.apache.http.client.methods.HttpRequestWrapper;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpRequestExecutor;
-import org.apache.solr.common.util.CollectionUtil;
-import org.apache.solr.metrics.SolrMetricProducer;
-import org.apache.solr.metrics.SolrMetricsContext;
-import org.apache.solr.util.tracing.TraceUtils;
-
-/**
- * Sub-class of HttpRequestExecutor which tracks metrics interesting to solr Inspired and partially
- * copied from dropwizard httpclient library
- */
-public class InstrumentedHttpRequestExecutor extends HttpRequestExecutor
- implements SolrMetricProducer {
- public static final HttpClientMetricNameStrategy QUERYLESS_URL_AND_METHOD =
- (scope, request) -> {
- try {
- final RequestLine requestLine = request.getRequestLine();
- String schemeHostPort = null;
- if (request instanceof HttpRequestWrapper wrapper) {
- if (wrapper.getTarget() != null) {
- schemeHostPort =
- wrapper.getTarget().getSchemeName()
- + "://"
- + wrapper.getTarget().getHostName()
- + ":"
- + wrapper.getTarget().getPort();
- }
- }
- final URIBuilder url = new URIBuilder(requestLine.getUri());
- return mkName(
- (schemeHostPort != null ? schemeHostPort : "")
- + url.removeQuery().build().toString()
- + "."
- + methodNameString(request),
- scope);
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException(e);
- }
- };
-
- public static final HttpClientMetricNameStrategy METHOD_ONLY =
- (scope, request) -> mkName(methodNameString(request), scope);
-
- public static final HttpClientMetricNameStrategy HOST_AND_METHOD =
- (scope, request) -> {
- try {
- final RequestLine requestLine = request.getRequestLine();
- String schemeHostPort = null;
- if (request instanceof HttpRequestWrapper wrapper) {
- if (wrapper.getTarget() != null) {
- schemeHostPort =
- wrapper.getTarget().getSchemeName()
- + "://"
- + wrapper.getTarget().getHostName()
- + ":"
- + wrapper.getTarget().getPort();
- }
- }
- final URIBuilder url = new URIBuilder(requestLine.getUri());
- return mkName(
- (schemeHostPort != null ? schemeHostPort : "") + "." + methodNameString(request),
- scope);
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException(e);
- }
- };
-
- public static final Map<String, HttpClientMetricNameStrategy> KNOWN_METRIC_NAME_STRATEGIES =
- CollectionUtil.newHashMap(3);
-
- static {
- KNOWN_METRIC_NAME_STRATEGIES.put("queryLessURLAndMethod", QUERYLESS_URL_AND_METHOD);
- KNOWN_METRIC_NAME_STRATEGIES.put("hostAndMethod", HOST_AND_METHOD);
- KNOWN_METRIC_NAME_STRATEGIES.put("methodOnly", METHOD_ONLY);
- }
-
- protected String scope;
- protected HttpClientMetricNameStrategy nameStrategy;
- protected SolrMetricsContext solrMetricsContext;
-
- public InstrumentedHttpRequestExecutor(
- int waitForContinue, HttpClientMetricNameStrategy nameStrategy) {
- super(waitForContinue);
- this.nameStrategy = nameStrategy;
- }
-
- public InstrumentedHttpRequestExecutor(HttpClientMetricNameStrategy nameStrategy) {
- this.nameStrategy = nameStrategy;
- }
-
- private static String methodNameString(HttpRequest request) {
- return request.getRequestLine().getMethod().toLowerCase(Locale.ROOT) + ".requests";
- }
-
- @Override
- public SolrMetricsContext getSolrMetricsContext() {
- return solrMetricsContext;
- }
-
- @Override
- public HttpResponse execute(HttpRequest request, HttpClientConnection conn, HttpContext context)
- throws IOException, HttpException {
- Timer.Context timerContext = null;
- if (solrMetricsContext != null) {
- timerContext = timer(request).time();
- }
- TraceUtils.injectTraceContext(request);
- try {
- return super.execute(request, conn, context);
- } finally {
- if (timerContext != null) {
- timerContext.stop();
- }
- }
- }
-
- private Timer timer(HttpRequest request) {
- return solrMetricsContext.timer(null, nameStrategy.getNameFor(scope, request));
- }
-
- @Override
- public void initializeMetrics(SolrMetricsContext parentContext, String scope) {
- this.solrMetricsContext = parentContext.getChildContext(this);
- this.scope = scope;
- }
-}
diff --git a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedPoolingHttpClientConnectionManager.java b/solr/core/src/java/org/apache/solr/util/stats/InstrumentedPoolingHttpClientConnectionManager.java
deleted file mode 100644
index 7229cf20a45..00000000000
--- a/solr/core/src/java/org/apache/solr/util/stats/InstrumentedPoolingHttpClientConnectionManager.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.util.stats;
-
-import org.apache.http.config.Registry;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.solr.metrics.SolrMetricManager;
-import org.apache.solr.metrics.SolrMetricProducer;
-import org.apache.solr.metrics.SolrMetricsContext;
-
-/**
- * Sub-class of PoolingHttpClientConnectionManager which tracks metrics interesting to Solr.
- * Inspired by dropwizard metrics-httpclient library implementation.
- */
-public class InstrumentedPoolingHttpClientConnectionManager
- extends PoolingHttpClientConnectionManager implements SolrMetricProducer {
-
- private SolrMetricsContext solrMetricsContext;
-
- public InstrumentedPoolingHttpClientConnectionManager(
- Registry<ConnectionSocketFactory> socketFactoryRegistry) {
- super(socketFactoryRegistry);
- }
-
- @Override
- public SolrMetricsContext getSolrMetricsContext() {
- return solrMetricsContext;
- }
-
- @Override
- public void initializeMetrics(SolrMetricsContext parentContext, String scope) {
- this.solrMetricsContext = parentContext.getChildContext(this);
- solrMetricsContext.gauge(
- () -> getTotalStats().getAvailable(),
- true,
- SolrMetricManager.mkName("availableConnections", scope));
- // this acquires a lock on the connection pool; remove if contention sucks
- solrMetricsContext.gauge(
- () -> getTotalStats().getLeased(),
- true,
- SolrMetricManager.mkName("leasedConnections", scope));
- solrMetricsContext.gauge(
- () -> getTotalStats().getMax(), true, SolrMetricManager.mkName("maxConnections", scope));
- solrMetricsContext.gauge(
- () -> getTotalStats().getPending(),
- true,
- SolrMetricManager.mkName("pendingConnections", scope));
- }
-
- @Override
- public void close() {
- super.close();
- try {
- SolrMetricProducer.super.close();
- } catch (Exception e) {
- throw new RuntimeException("Exception closing.", e);
- }
- }
-}
diff --git a/solr/core/src/java/org/apache/solr/util/tracing/TraceUtils.java b/solr/core/src/java/org/apache/solr/util/tracing/TraceUtils.java
index e77b0e4f7e3..11adf3f0eca 100644
--- a/solr/core/src/java/org/apache/solr/util/tracing/TraceUtils.java
+++ b/solr/core/src/java/org/apache/solr/util/tracing/TraceUtils.java
@@ -30,7 +30,6 @@ import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
-import org.apache.http.HttpRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.eclipse.jetty.client.Request;
@@ -154,14 +153,6 @@ public class TraceUtils {
textMapPropagator.inject(Context.current(), req, REQUEST_INJECTOR);
}
- private static final TextMapSetter<HttpRequest> HTTP_REQUEST_INJECTOR =
- (req, k, v) -> req.setHeader(k, v);
-
- public static void injectTraceContext(HttpRequest req) {
- TextMapPropagator textMapPropagator = getTextMapPropagator();
- textMapPropagator.inject(Context.current(), req, HTTP_REQUEST_INJECTOR);
- }
-
public static Span startHttpRequestSpan(HttpServletRequest request, Context context) {
Tracer tracer = getTracer(request);
SpanBuilder spanBuilder =
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
index 5c0451e0b01..abfa0859929 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
@@ -500,7 +500,6 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
when(coreContainerMock.getPlacementPluginFactory()).thenReturn(placementPluginFactory);
when(coreContainerMock.getConfigSetService())
.thenReturn(new ZkConfigSetService(solrZkClientMock));
- when(updateShardHandlerMock.getDefaultHttpClient()).thenReturn(httpClientMock);
when(zkControllerMock.getSolrCloudManager()).thenReturn(cloudDataProviderMock);
when(cloudDataProviderMock.getClusterStateProvider()).thenReturn(clusterStateProviderMock);
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
index 7e061e02907..b36e1549a8a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
@@ -26,7 +26,6 @@ import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
@@ -156,18 +155,6 @@ public class TestAuthenticationFramework extends SolrCloudTestCase {
}
}
- @Override
- public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder httpClientBuilder) {
- interceptor =
- (req, rsp) -> {
- req.addHeader("username", requestUsername);
- req.addHeader("password", requestPassword);
- };
-
- HttpClientUtil.addRequestInterceptor(interceptor);
- return httpClientBuilder;
- }
-
@Override
public void close() {
HttpClientUtil.removeRequestInterceptor(interceptor);
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
index c7d860181a8..5e17ca9cf8e 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
@@ -852,21 +852,8 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
"completed"));
assertEquals(0, actualCounterDataPoint.getValue(), 0);
- actualSnapshot = getMetricSnapshot(actualSnapshots, "solr_metrics_node_connections");
- GaugeSnapshot.GaugeDataPointSnapshot actualGaugeDataPoint =
- getGaugeDatapointSnapshot(
- actualSnapshot,
- Labels.of(
- "category",
- "UPDATE",
- "handler",
- "updateShardHandler",
- "item",
- "availableConnections"));
- assertEquals(0, actualGaugeDataPoint.getValue(), 0);
-
actualSnapshot = getMetricSnapshot(actualSnapshots, "solr_metrics_node_core_root_fs_bytes");
- actualGaugeDataPoint =
+ var actualGaugeDataPoint =
getGaugeDatapointSnapshot(
actualSnapshot, Labels.of("category", "CONTAINER", "item", "totalSpace"));
assertNotNull(actualGaugeDataPoint);
diff --git a/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java b/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
index 86c4d788478..699f6249dc3 100644
--- a/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
+++ b/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
@@ -133,7 +133,7 @@ public class TestPKIAuthenticationPlugin extends SolrTestCaseJ4 {
String username = "solr user"; // with spaces
principal.set(new BasicUserPrincipal(username));
mock.solrRequestInfo = new SolrRequestInfo(localSolrQueryRequest, new SolrQueryResponse());
- mock.setHeader(request);
+ mockSetHeaderOnRequest();
header.set(request.getFirstHeader(headerKey));
assertNotNull(header.get());
assertTrue(header.get().getValue().startsWith(nodeName));
@@ -145,6 +145,10 @@ public class TestPKIAuthenticationPlugin extends SolrTestCaseJ4 {
username, ((HttpServletRequest) wrappedRequestByFilter.get()).getUserPrincipal().getName());
}
+ private void mockSetHeaderOnRequest() {
+ mock.setHeader((k, v) -> request.setHeader(k, v));
+ }
+
public void testSuperUser() throws Exception {
// Simulate the restart of a node, this will return a different key on subsequent invocations.
// Create it in advance because it can take some time and should be done before header is set
@@ -164,7 +168,7 @@ public class TestPKIAuthenticationPlugin extends SolrTestCaseJ4 {
// Setup regular superuser request
mock.solrRequestInfo = null;
- mock.setHeader(request);
+ mockSetHeaderOnRequest();
header.set(request.getFirstHeader(headerKey));
assertNotNull(header.get());
assertTrue(header.get().getValue().startsWith(nodeName));
@@ -190,7 +194,7 @@ public class TestPKIAuthenticationPlugin extends SolrTestCaseJ4 {
principal.set(new BasicUserPrincipal("solr"));
mock.solrRequestInfo = new SolrRequestInfo(localSolrQueryRequest, new SolrQueryResponse());
- mock.setHeader(request);
+ mockSetHeaderOnRequest();
HttpServletResponse response = mock(HttpServletResponse.class);
// This will fail in the same way that a missing header would fail
diff --git a/solr/cross-dc-manager/gradle.lockfile b/solr/cross-dc-manager/gradle.lockfile
index e53084e1c2c..5415ca31a6c 100644
--- a/solr/cross-dc-manager/gradle.lockfile
+++ b/solr/cross-dc-manager/gradle.lockfile
@@ -97,9 +97,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.kafka:kafka-clients:3.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.kafka:kafka-group-coordinator-api:3.9.0=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.apache.kafka:kafka-group-coordinator:3.9.0=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
diff --git a/solr/modules/analysis-extras/gradle.lockfile b/solr/modules/analysis-extras/gradle.lockfile
index 676bb4a3016..3dec923991a 100644
--- a/solr/modules/analysis-extras/gradle.lockfile
+++ b/solr/modules/analysis-extras/gradle.lockfile
@@ -77,9 +77,9 @@ org.apache.commons:commons-math3:3.6.1=apiHelper,jarValidation,runtimeClasspath,
org.apache.curator:curator-client:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/clustering/gradle.lockfile b/solr/modules/clustering/gradle.lockfile
index 52064d5a5aa..355bb257e69 100644
--- a/solr/modules/clustering/gradle.lockfile
+++ b/solr/modules/clustering/gradle.lockfile
@@ -75,9 +75,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/cross-dc/gradle.lockfile b/solr/modules/cross-dc/gradle.lockfile
index 16b2876c854..f86a31214d1 100644
--- a/solr/modules/cross-dc/gradle.lockfile
+++ b/solr/modules/cross-dc/gradle.lockfile
@@ -78,9 +78,9 @@ org.apache.commons:commons-math3:3.6.1=apiHelper,jarValidation,runtimeClasspath,
org.apache.curator:curator-client:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.kafka:kafka-clients:3.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/gcs-repository/gradle.lockfile b/solr/modules/gcs-repository/gradle.lockfile
index 680c2421437..51b3c7a0663 100644
--- a/solr/modules/gcs-repository/gradle.lockfile
+++ b/solr/modules/gcs-repository/gradle.lockfile
@@ -128,7 +128,7 @@ org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidat
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/jwt-auth/build.gradle b/solr/modules/jwt-auth/build.gradle
index 0924b7f0624..9f4078f0478 100644
--- a/solr/modules/jwt-auth/build.gradle
+++ b/solr/modules/jwt-auth/build.gradle
@@ -37,8 +37,6 @@ dependencies {
implementation libs.bc.jose4j
implementation libs.dropwizard.metrics.core
- implementation libs.apache.httpcomponents.httpclient
- implementation libs.apache.httpcomponents.httpcore
implementation libs.eclipse.jetty.client
implementation libs.eclipse.jetty.http
implementation libs.eclipse.jetty.toolchain.servletapi
@@ -68,4 +66,6 @@ dependencies {
testImplementation libs.squareup.okhttp3.mockwebserver
testImplementation libs.squareup.okhttp3.okhttp
testRuntimeOnly libs.netty.codechttp
+ testImplementation libs.apache.httpcomponents.httpclient
+ testImplementation libs.apache.httpcomponents.httpcore
}
diff --git a/solr/modules/jwt-auth/gradle.lockfile b/solr/modules/jwt-auth/gradle.lockfile
index 3be8cccfc5b..c4fe5f05dc4 100644
--- a/solr/modules/jwt-auth/gradle.lockfile
+++ b/solr/modules/jwt-auth/gradle.lockfile
@@ -42,7 +42,7 @@ com.squareup.okio:okio-jvm:3.6.0=jarValidation,testCompileClasspath,testRuntimeC
com.squareup.okio:okio:3.6.0=jarValidation,testCompileClasspath,testRuntimeClasspath
com.tdunning:t-digest:3.3=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
commons-cli:commons-cli:1.10.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
-commons-codec:commons-codec:1.19.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+commons-codec:commons-codec:1.19.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
commons-io:commons-io:2.17.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
io.dropwizard.metrics:metrics-annotation:4.2.26=jarValidation,solrPlatformLibs,testRuntimeClasspath
io.dropwizard.metrics:metrics-core:4.2.26=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
@@ -93,9 +93,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java
index 92e63f14c6b..bf7068588db 100644
--- a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java
+++ b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java
@@ -44,10 +44,6 @@ import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import org.apache.http.HttpHeaders;
-import org.apache.http.HttpRequest;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.protocol.HttpContext;
import org.apache.solr.api.AnnotatedApi;
import org.apache.solr.api.Api;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
@@ -65,6 +61,7 @@ import org.apache.solr.security.jwt.api.ModifyJWTAuthPluginConfigAPI;
import org.apache.solr.servlet.LoadAdminUiServlet;
import org.apache.solr.util.CryptoKeys;
import org.eclipse.jetty.client.Request;
+import org.eclipse.jetty.http.HttpHeader;
import org.jose4j.jwa.AlgorithmConstraints;
import org.jose4j.jwk.HttpsJwks;
import org.jose4j.jwt.JwtClaims;
@@ -427,7 +424,7 @@ public class JWTAuthPlugin extends AuthenticationPlugin
public boolean doAuthenticate(
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws Exception {
- String header = request.getHeader(HttpHeaders.AUTHORIZATION);
+ String header = request.getHeader(HttpHeader.AUTHORIZATION.asString());
if (jwtConsumer == null) {
if (header == null && !blockUnknown) {
@@ -855,7 +852,7 @@ public class JWTAuthPlugin extends AuthenticationPlugin
wwwAuthParams.add("error=\"" + responseError + "\"");
wwwAuthParams.add("error_description=\"" + message + "\"");
}
- headers.put(HttpHeaders.WWW_AUTHENTICATE, String.join(", ", wwwAuthParams));
+ headers.put(HttpHeader.WWW_AUTHENTICATE.asString(), String.join(", ", wwwAuthParams));
headers.put(AuthenticationPlugin.HTTP_HEADER_X_SOLR_AUTHDATA, generateAuthDataHeader());
return headers;
}
@@ -953,22 +950,12 @@ public class JWTAuthPlugin extends AuthenticationPlugin
}
}
- @Override
- protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
- if (httpContext instanceof HttpClientContext httpClientContext) {
- if (httpClientContext.getUserToken() instanceof JWTPrincipal jwtPrincipal) {
- httpRequest.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + jwtPrincipal.getToken());
- return true;
- }
- }
- return false;
- }
-
@Override
protected boolean interceptInternodeRequest(Request request) {
Object userToken = request.getAttributes().get(Http2SolrClient.REQ_PRINCIPAL_KEY);
if (userToken instanceof JWTPrincipal jwtPrincipal) {
- request.headers(h -> h.put(HttpHeaders.AUTHORIZATION, "Bearer " + jwtPrincipal.getToken()));
+ request.headers(
+ h -> h.put(HttpHeader.AUTHORIZATION.asString(), "Bearer " + jwtPrincipal.getToken()));
return true;
}
return false;
diff --git a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipal.java b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipal.java
index e7c26d98f58..b10d57d0bf0 100644
--- a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipal.java
+++ b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipal.java
@@ -21,7 +21,6 @@ import java.security.Principal;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
-import org.apache.http.util.Args;
/** Principal object that carries JWT token and claims for authenticated user. */
public class JWTPrincipal implements Principal {
@@ -37,13 +36,9 @@ public class JWTPrincipal implements Principal {
* @param claims list of verified JWT claims as a map
*/
public JWTPrincipal(final String username, String token, Map<String, Object> claims) {
- super();
- Args.notNull(username, "User name");
- Args.notNull(token, "JWT token");
- Args.notNull(claims, "JWT claims");
- this.token = token;
- this.claims = claims;
- this.username = username;
+ this.username = Objects.requireNonNull(username, "User name");
+ this.token = Objects.requireNonNull(token, "JWT token");
+ this.claims = Objects.requireNonNull(claims, "JWT claims");
}
@Override
diff --git a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipalWithUserRoles.java b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipalWithUserRoles.java
index 03d870c4e82..5231e25ab05 100644
--- a/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipalWithUserRoles.java
+++ b/solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTPrincipalWithUserRoles.java
@@ -21,7 +21,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import org.apache.http.util.Args;
import org.apache.solr.security.VerifiedUserRoles;
/**
@@ -36,8 +35,7 @@ public class JWTPrincipalWithUserRoles extends JWTPrincipal implements VerifiedU
public JWTPrincipalWithUserRoles(
final String username, String token, Map<String, Object> claims, Set<String> roles) {
super(username, token, claims);
- Args.notNull(roles, "User roles");
- this.roles = roles;
+ this.roles = Objects.requireNonNull(roles, "User roles");
}
/** Gets the list of roles */
diff --git a/solr/modules/langid/gradle.lockfile b/solr/modules/langid/gradle.lockfile
index cf3982fb5b0..b7e518cbc1a 100644
--- a/solr/modules/langid/gradle.lockfile
+++ b/solr/modules/langid/gradle.lockfile
@@ -77,9 +77,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/llm/gradle.lockfile b/solr/modules/llm/gradle.lockfile
index 009445f7ad5..41bbfb5b244 100644
--- a/solr/modules/llm/gradle.lockfile
+++ b/solr/modules/llm/gradle.lockfile
@@ -91,9 +91,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/ltr/gradle.lockfile b/solr/modules/ltr/gradle.lockfile
index 82b7f489112..0e62ee7d8c5 100644
--- a/solr/modules/ltr/gradle.lockfile
+++ b/solr/modules/ltr/gradle.lockfile
@@ -76,9 +76,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/opentelemetry/gradle.lockfile b/solr/modules/opentelemetry/gradle.lockfile
index 19e52182943..c78c69511e0 100644
--- a/solr/modules/opentelemetry/gradle.lockfile
+++ b/solr/modules/opentelemetry/gradle.lockfile
@@ -112,9 +112,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/s3-repository/gradle.lockfile b/solr/modules/s3-repository/gradle.lockfile
index 49c7338a4f3..0d91af98b45 100644
--- a/solr/modules/s3-repository/gradle.lockfile
+++ b/solr/modules/s3-repository/gradle.lockfile
@@ -103,7 +103,7 @@ org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidat
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=apiHelper,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/scripting/gradle.lockfile b/solr/modules/scripting/gradle.lockfile
index 23e94207ac0..1ae65642c1f 100644
--- a/solr/modules/scripting/gradle.lockfile
+++ b/solr/modules/scripting/gradle.lockfile
@@ -75,9 +75,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/modules/sql/gradle.lockfile b/solr/modules/sql/gradle.lockfile
index 02bdc2f9b93..ff16aaa0636 100644
--- a/solr/modules/sql/gradle.lockfile
+++ b/solr/modules/sql/gradle.lockfile
@@ -90,9 +90,9 @@ org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
org.apache.httpcomponents.client5:httpclient5:5.2.1=jarValidation,permitUnusedDeclared,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.apache.httpcomponents.core5:httpcore5-h2:5.2=jarValidation,permitUnusedDeclared,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.apache.httpcomponents.core5:httpcore5:5.2.3=jarValidation,permitUnusedDeclared,runtimeClasspath,runtimeLibs,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/prometheus-exporter/gradle.lockfile b/solr/prometheus-exporter/gradle.lockfile
index 8fc3f91826b..27fce6c6b50 100644
--- a/solr/prometheus-exporter/gradle.lockfile
+++ b/solr/prometheus-exporter/gradle.lockfile
@@ -79,9 +79,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,solrPlatformLibs,testRuntim
org.apache.curator:curator-client:5.9.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.21.0=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
diff --git a/solr/solr-ref-guide/gradle.lockfile b/solr/solr-ref-guide/gradle.lockfile
index ac46872eb1e..7409f4d90aa 100644
--- a/solr/solr-ref-guide/gradle.lockfile
+++ b/solr/solr-ref-guide/gradle.lockfile
@@ -74,9 +74,9 @@ org.apache.commons:commons-math3:3.6.1=testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=testRuntimeClasspath
diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
index d63fd5007ef..b3e7f0fd340 100644
--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
@@ -61,6 +61,8 @@ Users who previously relied on collection-specific URLs to avoid including the c
* Rename BinaryResponseParser and BinaryRequestWriter including StreamingBinaryResponseParser to JavaBinRequestWriter, JavaBinResponseParser, StreamingJavaBinResponseParser.
This makes it clear that they pertain specifically to “JavaBin” rather than binary in general.
+* The system property `solr.httpclient.builder.factory` now only configures SolrClients using a Jetty based HttpClient, not an Apache one.
+
=== Service installer
The service installer now installs a `systemd` startup script instead of an `init.d` startup script. It is up to the user to uninstall any existing `init.d` script when upgrading.
@@ -119,7 +121,7 @@ Nowadays, the HTTP request is available via internal APIs: `SolrQueryRequest.get
* The ConcurrentMergeScheduler's autoIOThrottle default changed to `false` but `true` may be configured to retain prior behaviour. (SOLR-17631).
-* BlobHandler and the `.system` collection have been removed in favour of FileStore API. (SOLR-17851).
+* BlobHandler and the `.system` collection have been removed in favour of FileStore API. (SOLR-17851).
=== Security
diff --git a/solr/solrj-streaming/build.gradle b/solr/solrj-streaming/build.gradle
index cafdbbcda62..4ea3110e203 100644
--- a/solr/solrj-streaming/build.gradle
+++ b/solr/solrj-streaming/build.gradle
@@ -24,8 +24,6 @@ dependencies {
// declare dependencies we use even though already declared by solrj-core
implementation libs.slf4j.api
- implementation libs.apache.httpcomponents.httpclient
- implementation libs.apache.httpcomponents.httpcore
implementation libs.apache.commons.math3
testImplementation project(':solr:test-framework')
diff --git a/solr/solrj-streaming/gradle.lockfile b/solr/solrj-streaming/gradle.lockfile
index 1c16e5a5bf5..d5f09dab95b 100644
--- a/solr/solrj-streaming/gradle.lockfile
+++ b/solr/solrj-streaming/gradle.lockfile
@@ -32,7 +32,7 @@ com.j256.simplemagic:simplemagic:1.17=jarValidation,testRuntimeClasspath
com.jayway.jsonpath:json-path:2.9.0=jarValidation,testRuntimeClasspath
com.tdunning:t-digest:3.3=jarValidation,testRuntimeClasspath
commons-cli:commons-cli:1.10.0=jarValidation,testRuntimeClasspath
-commons-codec:commons-codec:1.19.0=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+commons-codec:commons-codec:1.19.0=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
commons-io:commons-io:2.17.0=jarValidation,permitTestUnusedDeclared,testCompileClasspath,testRuntimeClasspath
io.dropwizard.metrics:metrics-annotation:4.2.26=jarValidation,testRuntimeClasspath
io.dropwizard.metrics:metrics-core:4.2.26=jarValidation,testCompileClasspath,testRuntimeClasspath
@@ -92,9 +92,9 @@ org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
org.apache.httpcomponents.client5:httpclient5:5.2.1=jarValidation,testRuntimeClasspath
org.apache.httpcomponents.core5:httpcore5-h2:5.2=jarValidation,testRuntimeClasspath
org.apache.httpcomponents.core5:httpcore5:5.2.3=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,testRuntimeClasspath
diff --git a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
index 011f86555ac..5e2412de057 100644
--- a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
+++ b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java
@@ -25,13 +25,11 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.http.client.HttpClient;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.CloudHttp2SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.SolrClientBuilder;
import org.apache.solr.common.AlreadyClosedException;
import org.apache.solr.common.util.IOUtils;
import org.apache.solr.common.util.URLUtil;
@@ -140,15 +138,6 @@ public class SolrClientCache implements Closeable {
return client;
}
- @Deprecated
- private static void adjustTimeouts(SolrClientBuilder<?> builder, HttpClient httpClient) {
- builder.withHttpClient(httpClient);
- int socketTimeout = Math.max(minSocketTimeout, builder.getSocketTimeoutMillis());
- builder.withSocketTimeout(socketTimeout, TimeUnit.MILLISECONDS);
- int connTimeout = Math.max(minConnTimeout, builder.getConnectionTimeoutMillis());
- builder.withConnectionTimeout(connTimeout, TimeUnit.MILLISECONDS);
- }
-
private static Http2SolrClient.Builder newHttp2SolrClientBuilder(
String url, Http2SolrClient http2SolrClient, String basicAuthCredentials) {
final var builder =
diff --git a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/DriverImpl.java b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/DriverImpl.java
index cb4668838e2..073a223606c 100644
--- a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/DriverImpl.java
+++ b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/sql/DriverImpl.java
@@ -18,17 +18,15 @@ package org.apache.solr.client.solrj.io.sql;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
-import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.solr.common.util.SuppressForbidden;
/**
@@ -124,13 +122,15 @@ public class DriverImpl implements Driver {
return uri;
}
- private void loadParams(URI uri, Properties props) throws SQLException {
- List<NameValuePair> parsedParams = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8);
- for (NameValuePair pair : parsedParams) {
- if (pair.getValue() != null) {
- props.put(pair.getName(), pair.getValue());
- } else {
- props.put(pair.getName(), "");
+ /** Decode the uri query parameters and put them onto {@code props}. */
+ private void loadParams(URI uri, Properties props) {
+ String query = uri.getRawQuery();
+ if (query != null) {
+ for (String param : query.split("&")) {
+ String[] pair = param.split("=", 2);
+ String key = URLDecoder.decode(pair[0], StandardCharsets.UTF_8);
+ String value = pair.length > 1 ? URLDecoder.decode(pair[1], StandardCharsets.UTF_8) : "";
+ props.put(key, value);
}
}
}
diff --git a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
index 72425040b18..3ffc7d1daf6 100644
--- a/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
+++ b/solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java
@@ -16,7 +16,6 @@
*/
package org.apache.solr.client.solrj.io.stream;
-import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -25,7 +24,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.InputStreamResponseParser;
@@ -62,7 +60,6 @@ public class SolrStream extends TupleStream {
private transient TupleStreamParser tupleStreamParser;
private String slice;
private long checkpoint = -1;
- private Closeable closeableHttpResponse;
private boolean distrib = true;
private String user;
private String password;
@@ -189,7 +186,6 @@ public class SolrStream extends TupleStream {
@Override
public void close() throws IOException {
IOUtils.closeQuietly(tupleStreamParser);
- IOUtils.closeQuietly(closeableHttpResponse);
if (doCloseCache) {
IOUtils.closeQuietly(clientCache);
}
@@ -303,24 +299,12 @@ public class SolrStream extends TupleStream {
var client = clientCache.getHttpSolrClient(baseUrl);
NamedList<Object> genericResponse = client.request(query);
InputStream stream = (InputStream) genericResponse.get(InputStreamResponseParser.STREAM_KEY);
-
- CloseableHttpResponse httpResponse =
- (CloseableHttpResponse) genericResponse.get("closeableResponse");
- // still attempting to read http status from http response for backwards compatibility reasons
- // since 9.4 the updated format will have a dedicated status field
- final int statusCode;
- if (httpResponse != null) {
- statusCode = httpResponse.getStatusLine().getStatusCode();
- } else {
- statusCode = (int) genericResponse.get("responseStatus");
- }
+ // since 9.4 the updated format has a dedicated status field
+ final Integer statusCode = (Integer) genericResponse.get("responseStatus");
if (statusCode == 401
|| statusCode == 403) { // auth response comes as html, so propagate as string
String errMsg = consumeStreamAsErrorMessage(stream);
- if (httpResponse != null) {
- httpResponse.close();
- }
throw new IOException(
"Query to '"
+ query.getPath()
@@ -332,7 +316,6 @@ public class SolrStream extends TupleStream {
+ errMsg);
}
- this.closeableHttpResponse = httpResponse;
if (CommonParams.JAVABIN.equals(wt)) {
return new JavabinTupleStreamParser(stream, true);
} else {
diff --git a/solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java b/solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
index 799330fbd0e..4cc2a1b6e7b 100644
--- a/solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
+++ b/solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java
@@ -196,7 +196,7 @@ public class CloudAuthStreamTest extends SolrCloudTestCase {
assertEquals(
"sanity check of update to X from read only user",
- 500, // should be 403, but CloudSolrClient lies on updates for now: SOLR-14222
+ 403,
expectThrows(
SolrException.class,
() -> {
@@ -210,7 +210,7 @@ public class CloudAuthStreamTest extends SolrCloudTestCase {
assertEquals(
"sanity check of update to X from write_Y user",
- 500, // should be 403, but CloudSolrClient lies on updates for now: SOLR-14222
+ 403,
expectThrows(
SolrException.class,
() -> {
diff --git a/solr/solrj-zookeeper/gradle.lockfile b/solr/solrj-zookeeper/gradle.lockfile
index c1bad5f5e13..789a05bce34 100644
--- a/solr/solrj-zookeeper/gradle.lockfile
+++ b/solr/solrj-zookeeper/gradle.lockfile
@@ -88,9 +88,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=apiHelper,compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,permitTestUsedUndeclared,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=jarValidation,permitTestUsedUndeclared,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,testRuntimeClasspath
diff --git a/solr/solrj/build.gradle b/solr/solrj/build.gradle
index c3c948b1917..6b753ff8e3a 100644
--- a/solr/solrj/build.gradle
+++ b/solr/solrj/build.gradle
@@ -43,7 +43,7 @@ dependencies {
implementation libs.eclipse.jetty.io
runtimeOnly libs.eclipse.jetty.alpnjavaclient
- api(libs.apache.httpcomponents.httpmime, {
+ implementation(libs.apache.httpcomponents.httpmime, {
exclude group: "commons-codec", module: "commons-codec"
exclude group: "commons-logging", module: "commons-logging"
})
diff --git a/solr/solrj/gradle.lockfile b/solr/solrj/gradle.lockfile
index 4fa9751da6d..f022c810c5c 100644
--- a/solr/solrj/gradle.lockfile
+++ b/solr/solrj/gradle.lockfile
@@ -85,9 +85,9 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpclient:4.5.14=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpcore:4.4.16=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=jarValidation,testRuntimeClasspath
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientBuilderFactory.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientBuilderFactory.java
index ed8cb32ec60..7e8645ff6ea 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientBuilderFactory.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientBuilderFactory.java
@@ -19,22 +19,11 @@ package org.apache.solr.client.solrj.impl;
import java.io.Closeable;
/**
- * Factory interface for configuring {@linkplain SolrHttpClientBuilder}. This relies on the internal
- * HttpClient implementation and is subject to change.
+ * A config hook for post-configuration of a {@linkplain Http2SolrClient} by its builder.
*
+ * @see HttpClientUtil#SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY
* @lucene.experimental
*/
public interface HttpClientBuilderFactory extends Closeable {
-
- /**
- * This method configures the {@linkplain SolrHttpClientBuilder} by overriding the configuration
- * of passed SolrHttpClientBuilder or as a new instance.
- *
- * @param builder The instance of the {@linkplain SolrHttpClientBuilder} which should be
- * configured (optional).
- * @return the {@linkplain SolrHttpClientBuilder}
- */
- public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder);
-
- public default void setup(Http2SolrClient client) {}
+ default void setup(Http2SolrClient client) {}
}
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
index 6aafaceef46..6170375048d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java
@@ -174,26 +174,6 @@ public class HttpClientUtil {
throw new RuntimeException("Unable to instantiate Solr SocketFactoryRegistryProvider", e);
}
}
-
- // Configure the HttpClientBuilder if user has specified the factory type.
- String factoryClassName = System.getProperty(SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY);
- if (factoryClassName != null) {
- log.debug("Using {}", factoryClassName);
- try {
- HttpClientBuilderFactory factory =
- Class.forName(factoryClassName)
- .asSubclass(HttpClientBuilderFactory.class)
- .getDeclaredConstructor()
- .newInstance();
- httpClientBuilder = factory.getHttpClientBuilder(SolrHttpClientBuilder.create());
- } catch (InstantiationException
- | IllegalAccessException
- | ClassNotFoundException
- | InvocationTargetException
- | NoSuchMethodException e) {
- throw new RuntimeException("Unable to instantiate Solr HttpClientBuilderFactory", e);
- }
- }
}
public abstract static class SocketFactoryRegistryProvider {
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
index da38da18953..0f7e58d3b7c 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactory.java
@@ -26,11 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.solr.client.solrj.util.SolrBasicAuthentication;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
@@ -60,8 +55,6 @@ public class PreemptiveBasicAuthClientBuilderFactory implements HttpClientBuilde
public static final String SYS_PROP_BASIC_AUTH_CREDENTIALS =
"solr.security.auth.basicauth.credentials";
- private static PreemptiveAuth requestInterceptor = new PreemptiveAuth(new BasicScheme());
-
private static CredentialsResolver CREDENTIAL_RESOLVER = new CredentialsResolver();
/**
@@ -73,9 +66,7 @@ public class PreemptiveBasicAuthClientBuilderFactory implements HttpClientBuilde
}
@Override
- public void close() throws IOException {
- HttpClientUtil.removeRequestInterceptor(requestInterceptor);
- }
+ public void close() throws IOException {}
@Override
public void setup(Http2SolrClient client) {
@@ -101,35 +92,6 @@ public class PreemptiveBasicAuthClientBuilderFactory implements HttpClientBuilde
httpClient.getProtocolHandlers().put(new ProxyAuthenticationProtocolHandler(httpClient));
}
- @Override
- public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder) {
- final String basicAuthUser =
- CREDENTIAL_RESOLVER.defaultParams.get(HttpClientUtil.PROP_BASIC_AUTH_USER);
- final String basicAuthPass =
- CREDENTIAL_RESOLVER.defaultParams.get(HttpClientUtil.PROP_BASIC_AUTH_PASS);
- if (basicAuthUser == null || basicAuthPass == null) {
- throw new IllegalArgumentException(
- "username & password must be specified with " + getClass().getName());
- }
-
- return initHttpClientBuilder(
- builder == null ? SolrHttpClientBuilder.create() : builder, basicAuthUser, basicAuthPass);
- }
-
- private SolrHttpClientBuilder initHttpClientBuilder(
- SolrHttpClientBuilder builder, String basicAuthUser, String basicAuthPass) {
- builder.setDefaultCredentialsProvider(
- () -> {
- CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(
- AuthScope.ANY, new UsernamePasswordCredentials(basicAuthUser, basicAuthPass));
- return credsProvider;
- });
-
- HttpClientUtil.addRequestInterceptor(requestInterceptor);
- return builder;
- }
-
static class CredentialsResolver {
public volatile SolrParams defaultParams;
diff --git a/solr/test-framework/gradle.lockfile b/solr/test-framework/gradle.lockfile
index f8f56f50281..1e145ab771c 100644
--- a/solr/test-framework/gradle.lockfile
+++ b/solr/test-framework/gradle.lockfile
@@ -77,7 +77,7 @@ org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidat
org.apache.curator:curator-test:5.9.0=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.apache.httpcomponents:httpmime:4.5.14=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.httpcomponents:httpmime:4.5.14=apiHelper,jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.21.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.21.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.21.0=apiHelper,jarValidation,runtimeClasspath,testRuntimeClasspath