On Tue, 2011-03-22 at 11:41 +0000, sebb wrote: > On 22 March 2011 10:07, Oleg Kalnichevski <[email protected]> wrote: > > On Mon, 2011-03-21 at 18:34 -0500, hanasaki wrote: > >> Using http client 4.1 with an http put and a route through a squid proxy > >> to a basic-authentication http server. Not proxy auth in this case. > >> The file upload is going through chunked dispite setting chunking off. > >> I used the below example with POST as a template for the client code and > >> set chunking to false. The PUT is going up as chunked. This was > >> verified with wireshark capturing the "not supported" coming back from > >> squid (2.x) as well as decoding the http PUT that went to squid. > >> > >> http://hc.apache.org/httpcomponents-client-ga/examples.html > >> http://www.innovation.ch/java/HTTPClient/advanced_info.html > >> > >> ref: > >> reqEntity.setChunked(true); <= I set to FALSE > >> ... > >> httppost.setEntity(reqEntity); > >> > > > > If the entity's content length is not known (set to -1) HttpClient has > > no other choice but to use chunk coding. > > > > When sending requests via an HTTP/1.0 proxy such as squid 2.x make sure > > to configure HttpClient to use HTTP/1.0. This will automatically disable > > content chunking. > > I propose adding the following to > .AbstractHttpEntity.setChunked(boolean b) Javadoc: > > Note that the chunked setting is a hint only. > If using HTTP/1.0, chunking is never performed. > Otherwise, even if chunked is false, HttpClient must > use chunk coding if the entity content length is > unknown (-1) > > Is that OK? >
Sounds good to me. > BTW, what happens when an unknown entity length is used in HTTP/1.0? > Protocol exception will be thrown: http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestContent.html#75 Cheers Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
