develooper Front page | perl.libwww | Postings from February 2001

[Bug #131388] joining Location header results into wrong URLs

Thread Next
From:
noreply
Date:
February 7, 2001 03:23
Subject:
[Bug #131388] joining Location header results into wrong URLs
Message ID:
E14QShU-0006id-00@usw-sf-web2.sourceforge.net
Bug #131388, was updated on 2001-Feb-07 03:23
Here is a current snapshot of the bug.

Project: libwww-perl
Category: None
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: nobody
Assigned to : nobody
Summary: joining Location header results into wrong URLs

Details: LWP: 5.50
Module: LWP::Protocol::http
Some servers return two Location: headers
(e.g.
http://service.bfast.com/bfast/click?bfmid=20911217&siteid=37451739&bfpage=hplink
after 2nd redirect - it's where code boiled out). push_header() will join
URLs with ', ', and this is kinda wrong =)
I haven't checked what RFC states about such cases yet, but anyhow, here's
a patch for module mentioned above
--- http.pm.old Wed Feb  7 13:18:53 2001
+++ http.pm     Wed Feb  7 13:19:16 2001
@@ -219,7 +219,11 @@
                last unless length $line;
 
                if ($line =~ /^([a-zA-Z0-9_\-.]+)\s*:\s*(.*)/) {
-                   $response->push_header($key, $val) if $key;
+                   if ($key =~ /^location/i) {
+                     $response->header($key, $val) if $key;
+                   } else {            
+                     $response->push_header($key, $val) if $key;
+                   }
                    ($key, $val) = ($1, $2);
                } elsif ($line =~ /^\s+(.*)/ && $key) {
                    $val .= " $1";


And thanks for a nice lib! 
Artiom Morozov
CSP Ltd.
apm@csp.org.by

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=131388&group_id=14630

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About