Phade wrote:This exactly how the system works. A flag is set at the end of the script saying that the download is completed. This flag should only be set if the script has handed out the entire file.
Indeed, the flag should not be set... but it was. Weird bug.
Phade wrote:The issue you have encountered must be something specific to DAP or something that Mozilla manager corrects for. Does DAP have a FAQ for setting up a server script to work with DAP?
No, I'm not aware of a DAP-specific way of setting up a server script, but then again the example code I provided was developped using DAP. So it *should* work. Then again, we all know how much bugs care about "should work", right?
Phade wrote:Having the restart happen immediatly after a cancel is exactly the thing I am trying to avoid. register_shutdown_function will run every time the script ends and thus will only run on completion, which does not help solve the problem. The problem is detecting the time between the last attempted download and the current one.
Sorry to contradict you, but I just ran a test script and the function registered using register_shutdown_function was called when I interrupted the loading of the page with the stop button of my browser. Also, why do you want to avoid a restart immediately after a cancel? I thought the point was to foil simultaneous connections, not successive connections.
Phade wrote:Dan42 wrote:Since I want to use DAP, I hit cancel and I drag the link into the DAP window.
Did you drag the link to the page that you are viewing that starts the download or the link to the video itself?
The link to the video itself, the one that appears after 1 second.
Phade wrote:The only possible printed errors for the file download script are:
* ERROR: File does not exist.
* ERROR: Video is not available for download.
* ERROR: You are attempting to download this video too soon after your last download attempt.
* ERROR: Link information currupted.
* ERROR: You do not have permissions to download local videos.
If I try to download the video too soon, I get a file with "ERROR: You are attempting to download this video too soon after your last download attempt." but if I wait one minute before hitting the "Start Download" button, I just get an empty file!