Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: james [...] riverstyx.net
Cc:
AdminCc:

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



Subject: HTTP::Response as_string and parse not commutative
Date: Fri, 12 Nov 2010 15:21:12 -0800
To: bug-libwww-perl [...] rt.cpan.org
From: James Zwiers <james [...] riverstyx.net>
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


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.