Hi there,

I had some trouble using LWP::Simple (v1.36 from Debian's libwww-perl package
version 5.69-4) with this url:

  http://www.tvgids.nl/

It turns out that site does an immediate redirect when hitting that url. The
webserver seems to be broken because it writes 'location:' instead of
'Location:' in the HTTP headers.

The latest LWP::Simple version (v1.38 from libwww-perl 5.76) does not
understand 'location' with lower-case first letter either.

The patch below (against v1.38) fixes LWP::Simple to accept a lowercase
'location' header. 

In the mindset of 'Be liberal in what you receive, and conservative in what
you send', is this worth adding to libwww-perl?

Thanks,
Ward Vandewege. 

--- Simple.pm   2003-12-31 14:15:59.000000000 -0500
+++ Simple.pm   2003-12-31 14:16:24.000000000 -0500
@@ -180,7 +180,7 @@
    if ($buf =~ m,^HTTP/\d+\.\d+\s+(\d+)[^\012]*\012,) {
        my $code = $1;
        #print "CODE=$code\n$buf\n";
-       if ($code =~ /^30[1237]/ && $buf =~ /\012Location:\s*(\S+)/) {
+       if ($code =~ /^30[1237]/ && $buf =~ /\012Location:\s*(\S+)/i) {
            # redirect
            my $url = $1;
            return undef if $loop_check{$url}++;

-- 
Pong.be         -( "Free Software as in free speech, not free beer. Think  )-
Virtual hosting -(       of freedom, not price." -- Richard Stallman       )-
http://pong.be  -(                                                         )-
GnuPG public key: http://gpg.dtype.org

Reply via email to