On Apr 18, 2006, at 2:52 PM, William A. Rowe, Jr. wrote:
@@ -240,7 +240,7 @@
         const char *encoding;
         /* only work on main request/no subrequests */
-        if (!ap_is_initial_req(r)) {
+        if (r->main != NULL) {
             ap_remove_output_filter(f);

Actually, explain to me how this code successfully leaves the http protocol
layer output_filter in the filter chain for subrequest components?

Using ap_is_initial_req:

AP_DECLARE(int) ap_is_initial_req(request_rec *r)
{
return (r->main == NULL) /* otherwise, this is a sub- request */ && (r->prev == NULL); /* otherwise, this is an internal redirect */
}

it will remove the filter for both sub-request and internal redirects. The patch just removes the filter if it is a sub request.

  I'd think
this code (original, and even the patched flavor) could break the filter stack by yanking the deflate filter out from the middle of servicing a request, e.g.
when a subrequest is included midstream.

The patched block of code is only called when f->ctx is NULL and hasn't been setup yet by mod_deflate. I would assume when a sub request would get added the ctx for its ap_filter_t struct would be NULL and f->r->main would be the top request so the deflate filter would be removed.


It seems this should be a conditional add-filter, never a conditional remove filter event. add-filter on the top level request, noop on nested requests.

Not sure I have the expertise to comment on that.

Brian

Reply via email to