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

[livejournal] r16104:

Committer: gprochaev
U   branches/modernize2/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm
U   branches/modernize2/cgi-bin/Apache/LiveJournal.pm
U   branches/modernize2/cgi-bin/LJ/Error.pm
U   branches/modernize2/cgi-bin/LJ/Request/Apache.pm
U   branches/modernize2/cgi-bin/LJ/S2.pm
U   branches/modernize2/cgi-bin/ljlib.pl
Modified: branches/modernize2/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm
===================================================================
--- branches/modernize2/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm	2010-01-19 10:12:55 UTC (rev 16104)
@@ -583,7 +583,7 @@
     # if not, fall back to digest.
     my $wsse = LJ::Request->header_in('X-WSSE');
     my $nonce_dup;
-    my $u = $wsse ? auth_wsse($wsse, \$nonce_dup) : LJ::auth_digest(LJ::Request->r);
+    my $u = $wsse ? auth_wsse($wsse, \$nonce_dup) : LJ::auth_digest();
     return respond(401, "Authentication failed for this AtomAPI request.")
         unless $u;
 

Modified: branches/modernize2/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- branches/modernize2/cgi-bin/Apache/LiveJournal.pm	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/Apache/LiveJournal.pm	2010-01-19 10:12:55 UTC (rev 16104)
@@ -1289,7 +1289,7 @@
     # handle HTTP digest authentication
     if ($GET{'auth'} eq 'digest' ||
         LJ::Request->header_in("Authorization") =~ /^Digest/) {
-        my $res = LJ::auth_digest(LJ::Request->r);
+        my $res = LJ::auth_digest();
         unless ($res) {
             LJ::Request->content_type("text/html");
             LJ::Request->send_http_header();

Modified: branches/modernize2/cgi-bin/LJ/Error.pm
===================================================================
--- branches/modernize2/cgi-bin/LJ/Error.pm	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/LJ/Error.pm	2010-01-19 10:12:55 UTC (rev 16104)
@@ -207,7 +207,7 @@
                         'clientver'   => $rl->notes('clientver'),
                         'method'      => LJ::Request->method,
                         'uri'         => $uri,
-                        'args'        => scalar LJ::Request->get_params,
+                        'args'        => scalar LJ::Request->args,
                         'browser'     => LJ::Request->header_in("User-Agent"),
                         'ref'         => LJ::Request->header_in("Referer"),
                         );

Modified: branches/modernize2/cgi-bin/LJ/Request/Apache.pm
===================================================================
--- branches/modernize2/cgi-bin/LJ/Request/Apache.pm	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/LJ/Request/Apache.pm	2010-01-19 10:12:55 UTC (rev 16104)
@@ -40,6 +40,11 @@
     return $instance;
 }
 
+sub LJ::Request::status_line {
+    die "Request is not provided to LJ::Request" unless $instance;
+    return $instance->{apr}->status_line(@_);
+}
+
 sub LJ::Request::is_inited {
     return $instance ? 1 : 0;
 }

Modified: branches/modernize2/cgi-bin/LJ/S2.pm
===================================================================
--- branches/modernize2/cgi-bin/LJ/S2.pm	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/LJ/S2.pm	2010-01-19 10:12:55 UTC (rev 16104)
@@ -722,7 +722,7 @@
 
     if ($opts->{'use_modtime'})
     {
-        my $ims = LJ::request->header_in("If-Modified-Since");
+        my $ims = LJ::Request->header_in("If-Modified-Since");
         my $ourtime = LJ::time_to_http($modtime);
         if ($ims eq $ourtime) {
             # 304 return; unload non-public layers

Modified: branches/modernize2/cgi-bin/ljlib.pl
===================================================================
--- branches/modernize2/cgi-bin/ljlib.pl	2010-01-19 09:39:15 UTC (rev 16103)
+++ branches/modernize2/cgi-bin/ljlib.pl	2010-01-19 10:12:55 UTC (rev 16104)
@@ -1689,7 +1689,6 @@
 # limits and nonce counts are used to prevent replay attacks.
 
 sub auth_digest {
-    my ($r) = @_;
 
     my $decline = sub {
         my $stale = shift;
@@ -1697,16 +1696,16 @@
         my $nonce = LJ::challenge_generate(180); # 3 mins timeout
         my $authline = "Digest realm=\"lj\", nonce=\"$nonce\", algorithm=MD5, qop=\"auth\"";
         $authline .= ", stale=\"true\"" if $stale;
-        $r->header_out("WWW-Authenticate", $authline);
-        $r->status_line("401 Authentication required");
+        LJ::Request->header_out("WWW-Authenticate", $authline);
+        LJ::Request->status_line("401 Authentication required");
         return 0;
     };
 
-    unless ($r->header_in("Authorization")) {
+    unless (LJ::Request->header_in("Authorization")) {
         return $decline->(0);
     }
 
-    my $header = $r->header_in("Authorization");
+    my $header = LJ::Request->header_in("Authorization");
 
     # parse it
     # TODO: could there be "," or " " inside attribute values, requiring
@@ -1766,7 +1765,7 @@
 
     my $a1src = $u->user . ':lj:' . $u->password;
     my $a1 = Digest::MD5::md5_hex($a1src);
-    my $a2src = $r->method . ":$attrs{'uri'}";
+    my $a2src = LJ::Request->method . ":$attrs{'uri'}";
     my $a2 = Digest::MD5::md5_hex($a2src);
     my $hashsrc = "$a1:$attrs{'nonce'}:$attrs{'nc'}:$attrs{'cnonce'}:$attrs{'qop'}:$a2";
     my $hash = Digest::MD5::md5_hex($hashsrc);
@@ -2639,9 +2638,8 @@
     my $dest = $LJ::WORK_REPORT_HOST;
     return unless $dest;
 
-    my $r = eval { LJ::Request->instance; };
-    return unless $r;
-    return if $r->method eq "OPTIONS";
+    return unless LJ::Request->is_inited;
+    return if LJ::Request->method eq "OPTIONS";
 
     $dest = $dest->() if ref $dest eq "CODE";
     return unless $dest;
@@ -2654,9 +2652,9 @@
 
     my @fields = ($$, $what);
     if ($what eq "start") {
-        my $host = $r->header_in("Host");
-        my $uri = $r->uri;
-        my $args = $r->args;
+        my $host = LJ::Request->header_in("Host");
+        my $uri = LJ::Request->uri;
+        my $args = LJ::Request->args;
         $args = substr($args, 0, 100) if length $args > 100;
         push @fields, $host, $uri, $args;
 

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