[livejournal] r23527: LJSUP-14766: Sometimes STATPREFIX and IM...

Jan 10, 2013 13:41


Committer: vadLJSUP-14766: Sometimes STATPREFIX and IMPREFIX are set to the incorrect values for the request.

U trunk/cgi-bin/Apache/LiveJournal.pm

Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm 2013-01-10 12:29:57 UTC (rev 23526)
+++ trunk/cgi-bin/Apache/LiveJournal.pm 2013-01-10 13:41:35 UTC (rev 23527)
@@ -372,6 +372,17 @@
LJ::procnotify_check();
S2::set_domain('LJ');

+ ## The following block of code with 'constants' redefinition *** MUST *** be called for any
+ ## request.
+ if ($is_ssl) {
+ $LJ::IMGPREFIX = '/img';
+ $LJ::STATPREFIX = '/stc';
+ } else {
+ $LJ::IMGPREFIX = $LJ::IMGPREFIX_BAK;
+ $LJ::STATPREFIX = $LJ::STATPREFIX_BAK;
+ $LJ::USERPIC_ROOT = $LJ::USERPICROOT_BAK if $LJ::USERPICROOT_BAK;
+ }
+
# add server mark
my ($aws_id) = $LJ::HARDWARE_SERVER_NAME =~ /\-(.+)$/;
LJ::Request->header_out('X-AWS-Id' => $aws_id || 'unknown');
@@ -605,8 +616,6 @@
if (-d _) { $file .= '/index.bml'; }
$file =~ s!/{2,}!/!g;
LJ::Request->filename($file);
- $LJ::IMGPREFIX = '/img';
- $LJ::STATPREFIX = '/stc';
if ( $file =~ /[.]bml$/ ) {
return $bml_handler->($file);
} else {
@@ -617,14 +626,6 @@
return LJ::Request::FORBIDDEN;
}
}
- elsif (LJ::run_hook('set_alternate_statimg')) {
- # do nothing, hook did it.
- } else {
- $LJ::DEBUG_HOOK{'pre_restore_bak_stats'}->() if $LJ::DEBUG_HOOK{'pre_restore_bak_stats'};
- $LJ::IMGPREFIX = $LJ::IMGPREFIX_BAK;
- $LJ::STATPREFIX = $LJ::STATPREFIX_BAK;
- $LJ::USERPIC_ROOT = $LJ::USERPICROOT_BAK if $LJ::USERPICROOT_BAK;
- }

# let foo.com still work, but redirect to www.foo.com
if ($LJ::DOMAIN_WEB && LJ::Request->method eq "GET" &&

vadvs, livejournal, vad, pm

Previous post Next post
Up