On Sat, Nov 3, 2012 at 8:50 AM, pagenyon via RT <
bug-LWP-Protocol-AnyEvent-http@rt.cpan.org> wrote:
Show quoted text> LWP::Protocol::http handles header values with embedded newlines by
> replacing them with spaces. LWP::Protocol::AnyEvent::http should do the
> same.
>
Indeed.
Test server:
$ perl -MIO::Socket::INET -e'
my $s = IO::Socket::INET->new(LocalPort=>12345,Listen=>1) or die $!;
my $c = $s->accept;
sleep 1;
$c->print("HTTP/1.1 200 OK\r\n");
$c->print("Connection: Close\r\n");
$c->print("Content-Length: 4\r\n");
$c->print("Content-Type: text/html\r\n");
$c->print("FooBar: foo\r\n");
$c->print(" bar\r\n");
$c->print("\r\n");
$c->print("xxx\n");
sleep 1;
'
Normal LWP:
Show quoted text>perl -MLWP -E"$ua = LWP::UserAgent->new(); print $ua->get('
http://127.0.0.1:12345/')->as_string"
HTTP/1.1 200 OK
Connection: Close
Content-Length: 4
Content-Type: text/html
Client-Date: Sun, 04 Nov 2012 05:37:03 GMT
Client-Peer: 127.0.0.1:12345
Client-Response-Num: 1
FooBar: foo bar
xxx
With LWP::Protocol::AnyEvent::http:
Show quoted text>perl -MLWP::Protocol::AnyEvent::http -MLWP -E"$ua = LWP::UserAgent->new();
print $ua->get('
http://127.0.0.1:12345/')->as_string"
HTTP/1.1 200 OK
Connection: Close
Content-Length: 4
Content-Type: text/html
Client-Date: Sun, 04 Nov 2012 05:41:09 GMT
Foobar: foo
bar
X-AE-URL:
http://127.0.0.1:12345/
xxx
As far as I can tell, those two headers should be considered equivalent,
which means:
1. You're working with buggy code if this is causing you problems.
2. There's no harm in machting LWP's normal behaviour.
I'm on it.
- Eric