You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "ok2c (via GitHub)" <gi...@apache.org> on 2025/10/19 17:00:29 UTC

[PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

ok2c opened a new pull request, #743:
URL: https://github.com/apache/httpcomponents-client/pull/743

   Presently the content compression executors remove headers content related headers from the original response message to make it consistent with properties of the content entity. This is conceptually wrong. The content entity associated with the response message has its own content properties (content-length, content-type, content-encoding, etc) that can differ from those of the original message. As long as those properties correctly reflect the content produced be the entity there is no need to mutate the original response message itself, and there can be legitimate reasons for the caller to see the actual response headers.
   
   I propose we change the content compression executors to stop removing content related headers from the original response message,


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c merged PR #743:
URL: https://github.com/apache/httpcomponents-client/pull/743


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

Posted by "semyon-levin-workato (via GitHub)" <gi...@apache.org>.
semyon-levin-workato commented on code in PR #743:
URL: https://github.com/apache/httpcomponents-client/pull/743#discussion_r4146586606


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/ContentCompressionAsyncExec.java:
##########
@@ -150,9 +150,6 @@ public AsyncDataConsumer handleResponse(final HttpResponse rsp,
                             throw new HttpException("Unsupported Content-Encoding: " + codec);
                         }
                     }
-                    rsp.removeHeaders(HttpHeaders.CONTENT_ENCODING);

Review Comment:
   Hi @ok2c, 
   
   I understand that the PR is merged and released, but it introduced regressions in code that relies in values of these headers like Spring's `StringHttpMessageConverter`.
   
   Before the PR:
   1. A gzipped response comes
   2. It's decompressed
   3. These headers are removed
   4. Code that relies on the headers can't find them and don't rely on them
   
   Now:
   1. A gzipped response comes
   2. It's decompressed
   3. The headers represent the state **before** decompression
   4. Code that relies on the headers (e.g., `Content-Length`) becomes broken



-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on PR #743:
URL: https://github.com/apache/httpcomponents-client/pull/743#issuecomment-3419865108

   + 1 Keeping the original response headers intact is more correct semantically


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

Posted by "semyon-levin-workato (via GitHub)" <gi...@apache.org>.
semyon-levin-workato commented on code in PR #743:
URL: https://github.com/apache/httpcomponents-client/pull/743#discussion_r4146586606


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/ContentCompressionAsyncExec.java:
##########
@@ -150,9 +150,6 @@ public AsyncDataConsumer handleResponse(final HttpResponse rsp,
                             throw new HttpException("Unsupported Content-Encoding: " + codec);
                         }
                     }
-                    rsp.removeHeaders(HttpHeaders.CONTENT_ENCODING);

Review Comment:
   Hi @ok2c, 
   
   I understand that the PR is merged and released, but it seems it introduced regressions in code that relies on values of these headers like Spring's `StringHttpMessageConverter`.
   
   Before the PR:
   1. A gzipped response comes
   2. It's decompressed
   3. These headers are removed
   4. Code that relies on the headers can't find them and don't rely on them
   
   Now:
   1. A gzipped response comes
   2. It's decompressed
   3. The headers represent the state **before** decompression
   4. Code that relies on the headers (e.g., `Content-Length`) becomes broken



-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] Content compression executors no longer remove headers from the original response message [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #743:
URL: https://github.com/apache/httpcomponents-client/pull/743#discussion_r4147343854


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/ContentCompressionAsyncExec.java:
##########
@@ -150,9 +150,6 @@ public AsyncDataConsumer handleResponse(final HttpResponse rsp,
                             throw new HttpException("Unsupported Content-Encoding: " + codec);
                         }
                     }
-                    rsp.removeHeaders(HttpHeaders.CONTENT_ENCODING);

Review Comment:
   @semyon-levin-workato https://issues.apache.org/jira/browse/HTTPCLIENT-2409



-- 
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-unsubscribe@hc.apache.org

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


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