Skip Menu |
 

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

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

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

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



Subject: CODE ref in content has no way to reset if request repeats
Download (untitled) / with headers
text/plain 1.1k
Consider a PUT or POST request with a CODE reference for its content. LWP sends the request, but the response it gets is 401 Unauthorized. Fortunately, LWP has the credentials needed, so it repeats the request, adding the needed credentials. Here's the bug: the first request includes the body, but the second does not. I assume this is because LWP simply calls the CODE reference again without making any attempt to "reset" it (there is no mechanism for doing so). Note that this bug would probably also occur if the server issued a redirect. (I haven't tested this, of course.) Possible solutions: 1. Document that this is the case, and that the sub should reset itself if it reaches the end- of-data condition, in case the request is repeated. 2. Pass a byte number to the sub, and document that it should reset its state if the count is zero. 3. Pass a reset flag to the sub, and document the meaning of the flag. All in all, this seems to have happened because the feature is so underdocumented; it's only ever mentioned in LWP::UserAgent. Perhaps the documentation of this feature overall should be improved.


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.