On Aug 17, 2006, at 1:24 PM, Philippe Bruhat via RT wrote:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=21051 >
>
> On Thu Aug 17 14:10:15 2006, CLOTHO wrote:
>> I have created a filter that throttles bandwidth by postponing
>> delivery
>> of content (useful for simulating a slow connection). Because I'm
>> postponing content, the HTTP headers get sent before the end of
>> content,
>> so the H::P::FilterStack::active function returns true, and the
>> Content-Length gets cleared.
>
> Actually, active() returns true because the proxy has selected some
> filters to be applied on this response.
Ahh, I guess I misunderstood.
Show quoted text>> I understand why this happens (erroneous Content-Length is worse than
>> none at all), but I'd like a way to tell HTTP::Proxy that I'm not
>> planning to alter the content in any way and that the Content-
>> Length can
>> be passed through verbatim.
>
> It's better than before, when I simply removed the Content-Length
> entirely. ;-)
:-)
Show quoted text>> As a workaround, I'm currently doing this in my proxy program:
>>
>> BEGIN {
>> no warnings;
>> *HTTP::Proxy::FilterStack::active = sub { return 0; };
>> }
>>
>> But of course that's evil. Instead, I think a better solution
>> would be
>> that the BodyFilter subclasses should indicate whether they will
>> alter
>> the content or not. If any say true, then clear the Content-
>> Length if
>> active. Otherwise, leave it as-is.
>
> Actually, since filters can be stacked, it would be safer to leave the
> Content-Length header unmodified only if *all* selected filters say
> they won't modify the data.
Yes, we're saying the same thing.
Show quoted text> I think one option would be to suppose that by default, Body filters
> do modify the data, and let one override the appropriate method.
Agreed.
Show quoted text> How would you name this HTTP::Proxy::BodyFilter method?
> I'm thinking about (?:does|can|may)_(?:modify|edit|alter) or
> something like that.
I like the will_modify you settled on in another email
Chris
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703
vCard:
http://www.chrisdolan.net/ChrisDolan.vcf
Clotho Advanced Media, Inc. - Creators of MediaLandscape Software
(
http://www.media-landscape.com/) and partners in the revolutionary
Croquet project (
http://www.opencroquet.org/)