HTTP download with resume

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alego
Forum Newbie
Posts: 2
Joined: Mon Jul 29, 2002 5:37 pm

HTTP download with resume

Post 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.
gnu2php
Forum Contributor
Posts: 122
Joined: Thu Jul 11, 2002 2:53 am

Post 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.
Post Reply