hi all...

yesterday I was wanting to write test scripts for a module that toggles r->assbackwards. currently, Apache::Test dies (under LWP at least) when using HTTP/0.9, so it's pretty much impossible to write tests for that functionality.

I figure that testing HTTP/0.9 may be something somebody else wants to do legitimately, even if they aren't playing with r->assbackwards like I am. so, attached is a patch which basically allows me to toggle HTTP/0.9 acceptability by sticking

BEGIN {
  $ENV{PERL_LWP_HTTP_09_OK}=1;
}

in either TEST.PL (for the entire test suite) or in t/foo.t (for individual scripts)

there's probably a better way to do this, but I haven't been following httpd-test developement for a while so this was what first came to me...

--Geoff
Index: TestRequest.pm
===================================================================
RCS file: 
/home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRequest.pm,v
retrieving revision 1.71
diff -u -r1.71 TestRequest.pm
--- TestRequest.pm      4 Apr 2002 00:54:26 -0000       1.71
+++ TestRequest.pm      14 Jun 2002 13:31:33 -0000
@@ -3,7 +3,10 @@
 use strict;
 use warnings FATAL => 'all';
 
-BEGIN { $ENV{PERL_LWP_USE_HTTP_10} = 1; } #default to http/1.0
+BEGIN { 
+  $ENV{PERL_LWP_USE_HTTP_10} ||= 1;  # default to http/1.0
+  $ENV{PERL_LWP_HTTP_09_OK}  ||= 0;  # make 0.9 an option
+}
 
 use Apache::Test ();
 use Apache::TestConfig ();
@@ -392,7 +395,7 @@
             if ($proto !~ /^HTTP\/(\d\.\d)$/) {
                 $error = "response had no protocol (is LWP broken or 
something?)";
             }
-            if ($1 ne "1.0" && $1 ne "1.1") {
+            if ($1 ne "1.0" && $1 ne "1.1" && !$ENV{PERL_LWP_HTTP_09_OK}) {
                 $error = "response had protocol HTTP/$1 (headers not sent?)";
             }
         }

Reply via email to