vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[miscperl] r262: LJSUP-5445: add LJ::Request as proxy lay...

Committer: vad
LJSUP-5445: add LJ::Request as proxy layer between LJ.com's code and Apache v1/v2.
U   trunk/Apache/CompressClientFixup.pm
Modified: trunk/Apache/CompressClientFixup.pm
===================================================================
--- trunk/Apache/CompressClientFixup.pm	2010-01-25 04:39:20 UTC (rev 261)
+++ trunk/Apache/CompressClientFixup.pm	2010-01-25 08:27:21 UTC (rev 262)
@@ -1,27 +1,24 @@
-# modified from: 
+# modified from:/
 #    http://devl4.outlook.net/devdoc/Dynagzip/ContentCompressionClients.html
 
 package Apache::CompressClientFixup;
 
 use 5.004;
 use strict;
-use Apache::Constants qw(OK DECLINED);
-use Apache::Log();
-use Apache::URI();
 
 use vars qw($VERSION);
 $VERSION = "0.01";
 
 sub handler {
-    my $r = shift;
-    return DECLINED unless $r->header_in('Accept-Encoding') =~ /gzip/io;
+    #my $r = shift;
+    return LJ::Request::DECLINED unless LJ::Request->header_in('Accept-Encoding') =~ /gzip/io;
 
     my $no_gzip = sub { 
-        $r->headers_in->unset('Accept-Encoding');
-        return OK;
+        LJ::Request->unset_header_in('Accept-Encoding');
+        return LJ::Request::OK;
     };
 
-    my $ua = $r->header_in('User-Agent');
+    my $ua = LJ::Request->header_in('User-Agent');
 
  #   if ($r->protocol =~ /http\/1\.0/io) {
  #       # it is not supposed to be compressed:
@@ -31,16 +28,16 @@
 
     if ($ua =~ /MSIE 4\./o) {
         return $no_gzip->() if 
-            $r->method =~ /POST/io ||
-            $r->header_in('Range') ||
-            length($r->uri) > 245;
+            LJ::Request->method =~ /POST/io ||
+            LJ::Request->header_in('Range') ||
+            length(LJ::Request->uri) > 245;
     }
     if ($ua =~ /MSIE 6\.0/o) {
-        return $no_gzip->() if $r->parsed_uri->scheme =~ /https/io;
+        return $no_gzip->() if LJ::Request->parsed_uri->scheme =~ /https/io;
     }
 
-    if ($r->header_in('Via') =~ /^1\.1\s/o ||  # MS Proxy 2.0
-        $r->header_in('Via') =~ /^Squid\//o ||
+    if (LJ::Request->header_in('Via') =~ /^1\.1\s/o ||  # MS Proxy 2.0
+        LJ::Request->header_in('Via') =~ /^Squid\//o ||
         $ua =~ /Galeon\)/o ||
         $ua =~ /Mozilla\/4\.7[89]/o ||
         $ua =~ /Opera 3\.5/o ||

Tags: miscperl, pm, vadvs
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