You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by mi...@apache.org on 2018/12/23 22:56:18 UTC

[httpcomponents-client] branch HTTPCLIENT-1952_5.0 updated (eba3b9e -> 354ae35)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch HTTPCLIENT-1952_5.0
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


 discard eba3b9e  [HTTPCLIENT-1952] Allow default User Agent to be disabled
     add 4450221  Improve HttpResponseException#getMessage()
     add bf18e7d  Merge pull request #129 from apache/improved-httpexception-message
     new 354ae35  [HTTPCLIENT-1952] Allow default User Agent to be disabled

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (eba3b9e)
            \
             N -- N -- N   refs/heads/HTTPCLIENT-1952_5.0 (354ae35)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/hc/client5/http/HttpResponseException.java     | 11 +++++++++--
 .../impl/classic/TestAbstractHttpClientResponseHandler.java   |  6 ++++--
 2 files changed, 13 insertions(+), 4 deletions(-)


[httpcomponents-client] 01/01: [HTTPCLIENT-1952] Allow default User Agent to be disabled

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch HTTPCLIENT-1952_5.0
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 354ae3586ebb2557fece463c322cf2d1cc128baa
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Dec 23 20:46:25 2018 +0100

    [HTTPCLIENT-1952] Allow default User Agent to be disabled
    
    This closes #128
---
 .../hc/client5/http/impl/classic/HttpClientBuilder.java     | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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 7298cfc..983078f 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
@@ -229,6 +229,7 @@ public class HttpClientBuilder {
     private boolean cookieManagementDisabled;
     private boolean authCachingDisabled;
     private boolean connectionStateDisabled;
+    private boolean defaultUserAgentDisabled;
 
     private List<Closeable> closeables;
 
@@ -698,6 +699,16 @@ public class HttpClientBuilder {
     }
 
     /**
+     * Disables the default user agent set by this builder if none has been provided by the user.
+     *
+     * @since 4.5.7
+     */
+    public final HttpClientBuilder disableDefaultUserAgent() {
+        this.defaultUserAgentDisabled = true;
+        return this;
+    }
+
+    /**
      * Request exec chain customization and extension.
      * <p>
      * For internal use.
@@ -779,7 +790,7 @@ public class HttpClientBuilder {
             if (systemProperties) {
                 userAgentCopy = System.getProperty("http.agent");
             }
-            if (userAgentCopy == null) {
+            if (userAgentCopy == null && !defaultUserAgentDisabled) {
                 userAgentCopy = VersionInfo.getSoftwareInfo("Apache-HttpClient",
                         "org.apache.hc.client5", getClass());
             }