Skip Menu |
 

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

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

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

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



Subject: PATCH: new tests for max_size and 206 responses
Download (untitled) / with headers
text/plain 400b
Attached is a patch against the current "git" state that adds some more tests for "max_size" and 206 http responses (all the the tests pass). I was also curious to know if "206" would be returned in the case that max_size was used, the max_size requested was greater than the size of the document. But, that behavior is provided by the server, not LWP::UserAgent, so we don't have control over it.
Subject: new_partial_tests.patch
diff --git a/t/local/http.t b/t/local/http.t index 05c231e..5178116 100644 --- a/t/local/http.t +++ b/t/local/http.t @@ -48,7 +48,7 @@ else { } use Test; -plan tests => 49; +plan tests => 52; my $greeting = <DAEMON>; $greeting =~ /(<[^>]+>)/; @@ -328,6 +328,34 @@ ok($_, qr/^Content-Type:\s*application\/x-www-form-urlencoded$/mi); ok($_, qr/^foo=bar&bar=test$/m); #---------------------------------------------------------------- +print "Check partial content response...\n"; +sub httpd_get_partial +{ + my($c) = @_; + $c->send_basic_header(206); + print $c "Content-Type: image/jpeg\015\012"; + $c->send_crlf; + print $c "some fake JPEG content"; + +} + +{ + $req = HTTP::Request->new( GET => url("/partial", $base) ); + $res = $ua->request($req); + ok($res->is_success); # "a 206 response is considered successful" +} +{ + $ua->max_size(3); + $req = HTTP::Request->new( GET => url("/partial", $base) ); + $res = $ua->request($req); + ok($res->is_success); # "a 206 response is considered successful" + # Put max_size back how we found it. + $ua->max_size(undef); + ok($res->as_string, qr/Client-Aborted: max_size/); # Client-Aborted is returned when max_size is given +} + + +#---------------------------------------------------------------- print "Terminating server...\n"; sub httpd_get_quit {
Download (untitled) / with headers
text/plain 102b
Thanks. Applied. http://github.com/gisle/libwww- perl/commit/addd40fdf0e6c885b0ed51fb04b867e8b70e1971


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.