Subject: | Progress events do not work if the request results in a redirect response |
Using the testcase provided, the following works:
$ ./testcase 'http://www.yahoo.com/'
However, the following fails to indicate progress due to a redirect:
$ ./testcase 'http://yahoo.com'
After tracing through the code, it appears as though the progress
postback wasn't being propagated properly in the RequestFactory. The
attached patch addresses this problem.
The patch is against the most current release on CPAN (0.84) and passes
all tests.
Subject: | POE-Component-Client-HTTP-0.84-progress-on-redirect.patch |
diff -urP POE-Component-Client-HTTP-0.84.orig/lib/POE/Component/Client/HTTP/RequestFactory.pm POE-Component-Client-HTTP-0.84/lib/POE/Component/Client/HTTP/RequestFactory.pm
--- POE-Component-Client-HTTP-0.84.orig/lib/POE/Component/Client/HTTP/RequestFactory.pm 2008-04-19 19:18:02.000000000 -0500
+++ POE-Component-Client-HTTP-0.84/lib/POE/Component/Client/HTTP/RequestFactory.pm 2008-06-10 10:39:48.000000000 -0500
@@ -262,11 +262,19 @@
# Create a progress postback if requested.
my $progress_postback;
if (defined $progress_event) {
- $progress_postback = $sender->postback(
- $progress_event,
- $http_request,
- $tag
- );
+ if (ref $progress_event) {
+ # The given progress event appears to already
+ # be a postback, so use it. This is needed to
+ # propagate the postback through redirects.
+ $progress_postback = $progress_event;
+ }
+ else {
+ $progress_postback = $sender->postback(
+ $progress_event,
+ $http_request,
+ $tag
+ );
+ }
}
# If we have a cookie jar, have it add the appropriate headers.
Subject: | testcase |
Message body not shown because it is not plain text.