W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2003

Re: content-length transfer-encoding issue

From: Jose Kahan <jose.kahan@w3.org>
Date: Thu, 30 Jan 2003 11:22:24 +0100
To: Fred Covely <fcovely@bcftech.com>
Cc: www-lib@w3.org
Message-ID: <20030130102224.GA9888@inrialpes.fr>

Fred,

Maybe this behavior is related to your using SSL? I can use Amaya/libwww
with chunk encodings and multiple requests over Apache 1.3.x and have not
experienced this problem. It also works well with Jigsaw.

On the other hand, I  noticed that the latest Apache 2.x with PHP
has a problem with chunk encoding. After the request has ended, it sends
an empty chunk, like if both PHP and Apache had decided to signal the
end of the request independently of each other.

All in all, this is to say that I'm not sure if the bug comes from using
SSL or if it's an outstanding bug. 

Can you test if you have this behavior when you're not doing SSL
requests?

If you still have the same behavior, let's add your patch. Otherwise, it
means a patch is needed elsewhere.

-jose

On Fri, Dec 20, 2002 at 12:46:28AM -0800, Fred Covely wrote:
> 
> I partially figured out the problem as given below and would like to propose
> a fix that solves my issue and would seem to be prudent if no one can
> identify a better solution.  There have been a couple unanswered 'I lost
> data on a post response' postings that make me think other people are seeing
> this (albeit rarely).
> 
> My fix is a one liner.
> 
[snip]
> 
> Here is what happens:
> 
> 1.  The post kicks off a 100 continue with a content-length header of 0.
> That sets the HTResponse length to 0.
> 
> 2.  When the 200 OK, comes in the HTResponse length is still 0 (fallout from
> the content-length header in the prior 100).  As a consequence of the prior
> 100 response and the fact that transfer-Encoding: chunk is being used,
> pumpData (HTStream * me) in HTMIME.C returns prematurely before all body
> data has been processed (because it **thinks** the length is 0).
> 
> My fix is a one liner at HTTPStatus_put_block in http.c:
> 
> 
> From:
> 
> 	    status = (*me->info_target->isa->put_block)(me->info_target, b, l+1);
> 	    if (status != HT_CONTINUE) return status;
> To:
> 
> 	    status = (*me->info_target->isa->put_block)(me->info_target, b, l+1);
> 	    if (status != HT_CONTINUE) return status;
> 	    // re-init to -1 in case 100 continue had 0 content-length header
>          HTResponse_setLength(me->request->response,-1);
Received on Thursday, 30 January 2003 11:55:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:43 GMT