Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r11296: LJSUP-10815 (Fotki.ru: store data on our...

Committer: ailyin
LJSUP-10815 (Fotki.ru: store data on our own servers)
U   trunk/cgi-bin/LJ/Response/Redirect.pm
U   trunk/cgi-bin/LJ/Router.pm
Modified: trunk/cgi-bin/LJ/Response/Redirect.pm
===================================================================
--- trunk/cgi-bin/LJ/Response/Redirect.pm	2011-12-23 06:42:14 UTC (rev 11295)
+++ trunk/cgi-bin/LJ/Response/Redirect.pm	2011-12-23 13:57:22 UTC (rev 11296)
@@ -4,12 +4,18 @@
 
 use base qw( LJ::Response );
 
-__PACKAGE__->mk_accessors( qw( where status ) );
+__PACKAGE__->mk_accessors( qw( where status mode ) );
 
 sub output {
     my ($self) = @_;
 
-    my $status = LJ::Request->redirect( $self->where );
+    my $status;
+    if ( $self->mode && $self->mode eq 'internal' ) {
+        LJ::Request->header_out( 'X-Accel-Redirect' => $self->where );
+        $status = LJ::Request::OK;
+    } else {
+        $status = LJ::Request->redirect( $self->where );
+    }
 
     unless ( $self->status ) {
         $self->status($status);

Modified: trunk/cgi-bin/LJ/Router.pm
===================================================================
--- trunk/cgi-bin/LJ/Router.pm	2011-12-23 06:42:14 UTC (rev 11295)
+++ trunk/cgi-bin/LJ/Router.pm	2011-12-23 13:57:22 UTC (rev 11296)
@@ -19,6 +19,9 @@
     # apache process to check the child's still running fine
     return unless defined LJ::Request->hostname;
 
+    # we needn't handle internal redirects (like error pages) either
+    return if LJ::Request->prev;
+
     foreach my $router (@routers) {
         $router->match_controller;
         return if LJ::Request->notes('controller');

Tags: ailyin, andy, ljcom, pm
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