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

[livejournal] r19236: LJSUP-8995: OMG should works properly wi...

Committer: gariev
LJSUP-8995: OMG should works properly with search robots and crawlers

U   trunk/cgi-bin/Apache/LiveJournal.pm
U   trunk/cgi-bin/LJ/Session.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2011-06-06 08:22:22 UTC (rev 19235)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2011-06-06 08:50:25 UTC (rev 19236)
@@ -321,6 +321,7 @@
     BML::set_language($lang, \&LJ::Lang::get_text);
 
     my $is_ssl = $LJ::IS_SSL = LJ::run_hook("ssl_check");
+    $LJ::IS_BOT_USERAGENT = BotCheck->is_bot( LJ::Request->header_in('User-Agent') );
 
     my $bml_handler = sub {
         my $filename = shift;

Modified: trunk/cgi-bin/LJ/Session.pm
===================================================================
--- trunk/cgi-bin/LJ/Session.pm	2011-06-06 08:22:22 UTC (rev 19235)
+++ trunk/cgi-bin/LJ/Session.pm	2011-06-06 08:50:25 UTC (rev 19236)
@@ -660,12 +660,10 @@
     my $no_session = sub {
         my $reason = shift;
         
-        ## hack: don't redirect crawlers (yandex crawlers, actually) to get_domain_session.bml
-        ## otherwise, sites like 'omgadget.ru' are not indexed by yandex
-        my $ua = LJ::Request->header_in('User-Agent');
-        if ($ua && $ua =~ m!http://yandex\.com/bots!i) {
-            return undef;
-        } 
+        ## Hack: don't redirect crawlers to get_domain_session.bml.
+        ## Otherwise, sites like 'omgadget.ru' are not indexed by yandex,
+        ## and many crawlers (that don't accept cookies) get into endless redirect cycle.
+        return undef if $LJ::IS_BOT_USERAGENT;
 
         my $rr = $opts->{redirect_ref};
         if ($rr) {

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