Hello,
more a recipe question. I'm working on a proxy that will download a
file for a client. The thing that doesn't yield problems is:
Alice (Client)
Bob (Client)
Sam (Server)
1 Alice asks Sam for foobar.iso
2 Sam can't find foobar.iso in cachedir
3 Sam requests foobar.iso from the uplink
4
You use a temp directory to store the file while downloading, then
move it to the cache so the addition of the complete file is atomic.
The file name of the temp file should be checked to validate that you
don't overwrite another process' download.
Currently downloading urls should be registered
But I can't figure out how I would solve the following:
1 Alice asks Sam for foobar.iso
2 Sam can't find foobar.iso in cachedir
3 Sam requests foobar.iso from uplink
4 Sam saves and forwards to Alice
5 At about 30 % of the download Bob asks Sam for foobar.iso
6 How do I serve Bob now?
Let