No response yet on IRC, so I try here:
10:06 < domm> hey, I've got a questions regarding a streaming plack app (i.e.
not a middleware)
10:06 < domm> after sending a file, I need to send a request to another server
(but only if the whole file was transmitted)
10:06 < domm> I've come up with something like this:
10:06 < domm>
http://domm.plix.at/share/plack.stream.txt10:07 < domm> which works if run via plackup, but not if run via eg Starman
10:07 < domm> I assume because I need to do some response_cb magic?
10:08 < domm> but as I'm not doing a middleware, I cannot get a $res via
$app->($env)
10:08 < domm> any ideas/pointers?
Also, after looking at the Starman source code (sub _finalize_response), it seems to me that a plack App and a webserver like Starman behave like a webapp behind a proxy, i.e. the whole content is sent to the proxy (starman) which then transfers it to the user. Which means it's not possible to check if the whole content arrived at the user.
So is there any way to fire an http request after a download is completed?
(more context, if you care: one customer (public radio station) provides a download service where users can download a limited amount of programs as mp3. we can only deduct the download from each users count if we're rather sure the user got the whole file. currently this is implemented in some oldschool catalyst (pre-plack) and some similar fuzzing with ->write as in the sample I showed. I now want to update the app, and split the download thingy into a small standalone server (Plack & Starman (or whatever)). )
Greetings,
domm