Page 1 of 1

HTTP download with resume

Posted: Mon Jul 29, 2002 5:37 pm
by alego
I've written a script to handle downloading of files over HTTP (as attachments). The idea being that I have download URLs on my site, but rather than them linking directly to the actual files, they all reference my script and pass in a file identifier. I am doing this in order to have auditing and authentication incorporated into the download process.

Everything works fine. The problem is that when using my script, it screws up the web servers ability to handle partial downloads. Consequently download managers like GetRight can't resume broken downloads. Linking directly to the files, without my script in the way, downloads can be resumed as normal.

The script sends these headers:

header("Content-Type: application/octet-stream");
header("Content-Length: " . (string)$aTrack->size);
header("Content-Disposition: attachment; filename=\"" . $aTrack->getOrigFileName() . "\"");

Then dumps the content of the file into the HTTP stream.

Does anyone have any ideas how I can pursuade the web server (IIS5.0) to allow range based HTTP requests, whilst still using my script?

Thanx.

Posted: Wed Jul 31, 2002 2:00 am
by gnu2php
I'm new to this, but I think you need to send additional HTTP headers to the browser. I confess that I don't know what those headers are, but maybe you can find them out by seeing what exact headers are sent when you download a "resume-capable" file.

A program called Naviscope can track HTTP headers: http://www.naviscope.com/nscope.exe

Or you can do it from Telnet (scroll half-way down the following article):
http://hotwired.lycos.com/webmonkey/99/ ... tw=backend

Also, you could check out Quick reference to HTTP headers.