From 7f474a7ddd657a3e31fb84631102b3d8d5463c8f Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Sat, 7 Nov 2026 11:30:39 +0100 Subject: [PATCH] HttpClientBuilder: deprecate disableDefaultUserAgent() and make it a no-op The option has had no effect since the default User-Agent guard was dropped together with the http.agent system property support, and the async builders do not have it. The method is now deprecated and ignored. --- .../hc/client5/http/impl/classic/HttpClientBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java index d2d70ed7d4..da9efd79a7 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java @@ -211,7 +211,6 @@ private ExecInterceptorEntry( private boolean cookieManagementDisabled; private boolean authCachingDisabled; private boolean connectionStateDisabled; - private boolean defaultUserAgentDisabled; private ProxySelector proxySelector; private boolean tlsRequired; @@ -777,13 +776,14 @@ public final HttpClientBuilder evictIdleConnections(final TimeValue maxIdleTime) } /** - * Disables the default user agent set by this builder if none has been provided by the user. + * Ignored. * * @return this instance. * @since 4.5.7 + * @deprecated This method has no effect and calls to it can be removed. */ + @Deprecated public final HttpClientBuilder disableDefaultUserAgent() { - this.defaultUserAgentDisabled = true; return this; }