fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-12-08 12:36 am

[dw-free] Investigate whether we still need anti-squatting message on dev servers

[commit: http://hg.dwscoalition.org/dw-free/rev/f9eaf302076e]

http://bugs.dwscoalition.org/show_bug.cgi?id=3245

Remove old message that tried to detect whether people were using dev
servers as production servers; not so much a concern with the way we have
things set up.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/Apache/LiveJournal.pm
--------------------------------------------------------------------------------
diff -r dfec755980dc -r f9eaf302076e cgi-bin/Apache/LiveJournal.pm
--- a/cgi-bin/Apache/LiveJournal.pm	Tue Dec 07 18:03:21 2010 +0800
+++ b/cgi-bin/Apache/LiveJournal.pm	Wed Dec 08 08:35:57 2010 +0800
@@ -479,26 +479,6 @@ sub trans
     if ($LJ::IS_DEV_SERVER && $GET{'as'} =~ /^\w{1,25}$/) {
         my $ru = LJ::load_user($GET{'as'});
         LJ::set_remote($ru); # might be undef, to allow for "view as logged out"
-    }
-
-    # anti-squatter checking
-    if ($LJ::DEBUG{'anti_squatter'} && $r->method eq "GET") {
-        my $ref = $r->headers_in->{"Referer"};
-        if ($ref && index($ref, $LJ::SITEROOT) != 0) {
-            # FIXME: this doesn't anti-squat user domains yet
-            if ($uri !~ m!^/404!) {
-                # So hacky!  (see note below)
-                $LJ::SQUAT_URL = "http://$host$hostport$uri$args_wq";
-            } else {
-                # then Apache's 404 handler takes over and we get here
-                # FIXME: why??  why doesn't it just work to return OK
-                # the first time with the handlers pushed?  nothing
-                # else requires this chicanery!
-                $r->handler("perl-script");
-                $r->push_handlers(PerlResponseHandler => \&anti_squatter);
-            }
-            return OK;
-        }
     }
 
     # is this the embed module host
@@ -1766,27 +1746,6 @@ sub db_logger
     }
 }
 
-sub anti_squatter
-{
-    my $r = shift;
-    $r->push_handlers(PerlResponseHandler => sub {
-        my $r = shift;
-        $r->content_type("text/html");
-        $r->print("<html><head><title>Dev Server Warning</title>",
-                  "<style> body { border: 20px solid red; padding: 30px; margin: 0; font-family: sans-serif; } ",
-                  "h1 { color: #500000; }",
-                  "</style></head>",
-                  "<body><h1>Warning</h1><p>This server is for development and testing only.  ",
-                  "Accounts are subject to frequent deletion.  Don't use this machine for anything important.</p>",
-                  "<form method='post' action='/misc/ack-devserver.bml' style='margin-top: 1em'>",
-                  LJ::html_hidden("dest", "$LJ::SQUAT_URL"),
-                  LJ::html_submit(undef, "Acknowledged"),
-                  "</form></body></html>");
-        return OK;
-    });
-
-}
-
 sub mogile_fetch {
     my ( $r, $key, $memkey, $class, $send_headers ) = @_;
 
--------------------------------------------------------------------------------