Blair Zajac <[EMAIL PROTECTED]> writes:

> The code that handles Transfer-Encoding's only matches on lowercase header
> values.  A HTTP/1.1 request for the page
> 
>       http://www.paymentech.net/facelift/sol_pcsol_page.jsp

[...]

> When requested using HTTP/1.1 connections in libwww-perl, you get a 500
> "Internal Server Error" page returned to the browser saying: "Chunked must be
> last Transfer-Encoding 'Chunked'".

> I don't know if you just want to add a
> 
>       $_ = lc($_);
> 
> before all of the tests, or do something more complicated, as the attached patch
> does.  It uses lc($_) instead of a presumably slower $_ =~ /^chunked$/ and it
> also checks for the rest of the header values.

The patch I applied was this one:

Index: lib/Net/HTTP/Methods.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/Net/HTTP/Methods.pm,v
retrieving revision 1.2
diff -u -p -u -r1.2 Methods.pm
--- lib/Net/HTTP/Methods.pm     2001/11/17 02:32:00     1.2
+++ lib/Net/HTTP/Methods.pm     2001/11/20 19:47:10
@@ -337,7 +337,7 @@ sub read_entity_body {
            $bytes = 0;
        }
        elsif (my $te = ${*$self}{'http_te'}) {
-           my @te = split(/\s*,\s*/, $te);
+           my @te = split(/\s*,\s*/, lc($te));
            die "Chunked must be last Transfer-Encoding '$te'"
                unless pop(@te) eq "chunked";
 
Thanks again!

Regards,
Gisle

> +++ ../../../../libwww-perl-5.61/lib/Net/HTTP/Methods.pm      Fri Nov 16 18:32:00 
>2001
> @@ -339,16 +339,16 @@
>       elsif (my $te = ${*$self}{'http_te'}) {
>           my @te = split(/\s*,\s*/, $te);
>           die "Chunked must be last Transfer-Encoding '$te'"
> -             unless lc(pop(@te)) eq "chunked";
> +             unless pop(@te) eq "chunked";
>  
>           for (@te) {
> -             if (lc($_) eq "deflate" && zlib_ok()) {
> +             if ($_ eq "deflate" && zlib_ok()) {
>                   #require Compress::Zlib;
>                   my $i = Compress::Zlib::inflateInit();
>                   die "Can't make inflator" unless $i;
>                   $_ = sub { scalar($i->inflate($_[0])) }
>               }
> -             elsif (lc($_) eq "gzip" && zlib_ok()) {
> +             elsif ($_ eq "gzip" && zlib_ok()) {
>                   #require Compress::Zlib;
>                   my @buf;
>                   $_ = sub {
> @@ -357,7 +357,7 @@
>                       return "";
>                   };
>               }
> -             elsif (lc($_) eq "identity") {
> +             elsif ($_ eq "identity") {
>                   $_ = sub { $_[0] };
>               }
>               else {

Reply via email to