httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: [PATCH] chunking filter.
Date Wed, 16 Aug 2000 19:56:25 GMT

> > This does work as far as I can tell.  There is one extra 0 added at the
> > end of response, but I think that is because I haven't completely removed
> > the BUFF chunking code.  At least, I can't find any other reason for it.
> 
> The extra 0 is part of the protocol. It signifies "no more chunks". There is
> also an extra CRLF pair to signify "no trailer headers".

No Greg, there is an extra 0.  Did you even try the code.  The ending
response looks like:

0
0

My undertstanding of the protocol is that it is supposed to be

0

> > +static int chunk_filter(ap_filter_t *f, ap_bucket_brigade *b)
> > +{
> > +    ap_bucket *dptr = b->head;
> > +    int len = 0;B
> > +    char lenstr[6];
> > +    int hit_eos = 0;
> > +
> > +    while (dptr) {
> > +        if (dptr->type == AP_BUCKET_EOS) {
> > +            hit_eos = 1;
> 
> use this to determine whether to add the "0" CRLF <trailers> CRLF sequence.

That's why I added it to begin with.

> 
> > +        } 
> > +        else {
> > +            len += dptr->length;
> > +        }
> > +        dptr = dptr->next;
> > +    }
> > +
> > +    apr_snprintf(lenstr, 6, "%x\r\n", len);
> > +    dptr = ap_bucket_transient_create(lenstr, 4, &len);
> > +    b->head->prev = dptr;
> > +    dptr->next = b->head;
> > +    b->head = dptr;
> 
> can we get an ap_brigade_prepend_bucket() function for this?

Sure, write one.

> 
> > +    dptr = ap_bucket_heap_create("\r\n", 2, &len);
> 
> how about writing the IMMORTAL bucket first? the above bucket should really
> be IMMORTAL.

I only have so much time right now.  This chunking filter works, and it
works well.  There is no IMMORTAL bucket type, and I am unlikely to have
the time to write it.  This chunking filter was written in about four
hours this morning, and most of that was spent hacking around the
ap_add_filter code.  This patch comes directly out of my original
chunking patch.  If you want the IMMORTAL bucket, then write it.  If you
don't, then it will wait until somebody has the time to write it.  Until
then, this chunking filter works well, it just isn't optimal.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message