Date:   Saturday December 29, 2001 @ 16:24
Author: matt

Update of /home/cvs/AxKit
In directory ted:/home/matt/Perl/AxKit

Modified Files:
        AxKit.pm 
Log Message:
Allow error stylesheets to use the cache, and thus return their own content type

Index: AxKit.pm
===================================================================
RCS file: /home/cvs/AxKit/AxKit.pm,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- AxKit.pm    2001/12/14 16:38:46     1.126
+++ AxKit.pm    2001/12/29 16:24:45     1.127
@@ -1,4 +1,4 @@
-# $Id: AxKit.pm,v 1.126 2001/12/14 16:38:46 matt Exp $
+# $Id: AxKit.pm,v 1.127 2001/12/29 16:24:45 matt Exp $
 
 package AxKit;
 use strict;
@@ -247,7 +247,7 @@
                 # Make sure we default the cache file, otherwise
                 # we setup a potential DoS
                 AxKit::Debug(3, "resetting cache with no preferred style ($preferred 
ne $styles->[0]{title})");
-                $cache = Apache::AxKit::Cache->new($r, $r->filename() . 
$ENV{PATH_INFO}, '', $media, $r->notes('axkit_cache_extra'), 'gzip');
+                $cache = Apache::AxKit::Cache->new($r, $r->filename() . '.gzip' . 
+$ENV{PATH_INFO}, '', $media, $r->notes('axkit_cache_extra'));
             }
         }
         
@@ -336,7 +336,7 @@
     }
     
     if ($E->isa('Apache::AxKit::Exception::OK')) {
-        return OK;
+        return deliver_to_browser($r); # should return OK
     }
     elsif ($E->isa('Apache::AxKit::Exception::Retval')) {
         my $code = $E->{return_code};
@@ -394,6 +394,12 @@
 sub process_error {
     my ($r, $E, $error_styles) = @_;
     
+    bless $r, 'AxKit::Apache';
+    tie *STDOUT, 'AxKit::Apache', $r;
+
+    $r->dir_config->set(AxNoCache => 1);
+    $AxKit::Cache = Apache::AxKit::Cache->new($r, 'error', '', '', '');
+    
     $r->content_type("text/html; charset=UTF-8"); # set a default for errors
     
     my $error = '<error><file>' .
@@ -420,15 +426,19 @@
 
     $r->pnotes('xml_string', $error);
 
-    AxKit::Apache::send_http_header($r);
-
     eval {
         process_request($r, $provider, $error_styles);
+        if (ref($r) eq 'AxKit::Apache') {
+            bless $r, 'Apache';
+            tie *STDOUT, 'Apache', $r;
+        }
+        deliver_to_browser($r);
     };
     if ($@) {
         $r->log->error("[AxKit] [FATAL] Error occured while processing Error XML: 
$@");
         return SERVER_ERROR;
     }
+    
     return OK;
 }
 
@@ -675,6 +685,8 @@
             return $retval;
         }
     }
+
+    return OK;
 }
 
 sub prep_exception {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to