You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Guillaume Castagnino (JIRA)" <ji...@apache.org> on 2012/05/31 10:42:23 UTC

[jira] [Commented] (HTTPCLIENT-1199) DecompressingHttpClient strips POST content from request

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286410#comment-13286410 ] 

Guillaume Castagnino commented on HTTPCLIENT-1199:
--------------------------------------------------

To illustrate this, I made a test with this change, that fixes my issue. Now my POST requests are correctly processed:
$ diff -u ./httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java.orig ./httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java                                                                                            
--- ./httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java.orig    2012-05-31 10:39:49.698192187 +0200
+++ ./httpclient/src/main/java/org/apache/http/impl/client/DecompressingHttpClient.java 2012-05-31 10:39:57.202038414 +0200
@@ -125,9 +125,8 @@
             HttpContext context) throws IOException, ClientProtocolException {
         try {
             if (context == null) context = new BasicHttpContext();
-            HttpRequest wrapped = new RequestWrapper(request);
-            acceptEncodingInterceptor.process(wrapped, context);
-            HttpResponse response = backend.execute(target, wrapped, context);
+            acceptEncodingInterceptor.process(request, context);
+            HttpResponse response = backend.execute(target, request, context);
             contentEncodingInterceptor.process(response, context);
             if (Boolean.TRUE.equals(context.getAttribute(ResponseContentEncoding.UNCOMPRESSED))) {
                 response.removeHeaders("Content-Length");
                
> DecompressingHttpClient strips POST content from request
> --------------------------------------------------------
>
>                 Key: HTTPCLIENT-1199
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1199
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2 Final
>         Environment: Ubuntu / openjdk-7
>            Reporter: Guillaume Castagnino
>
> When upgrading from HttpClient 4.1 to HttpClient 4.2, I have to migrate my ContentEncodingHttpClient to a decorated DecompressingHttpClient.
> But there is a problem with HttpPost requests : the POST content is missing.
> Looking at the DecompressingHttpClient code : http://hc.apache.org/httpcomponents-client-ga/httpclient/clover/org/apache/http/impl/client/DecompressingHttpClient.html, the issue seems to be that DecompressingHttpClient use a HttpRequest wrapped by a RequestWrapper at line 130 to execute. But this wrapper only clone headers and params, disregarding the request type, so the entity is not cloned.
> When feeding the DecompressingHttpClient with a HttpPost request, this leads to partial request with no entity : over the network, I get POST requests with no content !
> Solution should be to stop using a wrapped request ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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