Web Hosting Talk







View Full Version : prevent visitors from downloading more than one file at same time ?


allomani
04-06-2009, 11:54 PM
Hello,

how can i prevent visitors from downloading more than one file at same time ?

is there any server configuration can do it or i have to do it by programming language ? and if so is there any ideas or open sources for this issue ?


hope you can help me

Regards,
Allomani

squirrelhost
04-06-2009, 11:59 PM
you can limit connections to one per IP address using pf firewall.

maybe other firewalls offer similar. if you're using a firewall, check the docs is best.

squirrelhost
04-07-2009, 12:26 AM
if you're using a firewall solution, probably best to lower the maximum segment life (MSL) to something more reasonable than the default for your OS. (always a good idea to lower it anyway)

allomani
04-07-2009, 06:53 AM
is it suppoted for specific files type ? let's say that i want to limit connections for .mp3 files only ,, and about firewall is CFS support this thing , if so how can i configure it ?

squirrelhost
04-07-2009, 07:12 AM
if you expect people to download using a browser, don't forget the http 1.1 spec recommends no more than 2 downloads in parallel (per hostname or virtualhost), and as far as I know most browsers do respect this. if connection is downgraded to http 1.0, then 4 are allowed. hardly overwhelming.
but if you enforce this additionally with a firewall, it'll stop too many connections from anyone running fetch, or wget or using some download accelerator tool. no idea about CFS, never use Lunatix for anything.

lebnene
04-08-2009, 08:02 AM
You can write a php script to accomplish this - with either cookies or small database to keep track of who is downloading what and how many times... not hard at all.

allomani
04-14-2009, 01:37 PM
hello,

squirrelhost can you tell me how can i do it by http 1.1 ,

lebnene , actually php file is not on the same of mp3 files so i cant use php.

cselzer
04-14-2009, 02:15 PM
hello,

squirrelhost can you tell me how can i do it by http 1.1 ,

lebnene , actually php file is not on the same of mp3 files so i cant use php.

Lol, not what he said.

You would use a php script, like like fileplanet, or any other file site for the downloads, feed the download through a unique url (whether it being ?id=027087sgds87g or a mod_rewrite url, it would work just fine with no issues on the server, and you could even limit the bandwidth they use too. Quite simple.