Project

General

Profile

[Solved] URL of only one use

Added by vigoncas almost 8 years ago

Hi,

We are interested in antihotlink systems. We are using secdownload to protect videos but we are thinking about to implement a system where url only can be used a predefined number of times. The system is based in this philosophy http://www.ardamis.com/2008/06/11/protecting-a-download-using-a-unique-url/ but the best way is to be implemented as a lighttpd module.

We have a lot of questions about:

Exists any module with a similar behavior?
Is it possible to store the times that an url has been used in a lighttpd module?
How affects that to module performance?

Thanks


Replies (6)

RE: URL of only one use - Added by Nico_br almost 8 years ago

This forum seems quite dead to me so I'll try to answer with what I've learnt over the last couple of weeks:

the best way is to be implemented as a lighttpd module.

How did you reach that conclusion? Are you talking about developing the module yourself or trying to find and already developed module?

Is it possible to store the times that an url has been used in a lighttpd module?

It's easy in a module, you don't even need a DB for that, just access the request uri and store the number of times you saw that string in a map.

How affects that to module performance?

Shouldn't be too much but the best way to know is to perform a benchmark.

Regards
Nicolás Brailovsky - http://nicolasb.com.ar

RE: URL of only one use - Added by vigoncas almost 8 years ago

Is it possible to store the times that an url has been used in a lighttpd module?

It's easy in a module, you don't even need a DB for that, just access the request uri and store the number of times you saw that string in a map.

In that case, we must control the map size and for each request we must remove the obsolete URIs from map. When you say 'map' are you talking about a C map structure, true?

Thanks

RE: URL of only one use - Added by Nico_br almost 8 years ago

That's what I was thinking (map<string, unsigned>, a string representing the url and an int representing the number of visits) but it depends on the implementation and the use you want to give it.

Regards
Nicolás Brailovsky - http://nicolasb.com.ar

RE: URL of only one use - Added by Olaf-van-der-Spek almost 8 years ago

Forget modules, just write a script.

Using in-memory storage is probably a bad idea, considering restarts...

RE: URL of only one use - Added by vigoncas almost 8 years ago

Write an script?

What kind of script are you purposing? We are using secdownload module to serve and protect videos. How can I join two ideas in one?

I'm thinking to solve problem with database access instead memory. Is it posible to access DB from modules?

Thanks

RE: [Solved] URL of only one use - Added by gstrauss 7 months ago

If you are using mod_secdownload, the quickest answer to your question (on a many-years-old post) is to simply log in mod_accesslog Docs_ModAccessLog the actual file size as well as the response body size and to delete the file from your document root once the desired number of successful downloads have occurred. To avoid someone trying to be clever doing multiple partial downloads, you might choose to disable Range requests.

    (1-6/6)