Login 
 
 Pref   Your subscriptions   Home   Help 
dev@ml.mod-xslt2.com
mod-xslt2 - Development Mailing List
   
 
List info
 
 
 
Subscribe
 
 
Unsubscribe
 
 
Archive
 
 
Post
 



Advanced search
2004 01 02 03 04 05 06 07 08 09 10 11 12
2005 01 02 03 04 05 06 07 08 09 10 11 12
2006 01 02 03 04 05 06 07 08 09 10 11 12
2007 01 02 03 04 05 06 07 08 09 10 11 12
2008 01 02 03 04 05 06 07 08 09 10 11 12

  previous   Chronological   next       previous   Thread   next  

patch: add environment variable override colin
  • From: colin@xxxxxxxxxx
  • To: dev@xxxxxxxxxxxxxxxx
  • Subject: patch: add environment variable override
  • Date: Mon, 29 Jan 2007 20:36:33 +0100 (CET)


  • The patch below adds SetEnvIf environment variable support that can be used
    to disable mod_xslt. Effectively, this can be used to mimics the
    functionality of XSLTAddRule but can also be used for dynamically assigned
    xslt. With this patch you can AddOutputFilter and then disable it based on
    any criteria necessary. This allows for more customized control over the
    execution of the mod_xslt module.

    For example:
    <Location ~ "\.php|/$|^[^.]*$">
    SetOutputFilter mod-xslt
    </Location>
    SetEnvIf Request_URI /Rss.php no-xslt

    This will enable the OutputFilter for all .php files (incl welcome pages) but
    disable it for the rss.php. While this is a primitive example, my scenario
    required adjustment based on Headers and parameters which is much more
    complicated for <Location> matches.

    Also this patch also moves the removal of the Content-Length to after the
    quick exit block. This is important so that pipelining is preserved even if
    the mod_xslt is dynamically removed from the chain.

    --- modxslt-2005072700/sapi/apache2/modxslt.c.orig 2005-07-27
    04:27:57.000000000 -0600
    +++ modxslt-2005072700/sapi/apache2/modxslt.c 2007-01-24
    15:03:35.000000000 -0600
    @@ -138,7 +138,8 @@
    const char * forcestyle, * defaultstyle;
    void * get;

    - apr_table_unset(f->r->headers_out, "Content-Length");
    + if (apr_table_get(f->r->subprocess_env, "no-xslt"))
    + return ap_pass_brigade(f->next, brigade);

    if(f->r->header_only)
    return ap_pass_brigade(f->next, brigade);
    @@ -148,6 +149,8 @@
    if(f->r->status != HTTP_OK)
    return ap_pass_brigade(f->next, brigade);

    + apr_table_unset(f->r->headers_out, "Content-Length");
    +
    data=(apr_bucket_brigade *)f->ctx;
    ap_save_brigade(f, &data, &brigade, f->r->pool);
    f->ctx=data;

      Powered by Sympa