Hi,

the problem we found, was, that two (different) content length were set. One
by our test suite (we can and will fix this soon too, actually this problem
showed up only in the context of Apache with an integrated Tomcat/Slide) and
secondly by the Slide HttpClient when sending the body.
I agree, if set content length is set by the user we should trust him, so
the applied code should be removed again.
We should make the HttpClient setting of content-length more robust, IMO. Is
there someone who feels comfortable with this part of the http protocol?

Best regards

Juergen


-----Original Message-----
From: Remy Maucherat [mailto:[EMAIL PROTECTED]]
Sent: Freitag, 14. September 2001 22:41
To: [EMAIL PROTECTED]
Subject: Re: cvs commit:
jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient
HttpMethodBase.java


> juergen     01/09/14 10:06:43
>
>   Modified:    src/webdav/client/src/org/apache/commons/httpclient
>                         HttpMethodBase.java
>   Log:
>   Ignore a user set content-length and let HttpClient re-compute it.

>   +        // remove a pre-set content length header, if present
>   +        // and let the HttpClient class compute this.
>   +        if (requestHeaders.containsKey("Content-Length") &&
this.needContentLength()) {
>   +            requestHeaders.remove("Content-Length");
>   +        }
>   +        if (requestHeaders.containsKey("content-length") &&
this.needContentLength()) {
>   +            requestHeaders.remove("content-length");
>   +        }

Is it really a good idea to do that ?
That means that all the requests will be chunked, which is not a good idea
(and forbidden when doing a POST).

Really, I would trust the user there. If we choose to not trust him, we can
see how many bytes are actually written and complain (and close the
connection) if it doesn't match.

Remy

Reply via email to