hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Valdenaire (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-600) Http Client does not fix incorrect content-lenght headers
Date Fri, 15 Sep 2006 14:33:22 GMT
    [ http://issues.apache.org/jira/browse/HTTPCLIENT-600?page=comments#action_12434990 ] 
Denis Valdenaire commented on HTTPCLIENT-600:

Hello Roland,

At the very least I will try to document it somewhere as a possible cause for a socket reset
at the server side. We had a very hard time to debug this and only tcpdump was our friend....

Thanks for your help.

Best regards,


> Http Client does not fix incorrect content-lenght headers
> ---------------------------------------------------------
>                 Key: HTTPCLIENT-600
>                 URL: http://issues.apache.org/jira/browse/HTTPCLIENT-600
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 3.1 Alpha 1
>         Environment: All
>            Reporter: Denis Valdenaire
> I discovered that the method 
> addContentLengthRequestHeader (found in file methods/MultipartPostMethod.java) doesn't
"fix" the content-lenght when this one is incorrect. It adds one if getRequestHeader("Content-Lenght")
is null, but it should also verify that the content-lenght is correct.
> I suggest something like :
> long len = getRequestContentLength();
> if (getRequestHeader("Content-Length") == null || getRequestHeader("Content-Length")
!= len) { 
>             setRequestHeader("Content-Length", String.valueOf(len));
> }
> Sending an incorrect Content-Length blocks the server if the string sent is smaller than
announced : waiting for more, and finally reset the connection. If it's too big, you lose
> I've seen this problem in a reverse proxy program (with httpclient communicating with
the real servers) when the client send urlencoded data and this data is modified (partly urldecoded)
but not the content-lenght.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


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

View raw message