Re: transfer-encoding buglet

Gisle Aas <[email protected]> 13 Oct 2003 00:41:39 -0700
Newsgroups gmane.comp.lang.perl.modules.lwp,gmane.comp.web.filterproxy.devel
Message-ID <[email protected]>
Bob McElrath <[email protected]> writes:

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

Perhaps this warnings shows becase nothing sets 'http_connection'.  
Do you have further patches to Net::HTTP not shown here.


> 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.
> > 
> > libwww currently does not correctly implement the "unless" clause where
> > the connection is closed but a transfer-coding header is present.

I agree.

> > 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

I don't see any problem with this one.  Do you have other examples?

Regards,
Gisle

> --- 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 = ${*$self}{'http_te'}) {
>  	    my @te = split(/\s*,\s*/, lc($te));
> +            my @connection = split(/\s*,\s*/, 
> +                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") || 
> +                        (grep lc($_) eq "close", @connection));
>  
>  	    for (@te) {
>  		if ($_ eq "deflate" && zlib_ok()) {