Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oneiric

Hi,

Attached is the patch which has been uploaded to Ubuntu Oneiric package to resolve this issue.

Thanks.

Kind Regards,
Dave Walker
Description: Fixes for the testsuite to be compatible with >= LWP + HTTP:Headers 6.0.
 This patch is created from 4 upstream trunk commits folded.
 Resolves FTBFS for failures during the testsuite run.
 .
 Upstream commit log:
 * LWP 6.x uses HTTP/1.1 but t/response/TestAPI/request_rec.pm assumes it is always called using HTTP/1.0
 * HTTP::Headers at least in version 6.00 does not translate underscores to minus when storing headers but does so when they are read.
 * next try: restrict localization of $HTTP::Headers::TRANSLATE_UNDERSCORE to HTTP::Headers 6.00 only
 * fixed a wrong content-length header in t/filter/TestFilter/out_str_reverse.pm
Origin: commit:1089411, http://svn.apache.org/viewvc?view=revision&revision=1089411
Origin: commit:1089349, http://svn.apache.org/viewvc?view=revision&revision=1089349
Origin: commit:1089363, http://svn.apache.org/viewvc?view=revision&revision=1089349
Origin: commit:1089414, http://svn.apache.org/viewvc?view=revision&revision=1089414
Bug-Ubuntu: https://launchpad.net/bugs/797716
Bug-Debian: http://bugs.debian.org/628296
From: Dave Walker (Daviey) <davewal...@ubuntu.com>
Last-Update: 2011-06-15

--- a/t/api/err_headers_out.t
+++ b/t/api/err_headers_out.t
@@ -19,6 +19,14 @@
 
     ok t_cmp $res->code, 200, "OK";
 
+    # HTTP::Headers 6.00 makes the next 2 tests fail. When the response comes
+    # in the header name is stored as "x-err_headers_out". But when it is to
+    # be read below it is referred as "x-err-headers-out" and hence not found.
+    local $HTTP::Headers::TRANSLATE_UNDERSCORE=
+	$HTTP::Headers::TRANSLATE_UNDERSCORE;
+    undef $HTTP::Headers::TRANSLATE_UNDERSCORE
+	if defined HTTP::Headers->VERSION and HTTP::Headers->VERSION==6.00;
+
     ok t_cmp $res->header('X-err_headers_out'), "err_headers_out",
         "X-err_headers_out: made it";
 
@@ -36,6 +44,14 @@
 
     ok t_cmp $res->code, 404, "not found";
 
+    # HTTP::Headers 6.00 makes this test fail. When the response comes in
+    # the header name is stored as "x-err_headers_out". But when it is to
+    # be read below it is referred as "x-err-headers-out" and hence not found.
+    local $HTTP::Headers::TRANSLATE_UNDERSCORE=
+	$HTTP::Headers::TRANSLATE_UNDERSCORE;
+    undef $HTTP::Headers::TRANSLATE_UNDERSCORE
+	if defined HTTP::Headers->VERSION and HTTP::Headers->VERSION==6.00;
+
     ok t_cmp $res->header('X-err_headers_out'), "err_headers_out",
         "X-err_headers_out: made it";
 
--- a/t/filter/TestFilter/out_str_reverse.pm
+++ b/t/filter/TestFilter/out_str_reverse.pm
@@ -16,12 +16,21 @@
 use Apache2::Const -compile => qw(OK M_POST);
 
 use constant BUFF_LEN => 2;
+use constant signature => "Reversed by mod_perl 2.0\n";
 
 sub handler {
     my $f = shift;
     #warn "called\n";
 
     my $leftover = $f->ctx;
+
+    # We are about to change the length of the response body. Hence, we
+    # have to adjust the content-length header.
+    unless (defined $leftover) { # 1st invocation
+	$f->r->headers_out->{'Content-Length'}+=length signature
+	    if exists $f->r->headers_out->{'Content-Length'};
+    }
+
     while ($f->read(my $buffer, BUFF_LEN)) {
         #warn "buffer: [$buffer]\n";
         $buffer = $leftover . $buffer if defined $leftover;
@@ -34,7 +43,7 @@
 
     if ($f->seen_eos) {
         $f->print(scalar reverse $leftover) if defined $leftover;
-        $f->print("Reversed by mod_perl 2.0\n");
+        $f->print(signature);
     }
     else {
         $f->ctx($leftover) if defined $leftover;
--- a/t/response/TestAPI/request_rec.pm
+++ b/t/response/TestAPI/request_rec.pm
@@ -57,8 +57,9 @@
 
     ok $r->protocol =~ /http/i;
 
-    # HTTP 1.0
-    ok t_cmp $r->proto_num, 1000, 't->proto_num';
+    # LWP >=6.00 uses HTTP/1.1, other HTTP/1.0
+    ok t_cmp $r->proto_num, 1000+substr($r->the_request, -1),
+	't->proto_num';
 
     ok t_cmp lc($r->hostname), lc($r->get_server_name), '$r->hostname';
 
@@ -124,7 +125,12 @@
 
         ok t_cmp $r->args, $args, '$r->args';
 
-        ok t_cmp $r->the_request, "GET $base_uri$path_info?$args HTTP/1.0",
+	# LWP uses HTTP/1.1 since 6.00
+        ok t_cmp $r->the_request, qr!GET
+				     \x20
+				     \Q$base_uri$path_info\E\?\Q$args\E
+				     \x20
+				     HTTP/1\.\d!x,
             '$r->the_request';
 
         {

Reply via email to