[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Re: RFC: CGI::Application::Plugin::CAPTCHA


so, what of cgiapp_postrun? For those of us that sometimes alter headers there, this would be an issue to be contended with.

That's a good question. It's possible that a postrun could alter headers
incorrectly or mangle the image. There's a couple of options that come
to mind quickly. How good they are is definitely a wildcard :)

+ Maybe C::A needs a way for a plugin to not only register a callback,
but also unregister a hook/callback. So the create_captcha() run mode
would just make sure there are no postruns running. This could cause
problems though if you have postruns that need to run that wouldn't
affect the headers or the image.


I would say the best practice here is for cgiapp_postrun to check the
Content-type header.

If it usually munges HTML, it should check that the Content-Type is 'text/html'
and leave everything else alone.

    Mark

As an FYI, here's what I do in my postrun:

if($self->header_type eq 'header') { my %props = $self->header_props; if(!exists($props{'-type'}) or $props{'-type'} eq 'text/html') { $self->header_add(-type=>'text/html', -charset=>'utf-8');
            # ...
            # more useful stuff here
        }
    }

Notes:
1) the -type prop is usually not set, hence the exists() test.
2) I always use the "-type" way of CGI; it may also be possible to use "-Content_type" or something like that.

Just my 2 øre :)

Rhesa



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.