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            previous   Thread       

Re: [mod-xslt dev] patch: add environment variable override Denis F. Latypoff
  • From: "Denis F. Latypoff" <latypoff@xxxxxxxxx>
  • To: "colin@xxxxxxxxxx" <dev@xxxxxxxxxxxxxxxx>
  • Subject: Re: [mod-xslt dev] patch: add environment variable override
  • Date: Tue, 30 Jan 2007 14:22:39 +0600
  • References: <sympa.1170099379.25483.536@ml.mod-xslt2.com>
  • Reply-to: "Denis F. Latypoff" <latypoff@xxxxxxxxx>


  • Hello colin,

    Tuesday, January 30, 2007, 1:36:33 AM, you wrote:

    > 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

    I am using 'AddOutputFilterByType mod-xslt text/xml'
    and when my apps sends 'ContentType: text/xml' mod_xslt is processing
    output document, so I can easily change content type to any other and
    see non-processed document (it's for debug mainly). I don't use any
    exotic mod-xslt's commands such as XSLTAddRule etc.

    > 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;

    thanks for the patch, it's really useful ;)

    > __________ NOD32 2010 (20070126) Information __________

    > This message was checked by NOD32 antivirus system.
    > part000.txt - is OK

    > http://www.eset.com




    --
    Best regards,
    Denis Latypoff mailto:latypoff@xxxxxxxxx


      Powered by Sympa