Re: transfer-encoding buglet

Bob McElrath <[email protected]> Sun, 5 Oct 2003 13:11:11 -0700
Newsgroups gmane.comp.lang.perl.modules.lwp,gmane.comp.web.filterproxy.devel
Message-ID <[email protected]>
--8TaQrIeukR7mmbKf
Content-Type: multipart/mixed; boundary="Yb+qhiCg54lqZFXW"
Content-Disposition: inline


--Yb+qhiCg54lqZFXW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This version doesn't cause a warning if the "Connection" header isn't
present.

Bob McElrath [[email protected]] wrote:
> 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.
>=20
> libwww currently does not correctly implement the "unless" clause where
> the connection is closed but a transfer-coding header is present.
>=20
> Attached is a small patch which fixes this.  A URL that I've run
> across that exhibit the problem with FilterProxy are:
>=20
>     http://larve.net/people/hugo/2000/07/ml-mutt
>=20
> Cheers,
> -- Bob

Cheers,
-- Bob

--Yb+qhiCg54lqZFXW
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 13:01:53.000000000 -0700
@@ -367,8 +367,12 @@
 	}
 	elsif (my $te =3D ${*$self}{'http_te'}) {
 	    my @te =3D split(/\s*,\s*/, lc($te));
+            my @connection =3D split(/\s*,\s*/,=20
+                defined ${*$self}{'http_connection'}
+                    ?${*$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()) {

--Yb+qhiCg54lqZFXW--

--8TaQrIeukR7mmbKf
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/gHrfjwioWRGe9K0RAkfUAKCgcW4yPypPETja+xWDBdwE9YD3RwCgrQRU
U4peHw2Kj/vi30rt9sqf5XU=
=Mddu
-----END PGP SIGNATURE-----

--8TaQrIeukR7mmbKf--