| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # $Id: QueryStringCacheRegexp.pm,v 1.12 2006/08/07 14:12:06 c10232 Exp $ | 
| 2 |  |  |  |  |  |  | package Apache::AxKit::Plugin::QueryStringCacheRegexp; | 
| 3 |  |  |  |  |  |  |  | 
| 4 | 1 |  |  | 1 |  | 10059 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 12706 |  | 
| 5 | 1 |  |  | 1 |  | 4961 | use Apache::Constants qw(OK); | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | use Apache::Request; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | our $VERSION = '0.04'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub handler { | 
| 11 |  |  |  |  |  |  | my $r = shift; | 
| 12 |  |  |  |  |  |  | my $cache_extra; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | # An extra bend to correctly make multiple-valued CGI-Parameters | 
| 15 |  |  |  |  |  |  | # significant by concatenating them. (The whole exercise is to | 
| 16 |  |  |  |  |  |  | # create a "axkit_cache_extra"-string that depends as little as | 
| 17 |  |  |  |  |  |  | # possible on how the QueryString "looks"; i.e. the order of the | 
| 18 |  |  |  |  |  |  | # parameters should not be significant unless there are multiple | 
| 19 |  |  |  |  |  |  | # occurences of the same key) | 
| 20 |  |  |  |  |  |  | my @args = $r->args(); | 
| 21 |  |  |  |  |  |  | my %args; | 
| 22 |  |  |  |  |  |  | while (@args) {$args{ shift(@args) } .= shift(@args);} | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | my $use = $r->dir_config('AxQueryStringCacheRegexpUse') || '^\w+$';             #' | 
| 25 |  |  |  |  |  |  | my $ignore = $r->dir_config('AxQueryStringCacheRegexpIgnore') || undef; | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | foreach (sort keys %args) { | 
| 28 |  |  |  |  |  |  | if ( length $_ && /$use/ && ( (not defined $ignore) || (not /$ignore/) ) ) { | 
| 29 |  |  |  |  |  |  | $cache_extra .= $_ . "=" . $args{$_} . ";"; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | AxKit::Debug(7, "[QueryStringCacheRegexp] QueryString in: " . $r->args . " significant for caching: $cache_extra"); | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | $r->notes('axkit_cache_extra', $r->notes('axkit_cache_extra') . $cache_extra); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | return OK; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  | __END__ |