From james [...] riverstyx.net Fri Nov 12 18: | 23:10 2010 |
MIME-Version: | 1.0 |
X-Spam-Status: | No, score=-6.899 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_FAIL=0.001] autolearn=ham |
X-Mailer: | Evolution 2.28.3 |
X-Spam-Flag: | NO |
Message-ID: | <1289604072.1591.58.camel [...] james-desktop> |
content-type: | text/plain; charset="utf-8" |
X-Virus-Scanned: | Debian amavisd-new at bestpractical.com |
X-Virus-Scanned: | Debian amavisd-new at sentrypayments.com |
X-Spam-Score: | -6.899 |
Received: | from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 6CC79241072 for <cpan-bug+libwww-perl [...] hipster.bestpractical.com>; Fri, 12 Nov 2010 18:23:10 -0500 (EST) |
Received: | from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PYEGDK4Q3yCi for <cpan-bug+libwww-perl [...] hipster.bestpractical.com>; Fri, 12 Nov 2010 18:23:08 -0500 (EST) |
Received: | from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0964A240FCA for <bug-libwww-perl [...] rt.cpan.org>; Fri, 12 Nov 2010 18:23:07 -0500 (EST) |
Received: | (qmail 28644 invoked by uid 103); 12 Nov 2010 23:23:25 -0000 |
Received: | from x16.dev (10.0.100.26) by x1.dev with QMQP; 12 Nov 2010 23:23:25 -0000 |
Received: | from mail.sentrypayments.com (HELO mail.sentrypayments.com) (64.40.98.106) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Fri, 12 Nov 2010 15:23:23 -0800 |
Received: | from localhost (localhost [127.0.0.1]) by mail.sentrypayments.com (Postfix) with ESMTP id 48C58CFAF0 for <bug-libwww-perl [...] rt.cpan.org>; Fri, 12 Nov 2010 15:23:21 -0800 (PST) |
Received: | from mail.sentrypayments.com ([64.40.98.106]) by localhost (mail.sentrypayments.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dgRLRLH0Vwiy for <bug-libwww-perl [...] rt.cpan.org>; Fri, 12 Nov 2010 15:23:19 -0800 (PST) |
Received: | from [172.16.200.29] (unknown [204.244.97.66]) by mail.sentrypayments.com (Postfix) with ESMTPSA id 1CC9DCFAC0 for <bug-libwww-perl [...] rt.cpan.org>; Fri, 12 Nov 2010 15:23:19 -0800 (PST) |
Delivered-To: | cpan-bug+libwww-perl [...] hipster.bestpractical.com |
Subject: | HTTP::Response as_string and parse not commutative |
Return-Path: | <james [...] riverstyx.net> |
X-RT-Mail-Extension: | libwww-perl |
X-Original-To: | cpan-bug+libwww-perl [...] hipster.bestpractical.com |
X-Spam-Check-BY: | 16.mx.develooper.com |
Date: | Fri, 12 Nov 2010 15:21:12 -0800 |
X-Spam-Level: | |
To: | bug-libwww-perl [...] rt.cpan.org |
Content-Transfer-Encoding: | 7bit |
From: | James Zwiers <james [...] riverstyx.net> |
X-RT-Original-Encoding: | us-ascii |
Content-Length: | 1503 |
We have found that calling as_string on an HTTP::Response object which
is later restored via HTTP::Response->parse introduces changes in the
content of the response.
HTTP::Response v 5.813
Perl 5.10.0
OS Debian 2.6.26-25lenny1 Linux 2.6.26 modules on AMD64
=============
Reproducing this problem is very simple. The following snippet of code
will demonstrate the problem; its output is below the next break.
use HTTP::Response;
my $r = HTTP::Response->new;
$r->content("This is a sample of content");
print "---\n",$r->content,"---\n";
my $s = $r->as_string;
print "---\n", $s, "---\n";
my $t = HTTP::Response->parse($s);
print "---\n", $t->content, "---\n";
=============
---
This is a sample of content---
---
000 Unknown code
This is a sample of content
---
---
This is a sample of content
---
=============
It is the opinion of myself and my colleagues that the last output
should be identical to the first. Introducing new data into the content
stream during this operation is troublesome from the context of using
as_string as a means to serialize an HTTP::Message (specifically an
HTTP::Response, but I suspect this also applies to HTTP::Requests; but
that is not confirmed).
Without knowing why a newline is appended to the as_string results, I
cannot suggest methods of fixing this. We have a work-around in place,
but I would rather see a solution within libwww-perl than leave a
work-around in place for an extended period of time.
James Zwiers
Riverstyx Internet