vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[bml] r113: use LJ::Request instead of Apache(->requ...

Committer: vad
use LJ::Request instead of Apache(->request).
U   branches/modernize2/lib/Apache/BML.pm
Modified: branches/modernize2/lib/Apache/BML.pm
===================================================================
--- branches/modernize2/lib/Apache/BML.pm	2010-01-19 08:24:33 UTC (rev 112)
+++ branches/modernize2/lib/Apache/BML.pm	2010-01-19 12:02:43 UTC (rev 113)
@@ -16,7 +16,7 @@
 
 package Apache::BML;
 
-use Apache::Constants qw(:common REDIRECT HTTP_NOT_MODIFIED);
+#use Apache::Constants qw(:common REDIRECT HTTP_NOT_MODIFIED);
 use Apache::File ();
 use Apache::URI;
 use LJ::Request;
@@ -77,17 +77,17 @@
     # $file was stat'd by ecide_file_and_stat above, so use '_'
     unless (-e _) {
         LJ::Request->log_error("File does not exist: $file");
-        return NOT_FOUND;
+        return LJ::Request::NOT_FOUND;
     }
 
     unless (-r _) {
         LJ::Request->log_error("File permissions deny access: $file");
-        return FORBIDDEN;
+        return LJ::Request::FORBIDDEN;
     }
 
     my $modtime = (stat _)[9];
 
-    return FORBIDDEN if $file =~ /\b_config/;
+    return LJ::Request::FORBIDDEN if $file =~ /\b_config/;
 
     # create new request
     my $req = Apache::BML::initialize_cur_req($file);
@@ -160,7 +160,7 @@
         if (defined $redirect_page) {
             LJ::Request->header_out(Location => $redirect_page);
             $Apache::BML::r = undef;  # no longer valid
-            return REDIRECT;
+            return LJ::Request::REDIRECT
         }
     }
 
@@ -202,7 +202,7 @@
     unless (open F, $file) {
         LJ::Request->log_error("Couldn't open $file for reading: $!");
         $Apache::BML::r = undef;  # no longer valid
-        return SERVER_ERROR;
+        return LJ::Request::SERVER_ERROR;
     }
 
     my $bmlsource;
@@ -249,12 +249,6 @@
         }
     }
 
-use Data::Dumper;
-warn "GET=" . Dumper(\%BMLCodeBlock::GET);
-warn "POST=" . Dumper(\%BMLCodeBlock::POST);
-warn "FORM=" . Dumper(\%BMLCodeBlock::FORM);
-
-
      %BMLCodeBlock::GET_POTENTIAL_XSS = ();
      if ($env->{MildXSSProtection}) {
          foreach my $k (keys %BMLCodeBlock::GET) {
@@ -345,7 +339,7 @@
     if ($req->{'location'}) {
         LJ::Request->set_header_out(Location => $req->{'location'});
         $Apache::BML::r = undef;  # no longer valid
-        return REDIRECT;
+        return LJ::Request::REDIRECT
     }
 
     # see if we can save some bandwidth (though we already killed a bunch of CPU)
@@ -360,7 +354,7 @@
     my $ifnonematch = LJ::Request->header_in("If-None-Match");
     if (defined $ifnonematch && defined $etag && $etag eq $ifnonematch) {
         $Apache::BML::r = undef;  # no longer valid
-        return HTTP_NOT_MODIFIED;
+        return LJ::Request::HTTP_NOT_MODIFIED;
     }
 
     my $rootlang = substr($req->{'lang'}, 0, 2);
@@ -384,7 +378,7 @@
             $ims eq $modtime_http)
         {
             $Apache::BML::r = undef;  # no longer valid
-            return HTTP_NOT_MODIFIED;
+            return LJ::Request::HTTP_NOT_MODIFIED;
         }
 
         LJ::Request->content_type($content_type);
@@ -422,7 +416,7 @@
     LJ::Request->print($html) unless $env->{'NoContent'} || LJ::Request->header_only;
 
     $Apache::BML::r = undef;  # no longer valid
-    return OK;
+    return LJ::Request::OK;
 }
 
 sub decide_file_and_stat
@@ -476,7 +470,7 @@
     LJ::Request->send_http_header();
     LJ::Request->print($err);
 
-    return OK;  # TODO: something else?
+    return LJ::Request::OK;  # TODO: something else?
 }
 
 sub file_dontcheck
@@ -531,7 +525,7 @@
 
     unless ($conf) {
         unless (open (C, $ffile)) {
-            Apache->log_error("Can't read config file: $file")
+            LJ::Request->log_error("Can't read config file: $file")
                 if -e $file;
             return ();
         }

Tags: bml, pm, vadvs
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments