wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17214: LJSUP-6631. https page should show custo...

Committer: gprochaev
LJSUP-6631. https page should show custom userhead

U   trunk/cgi-bin/Apache/LiveJournal.pm
U   trunk/cgi-bin/LJ/Request/Apache2.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-27 07:58:31 UTC (rev 17213)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-27 08:58:47 UTC (rev 17214)
@@ -370,6 +370,18 @@
         if ($uri =~ m!^/interface/! || $uri =~ m!^/__rpc_!) {
             # handled later
         } elsif ($LJ::SSLDOCS && $uri !~ m!(\.\.|\%|\.\/)!) {
+            if ($uri =~ m#^/img/userinfo.gif#) {
+                my $remote = LJ::get_remote();
+                if ($remote) {
+                    my $custom_userhead = $remote->custom_usericon;
+                    require URI;
+                    my $uri = URI->new ($custom_userhead);
+                    my $res = send_files ($uri->path);
+                    LJ::Request->content_type ("image/gif");
+                    return ($res == LJ::Request::OK) ? LJ::Request::DONE : $res;
+                }
+            }
+
             my $file = "$LJ::SSLDOCS/$uri";
             unless (-e $file) {
                 # no such file.  send them to the main server if it's a GET.
@@ -1364,10 +1376,11 @@
     return LJ::Request::OK
 }
 
-sub files_handler {
+sub send_files {
+    my $uri = shift;
 
-    use LJ::FileStore;
-    my $result = LJ::FileStore->get_path_info( path => LJ::Request->uri );
+    require LJ::FileStore;
+    my $result = LJ::FileStore->get_path_info( path => $uri );
 
     # file not found
     return LJ::Request::NOT_FOUND unless $result;
@@ -1392,19 +1405,20 @@
             LJ::Request->header_out('X-REPROXY-FILE', $paths->[0]);
         }
 
-        my $send_headers = sub {
-            LJ::Request->content_type ($result->{mime_type});
-            LJ::Request->header_out("Content-length", $size);
-            LJ::Request->header_out("Cache-Control", "no-transform");
-            LJ::Request->header_out("Last-Modified", LJ::TimeUtil->time_to_http ($result->{change_time}));
-            LJ::Request->send_http_header();
-        };
-        $send_headers->();
-        return LJ::Request::OK
+        LJ::Request->content_type ($result->{mime_type});
+        LJ::Request->header_out("Content-length", $size);
+        LJ::Request->header_out("Cache-Control", "no-transform");
+        LJ::Request->header_out("Last-Modified", LJ::TimeUtil->time_to_http ($result->{change_time}));
+        LJ::Request->send_http_header();
+        return LJ::Request::OK;
     }
     return LJ::Request::NOT_FOUND;
 }
 
+sub files_handler {
+    return send_files (LJ::Request->uri);
+}
+
 sub files_trans
 {
     LJ::Request->uri =~ m!^/(\w{1,15})/(\w+)(/\S+)!;

Modified: trunk/cgi-bin/LJ/Request/Apache2.pm
===================================================================
--- trunk/cgi-bin/LJ/Request/Apache2.pm	2010-08-27 07:58:31 UTC (rev 17213)
+++ trunk/cgi-bin/LJ/Request/Apache2.pm	2010-08-27 08:58:47 UTC (rev 17214)
@@ -21,6 +21,7 @@
 
 
 sub LJ::Request::OK                        { return Apache2::Const::OK }
+sub LJ::Request::DONE                      { return Apache2::Const::DONE }
 sub LJ::Request::REDIRECT                  { return Apache2::Const::REDIRECT }
 sub LJ::Request::DECLINED                  { return Apache2::Const::DECLINED }
 sub LJ::Request::FORBIDDEN                 { return Apache2::Const::FORBIDDEN }

Tags: livejournal, pm, wisest-owl
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