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

Tomas Doran bobtfish at bobtfish.net
Sun Dec 11 12:57:07 GMT 2011


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




More information about the Catalyst mailing list