http://www.perlmonks.org?node_id=1043683


in reply to Re: Good method to pass files throught perl/cgi script ?
in thread Good method to pass files throught perl/cgi script ?

No, what I am doing is very server-related. I want to have content on my server since I have my own music player + statistic of downloaded files. ALso I would like to control if files was downloaded completely + need to control download speed and so on. So, if I use nginx along with apache and pass files thru nginx with XSendfile, would it help much ? Maybe there are other options ?
  • Comment on Re^2: Good method to pass files throught perl/cgi script ?

Replies are listed 'Best First'.
Re^3: Good method to pass files throught perl/cgi script ?
by thomas895 (Deacon) on Jul 11, 2013 at 23:24 UTC

    As far as I know, you can't control or even see the download speed in a CGI program. Your script just reads and outputs the whole file to STDOUT, which the server then just passes along to the client. The server probably buffers it, too, so the time it took for the file to be output does not necessarily have to be the time it really took to download. Sendfile won't tell you that, either.

    As far as statistics go, you can write or use a logfile analyser, then count how many times each file was downloaded and by whom, etc.
    Fun fact: you can also add query parameters to the static file locations, and most webservers will not do anything with them by default. Use this to add extra info that you might want to analyse later.

    ~Thomas~ 
    "Excuse me for butting in, but I'm interrupt-driven..."