0

I'd like to setup a web-server (or other kind of server?) that will allow clients to download a file using http. However, I want to start serving the file before it has been fully written to disk.

Ideally, the server would send as much data as is available, and then slow down till more data is ready.

As far as the browser is concerned, this should look like a "regular" download, however the content-length will not be known at start. Is this ok?

Any recommendations how to setup such a server?

1 Answer 1

1

As far as the HTTP Client is concerned it's perfectly fine to not send a Content-length header (though the client won't be able to display a progress bar, just "I've downloaded X Kb, and I have no idea how much is left".

The server side is more difficult. The only way I can think of doing this would be to attach to the file as a stream (using a programming language - PHP, a CGI script, etc.) and return the contents. The problem comes with determining when the file is "done" being written to disk (so you can tell the HTTP client it doesn't have to wait anymore).
There are ways around this, but that programming is left as an exercise for the reader :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .