transfer-encoding buglet

Bob McElrath <[email protected]> Sun, 5 Oct 2003 12:55:59 -0700
Newsgroups gmane.comp.lang.perl.modules.lwp,gmane.comp.web.filterproxy.devel
Message-ID <[email protected]>
--KN5l+BnMqAQyZLvT
Content-Type: multipart/mixed; boundary="yNb1oOkm5a9FJOVX"
Content-Disposition: inline


--yNb1oOkm5a9FJOVX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

According to RFC 2616, section 3.6:
    Whenever a transfer-coding is applied to a message-body, the set of
    transfer-codings MUST include "chunked", unless the message is
    terminated by closing the connection.

libwww currently does not correctly implement the "unless" clause where
the connection is closed but a transfer-coding header is present.

Attached is a small patch which fixes this.  A URL that I've run
across that exhibit the problem with FilterProxy are:

    http://larve.net/people/hugo/2000/07/ml-mutt

Cheers,
-- Bob

--yNb1oOkm5a9FJOVX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="libwww-methods-TE-close.diff"
Content-Transfer-Encoding: quoted-printable

--- Methods.pm	2003-10-05 12:21:21.000000000 -0700
+++ /usr/share/perl5/Net/HTTP/Methods.pm	2003-10-05 12:24:43.000000000 -0700
@@ -367,8 +367,10 @@
 	}
 	elsif (my $te =3D ${*$self}{'http_te'}) {
 	    my @te =3D split(/\s*,\s*/, lc($te));
+            my @connection =3D split(/\s*,\s*/, ${*$self}{'http_connection=
'});
 	    die "Chunked must be last Transfer-Encoding '$te'"
-		unless pop(@te) eq "chunked";
+		unless((pop(@te) eq "chunked") ||=20
+                        (grep lc($_) eq "close", @connection));
=20
 	    for (@te) {
 		if ($_ eq "deflate" && zlib_ok()) {

--yNb1oOkm5a9FJOVX--

--KN5l+BnMqAQyZLvT
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/gHdOjwioWRGe9K0RAhQ8AJwJzsm0+WOoq7TvBy+CGhDS164XGwCfb9tr
boARVxCLSoyiOjnuZwHCL94=
=Xi4j
-----END PGP SIGNATURE-----

--KN5l+BnMqAQyZLvT--