Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the HTTP-Message CPAN distribution.

Report information
The Basics
Id: 62959
Status: resolved
Priority: 0/
Queue: HTTP-Message

Owner: Nobody in particular
Requestors: james [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

From james [...] 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
X-Virus-Scanned: Debian amavisd-new at
X-Spam-Score: -6.899
Received: from localhost (localhost []) by (Postfix) with ESMTP id 6CC79241072 for <cpan-bug+libwww-perl [...]>; Fri, 12 Nov 2010 18:23:10 -0500 (EST)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id PYEGDK4Q3yCi for <cpan-bug+libwww-perl [...]>; Fri, 12 Nov 2010 18:23:08 -0500 (EST)
Received: from ( []) by (Postfix) with SMTP id 0964A240FCA for <bug-libwww-perl [...]>; 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 ( by with QMQP; 12 Nov 2010 23:23:25 -0000
Received: from (HELO ( by (qpsmtpd/0.80) with ESMTP; Fri, 12 Nov 2010 15:23:23 -0800
Received: from localhost (localhost []) by (Postfix) with ESMTP id 48C58CFAF0 for <bug-libwww-perl [...]>; Fri, 12 Nov 2010 15:23:21 -0800 (PST)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id dgRLRLH0Vwiy for <bug-libwww-perl [...]>; Fri, 12 Nov 2010 15:23:19 -0800 (PST)
Received: from [] (unknown []) by (Postfix) with ESMTPSA id 1CC9DCFAC0 for <bug-libwww-perl [...]>; Fri, 12 Nov 2010 15:23:19 -0800 (PST)
Delivered-To: cpan-bug+libwww-perl [...]
Subject: HTTP::Response as_string and parse not commutative
Return-Path: <james [...]>
X-RT-Mail-Extension: libwww-perl
X-Original-To: cpan-bug+libwww-perl [...]
Date: Fri, 12 Nov 2010 15:21:12 -0800
To: bug-libwww-perl [...]
Content-Transfer-Encoding: 7bit
From: James Zwiers <james [...]>
X-RT-Original-Encoding: us-ascii
Content-Length: 1503
Download (untitled) / with headers
text/plain 1.4k
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
X-RT-Interface: REST
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
RT-Message-ID: <rt-4.0.18-2731-1490921670-200.62959-0-0 [...]>
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 82

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to