arturobernalg commented on code in PR #651:
URL: 
https://github.com/apache/httpcomponents-client/pull/651#discussion_r2156502507


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ContentCompressionExec.java:
##########
@@ -81,36 +80,34 @@ public final class ContentCompressionExec implements 
ExecChainHandler {
     private final Lookup<InputStreamFactory> decoderRegistry;
     private final boolean ignoreUnknown;
 
+    private static final Map<String, InputStreamFactory> DECODERS = 
ContentDecoderRegistry.getRegistry();
+
     public ContentCompressionExec(
             final List<String> acceptEncoding,
             final Lookup<InputStreamFactory> decoderRegistry,
             final boolean ignoreUnknown) {
 
-        final boolean brotliSupported = decoderRegistry == null && 
BrotliDecompressingEntity.isAvailable();
-        if (acceptEncoding != null) {
-            this.acceptEncoding = 
MessageSupport.headerOfTokens(HttpHeaders.ACCEPT_ENCODING, acceptEncoding);
-        } else {
-            final List<String> encodings = new ArrayList<>(4);
-            encodings.add("gzip");
-            encodings.add("x-gzip");
-            encodings.add("deflate");
-            if (brotliSupported) {
-                encodings.add("br");
-            }
-            this.acceptEncoding = 
MessageSupport.headerOfTokens(HttpHeaders.ACCEPT_ENCODING, encodings);
-        }
+        final List<String> encodingsHeader = acceptEncoding != null
+                ? acceptEncoding
+                : buildDefaultAcceptEncoding();
+
+        this.acceptEncoding = MessageSupport
+                .headerOfTokens(HttpHeaders.ACCEPT_ENCODING, encodingsHeader);
+
         if (decoderRegistry != null) {
             this.decoderRegistry = decoderRegistry;
         } else {
-            final RegistryBuilder<InputStreamFactory> builder = 
RegistryBuilder.<InputStreamFactory>create()
-                .register("gzip", GZIPInputStreamFactory.getInstance())
-                .register("x-gzip", GZIPInputStreamFactory.getInstance())
-                .register("deflate", DeflateInputStreamFactory.getInstance());
-            if (brotliSupported) {
-                builder.register("br", BrotliInputStreamFactory.getInstance());
-            }
+            final Map<String, InputStreamFactory> decoders =

Review Comment:
   @ok2c Yes, i know, but my original thinking was that when the user doesn’t 
customize `encodingsHeader`, we’d fall back to the “must-support” RFC decoders 
only (gzip/deflate). Please do another pass



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to