Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 101990
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: X-Died responses should not be considered as successful
Download (untitled) / with headers
text/plain 422b
If an LWP request fails with an internal exception, then the pseudo header X-Died is set, but the request is still consindered as "successful". See the attached test script. Also, the documentation for the X-Died header is not complete. It's just mentioned for the :content_cb option of ->get, but apparently may also happen for :content_file. It's also not mentioned for ->request(HTTP::Response->new(...), $dest_file).
Subject: x-died.t
Download x-died.t
text/x-perl 590b
#!/usr/bin/perl -w use strict; use Cwd 'realpath'; use File::Temp 'tempfile'; use HTTP::Request; use LWP::UserAgent; use Test::More 'no_plan'; my($tmpfh,$tmpfile) = tempfile(UNLINK => 1); close $tmpfh; chmod 0400, $tmpfile or die $!; my $res = LWP::UserAgent->new->get('file://' . realpath($0), ':content_file' => $tmpfile); # or: my $res = LWP::UserAgent->new->request(HTTP::Request->new('GET', 'file://' . realpath($0)), $tmpfile); ok $res->header('X-Died'), 'X-Died header seen'; ok $res->is_error, 'response is an error'; ok !$res->is_success, 'response is not successful'; __END__
Download (untitled) / with headers
text/plain 343b
On Sat Feb 07 14:15:49 2015, SREZIC wrote: Show quoted text
> If an LWP request fails with an internal exception, then the pseudo > header X-Died is set, but the request is still consindered as > "successful". See the attached test script.
I've been bitten by this myself and seen questions about it on StackOverflow. The current behaviour is very confusing.
Download (untitled) / with headers
text/plain 487b
On Sat Aug 01 08:54:01 2015, OALDERS wrote: Show quoted text
> On Sat Feb 07 14:15:49 2015, SREZIC wrote:
> > If an LWP request fails with an internal exception, then the pseudo > > header X-Died is set, but the request is still consindered as > > "successful". See the attached test script.
> > I've been bitten by this myself and seen questions about it on > StackOverflow. The current behaviour is very confusing.
I've tried to address this here https://github.com/libwww-perl/http-message/pull/25


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.