httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: chunked encoding
Date Sun, 26 Aug 2001 18:50:42 GMT
On Sat, 25 Aug 2001, Doug MacEachern wrote:

> chunked encoding never gets turned on because by the time
> ap_set_keepalive() is called, ap_content_length_filter has set
> r->headers_out.Content-Length
> with this patch chunked encoding works fine, but i'm not sure if it is
> the correct fix.

So you are saying the content length is currently being set before we have
figured out if we can chunk or not?

This check definitely does look a bit bogus:

    /* Humm, is this check the best it can be?
     * - protocol >= HTTP/1.1 implies support for chunking
     * - non-keepalive implies the end of byte stream will be signaled
     *    by a connection close
     * In both cases, we can send bytes to the client w/o needing to
     * compute content-length.
     * Todo:
     * We should be able to force connection close from this filter
     * when we see we are buffering too much. 
     */
    if ((r->proto_num >= HTTP_VERSION(1,1)) ||
        (!f->r->connection->keepalive)) {
        partial_send_okay = 1;
    }

If the content length is being set all the time, then either it is being
set too often or is being set incorrectly... if we already have a content
length set, then it doesn't seem that ignoring it just to use chunking is
of any benefit, we have to make sure it isn't set in the first place, and
all the work required to set it doesn't happen.

And it does seem that the content length is _NOT_ being added for requests
where I would have thought it should be based on the current code... eg. a
SSI that includes a CGI on a HTTP/1.0 keepalive request.

To be honest, there is a lot of logic in ap_content_length_filter that is
somewhat hard to understand... at least not obvious.

However, I do get chunked responses at times with the current code...

BTW, the user should probably be able to configure if they want the server
to try to add a content length at the expense of buffering the content.

BTW, includes are "still" broken (not sure if this is recognized or
not)... doing an include virtual of "/" in a file results in headers and
body being sent in a mixed up order.


Mime
View raw message