hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject httpcomponents-client git commit: HTTPCLIENT-1885: Content compression exec interceptor generates incorrect 'Accept-Encoding' header value
Date Tue, 28 Nov 2017 09:25:45 GMT
Repository: httpcomponents-client
Updated Branches:
  refs/heads/master 2b2dd593a -> 4a55a8cfb


HTTPCLIENT-1885: Content compression exec interceptor generates incorrect 'Accept-Encoding'
header value


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/4a55a8cf
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/4a55a8cf
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/4a55a8cf

Branch: refs/heads/master
Commit: 4a55a8cfbdd7659c76e1354de66eb15a5b066b3b
Parents: 2b2dd59
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Tue Nov 28 10:22:56 2017 +0100
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Tue Nov 28 10:22:56 2017 +0100

----------------------------------------------------------------------
 .../client5/http/impl/classic/ContentCompressionExec.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/4a55a8cf/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java
index 75df9fc..6736ff0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java
@@ -28,7 +28,6 @@
 package org.apache.hc.client5.http.impl.classic;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 
@@ -51,6 +50,7 @@ import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.config.Lookup;
 import org.apache.hc.core5.http.config.RegistryBuilder;
 import org.apache.hc.core5.http.message.BasicHeaderValueParser;
+import org.apache.hc.core5.http.message.MessageSupport;
 import org.apache.hc.core5.http.message.ParserCursor;
 import org.apache.hc.core5.util.Args;
 
@@ -68,7 +68,7 @@ import org.apache.hc.core5.util.Args;
 @Contract(threading = ThreadingBehavior.IMMUTABLE)
 public final class ContentCompressionExec implements ExecChainHandler {
 
-    private final List<String> acceptEncoding;
+    private final String[] acceptEncoding;
     private final Lookup<InputStreamFactory> decoderRegistry;
     private final boolean ignoreUnknown;
 
@@ -76,7 +76,8 @@ public final class ContentCompressionExec implements ExecChainHandler {
             final List<String> acceptEncoding,
             final Lookup<InputStreamFactory> decoderRegistry,
             final boolean ignoreUnknown) {
-        this.acceptEncoding = acceptEncoding != null ? acceptEncoding : Arrays.asList("gzip",
"x-gzip", "deflate");
+        this.acceptEncoding = acceptEncoding != null ? acceptEncoding.toArray(
+                new String[acceptEncoding.size()]) : new String[] {"gzip", "x-gzip", "deflate"};
         this.decoderRegistry = decoderRegistry != null ? decoderRegistry :
                 RegistryBuilder.<InputStreamFactory>create()
                         .register("gzip", GZIPInputStreamFactory.getInstance())
@@ -116,7 +117,7 @@ public final class ContentCompressionExec implements ExecChainHandler
{
 
         /* Signal support for Accept-Encoding transfer encodings. */
         if (!request.containsHeader(HttpHeaders.ACCEPT_ENCODING) && requestConfig.isContentCompressionEnabled())
{
-            request.addHeader(HttpHeaders.ACCEPT_ENCODING, acceptEncoding);
+            request.addHeader(MessageSupport.format(HttpHeaders.ACCEPT_ENCODING, acceptEncoding));
         }
 
         final ClassicHttpResponse response = chain.proceed(request, scope);


Mime
View raw message