Re: mod_deflate update

2004-04-19 Thread Sami Tikka
su, 2004-04-18 kello 15:22, Nick Kew kirjoitti:
 Also a question: When I create a bucket brigade in a module, I always
 explicitly apr_brigade_destroy() it.  None of the filters in mod_deflate
 destroy their brigades.  A look at apr_brigade.c shows that it's not
 in fact necessary, but maybe a note to that effect would be in order?

Isn't it dangerous to apr_brigade_destroy()? As I understand,
apr_brigade_destroy frees the buckets in the brigade AND also frees the
brigade structure itself.

I used to do it with my output filter and I managed to crash Apache
right away. The reason was that mod_proxy_http keeps reusing the brigade
and doesn't take it nicely if someone goes and destroys it.

Cliff Wolley once said that you must either pass a bucket to the next
filter or destroy it but I have not heard from any authoritative source
what should be done with brigades. I just know that for my particular
case apr_brigade_destroy is a bad thing. On the other hand an output
filter should not have to know if it is processing content originated
from mod_proxy or mod_perl or any other handler, right? The interface
should always be the same.

-- Sami



mod_deflate update

2004-04-18 Thread Nick Kew

Attached: a one-line bugfix to my recent patch.  The inflate output
filter needs to unset the Content-Encoding header when it unsets
the content encoding.

Also a question: When I create a bucket brigade in a module, I always
explicitly apr_brigade_destroy() it.  None of the filters in mod_deflate
destroy their brigades.  A look at apr_brigade.c shows that it's not
in fact necessary, but maybe a note to that effect would be in order?

-- 
Nick Kew

Nick's manifesto: http://www.htmlhelp.com/~nick/--- mod_deflate.c   2004-04-18 13:06:13.0 +0100
+++ mod_deflate.c.old   2004-04-18 13:07:44.0 +0100
@@ -895,6 +895,7 @@
 ap_remove_output_filter(f);
 return ap_pass_brigade(f-next, bb);
 }
+   apr_table_unset(r-headers_out, Content-Encoding) ;
 
 f-ctx = ctx = apr_pcalloc(f-r-pool, sizeof(*ctx));
 ctx-proc_bb = apr_brigade_create(r-pool, f-c-bucket_alloc);