[Catalyst] File downloads - Plugin?

Toby Corkindale tjc at wintrmute.net
Mon Aug 22 19:39:40 CEST 2005


On Fri, Aug 12, 2005 at 08:14:04AM -0500, samwyse wrote:
> On 8/11/05, Toby Corkindale <tjc at wintrmute.net> wrote:
> > Hi,
> > I'm in a position where I'd like to serve file downloads, out of database
> > BLOBs, via Catalyst.
> > 
> > These files are potentially very large, and so I would rather not suck the
> > entire lot of data out of the DB and into Catalyst's $c->response->output()
> > variable.
> 
> If you want to serve things via Catalyst, I'd expect the data to pass
> through Catalyst.  If you want to get Catalyst out of the way, then
> I'd look towards alternate methods of serving.  In other words, handle
> it in much the same way that static data is handled, because that's
> what it is:  static data that just happens to be kept in a database
> instead of a filesystem.

Yes, but static data that is potentially larger than available system ram.
Even if it wasn't, then it would be a poor use of it to fill with once-off
data and totally hose the buffercache.

The data isn't quite static - it is produced on demand by the user, but takes
a while to be generated, and is large. So we send the user off to a 'Pending'
page in the meantime. Once the data is ready, they can collect it.
We want access control to be via the standard, existing Catalyst setup,
because that just makes sense. We must have access control on the data, and
security through obscurity (eg. putting a randomly-named file into an insecure
directory, then redirecting user) is not an option. Unfortunately, doing
$c->response->body($query->blob_read(...)); is not an option either.

I'm looking at the Static plugin currently though.

-Toby

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key 897E5FF3)



More information about the Catalyst mailing list