Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r17092: LJRU-2138: Special URLs to count how man...

Committer: gariev
LJRU-2138: Special URLs to count how many people hit the link (and redirect them to their actual link
U   trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-06 03:55:13 UTC (rev 17091)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-06 04:20:44 UTC (rev 17092)
@@ -451,11 +451,22 @@
     }
 
     # allow html pages (with .html extention) in user domains and in common www. domain.
-    if (LJ::Request->uri =~ m|\A\/__html(\/.+\.html)\z|){
+    if ($uri =~ m|\A\/__html(\/.+\.html)\z|){
         LJ::Request->uri($1);
         return LJ::Request::DECLINED
     }
 
+    ##
+    if ($host eq $LJ::DOMAIN_WEB && $uri =~ m!^/redirect/!) {
+        my $url = $GET{'url'};
+        $url = $LJ::SITE_ROOT 
+            unless $url 
+                    && $url =~ m! ^ https?:// [-\w.]*? ([-\w]+ \. [-\w]+) / !x 
+                    && $LJ::ALLOWED_REDIRECT_TO_DOMAIN{$1};
+        return redir($url);
+    }
+
+
     my $journal_view = sub {
         my $opts = shift;
         $opts ||= {};

Tags: gariev, livejournal, 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