Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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 :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.