[Catalyst] Catalyst::TraitFor::Controller::Sendfile

David Schmidt davewood at gmx.at
Mon Jan 9 10:40:29 GMT 2012


Time to continue ...

I want to support X-Sendfile and X-Accel-Redirect

Currently I have a Catalyst::TraitFor::Controller. but that doesn't
feel right. Should it be a plugin?

c->sendfile(...) seems more appropriate then c->controller(...)->sendfile

or rather a Catalyst::TraitFor::Request like
http://cpansearch.perl.org/src/MAROS/CatalystX-I18N-1.09/lib/CatalystX/I18N/TraitFor/Response.pm

But will that cause overhead for each request instance creation?

On 11 December 2011 13:57, Tomas Doran <bobtfish at bobtfish.net> wrote:
>
> On 11 Dec 2011, at 12:27, David Schmidt wrote:
>
>>
>> https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm
>>
>> I want to continue working on it and have a few questions.
>>
>> - Is it still needed?
>
>
> Yes.
>
>
>> - What should be changed?
>
>
> https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm#L92
>
> https://github.com/davewood/catalyst-traitfor-controller-sendfile/blob/master/lib/Catalyst/TraitFor/Controller/Sendfile.pm#L99
>
> This totally won't work any more (in 5.9) I'm afraid.
>
>
>> - any input regarding missing tests?
>
>
> Erm, IIRC your code is relying on / assuming that you're doing a sendfile on
> something that actually exists on the local (i.e. the web server's) local
> disk.
>
> This often isn't the case. (For example nginx's X-Accel-Redirect redirects
> to another path served by the web server, rather than a file on local disk).
>
> I think this is possible currently, but it's not documented / tested that
> the file could be entirely synthetic (and not correspond to a real file on
> the file system).
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list