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
results in a response of
telnet www.paymentech.net 80^M
Trying 63.251.156.40...^M
Connected to www.paymentech.net.^M
Escape character is '^]'.^M
GET /facelift/sol_pcsol_page.jsp HTTP/1.1
Host: www.paymentech.net
HTTP/1.1 200 OK
Date: Sun, 18 Nov 2001 06:54:55 GMT
Server: WebLogic 6.0 Service Pack 2 05/24/2001 11:55:28 #117037
Content-Type: text/html
Connection: Keep-Alive
Transfer-Encoding: Chunked
Set-Cookie: JSESSIONID=O1dbP0c0rlTJTHF8y62bxVs1f1uvKskAKRnMTMpa5OnKeX3jDDLp!8773
487694517038762!167772202!80!443; path=/
note that Chunked is capatilized.
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'".
The code in lib/Net/HTTP/Methods has this:
elsif (my $te = ${*$self}{'http_te'}) {
my @te = split(/\s*,\s*/, $te);
die "Chunked must be last Transfer-Encoding '$te'"
unless pop(@te) eq "chunked";
for (@te) {
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])) }
}
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.
Best,
Blair
--
Blair Zajac <[EMAIL PROTECTED]> - Perl & sysadmin services for hire
Web and OS performance plots - http://www.orcaware.com/orca/
--- Methods.pm Sat Nov 17 16:33:07 2001
+++ ../../../../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 {