You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Rodney Waldhoff <rw...@hotmail.com> on 2001/11/26 18:27:37 UTC

RE: [HttpClient] Re: [PATCH] Bug 5018

Paul C. Bryan wrote:
>Last week, I reported a deficiency in the HttpClient library and submitted 
>a patch via this mailing list, addressing the lack of transparent support 
>for chunked transfer encoding.
>
>I haven't heard yet from anyone in response to my submission, so I'm 
>wondering if perhaps I failed to submit it properly, or failed to observe 
>proper etiquette.

Paul,

Can't speak for anyone else, but I must have missed this patch. Can you 
resubmit?

- Rod

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [HttpClient] Re: [PATCH] Bug 5018

Posted by "Paul C. Bryan" <pb...@creatia.com>.
Rodney Waldhoff wrote:

> Can't speak for anyone else, but I must have missed this patch. Can you 
> resubmit?


Here it is...

------------------------------------------------------------

Summary:

Chunked transfer encoding not isolated from application.


Description:

Chunked transfer encoding is not being supported transparently by the 
HttpMethodBase object, causing chunk data to be embedded in response 
body data and forcing the application to handle the HTTP/1.1 
implementation of chunked transfer encoding.

The included patch now properly parses chunk data as per RFC 2068 and 
provides body content consistently, regardless of whether chunked 
transfer encoding was used by the server or not. This relieves the 
application from the requirement of implementing RFC 2068.


Patch Notes:

RFC 2068 specifies optional footer fields that are supplied after the 
end of the chunked data body. These are parsed, but added as "header" 
fields because I didn't want to change the HttpMethod interface. The 
result is that footer fields such as signatures must be retrieved as 
headers. The downside to this approach is there is no way to distinguish 
  between a header field and a footer field when interrogating the 
HttpMethod.

I've defined a constant SIZE_buf to use as a buffer size for allocated 
copy buffers. I've only used it in my patch (because it is referred to 
more than once in the method), but propose that it be used by any 
methods that perform copy operations with the allocation of a buffer. 
Comments?

Because a ResponseInputStream is used to read the body, the response 
footers cannot be retrived using the conn.readLine() method. Instead, 
the ResponseInputStream.readLine method must be used. For this reason, 
response footers are read after the body in the readResponseBody method.

I'm not sure why only get request method is supporting writing content 
to disk. I believe the useDisk functionality should be moved to 
HttpMethodBase. I was tempted to do so, but didn't want to jeopardize 
the acceptance of this patch. If someone gives me the go ahead, I am 
willing to move useDisk into HttpMethodBase.

GetMethod.readResponseBody(HttpState, HttpConnection) duplicated much of 
HttpMethodBase.readResponseBody(HttpState, HttpConnection) 
functionality. I moved this into a new common 
readResponseBody(ResponseInputStream, OutputStream) that is shared by 
HttpMethodBase and GetMethod. If useDisk moves into HttpMethodBase, 
there should be no longer be a need for this separate method.

The included patches have been extensively tested against a WebLogic 6.1 
SP1 server, which makes use of chunked transfer encoding when content 
length is not known ahead of time.

I've gone out of my way to keep the style of this patch consistent with 
the existing source code. I'm curious how much liberty I can take in the 
future when it comes to formatting.

------------------------------------------------------------

Yours truly,

Paul C. Bryan
pbryan@creatia.com