[dancer-users] Before Hook hit multiple times.

Ovid curtis_ovid_poe at yahoo.com
Thu Jan 3 14:43:29 GMT 2013


> From: Alexis Sukrieh <sukria at sukria.net>
>To: brian at massassi.com; Perl Dancer users mailing list <dancer-users at dancer.pm> 
>Sent: Thursday, 3 January 2013, 11:46
>Subject: Re: [dancer-users] Before Hook hit multiple times.
> 


>Dancer is a DSL to write a web application. Its purpose is to provide a clean and intuitive syntax for describing how to handle a request and which response to produce. This is based of course on the HTTP protocol, and Dancer relies entirely on that.
>
>That means that everything in Dancer's point of view is related to an incoming _request_. In the HTTP meaning. If Chrome hits favicon.ico whenever you hit the app, you'll send 2 requests every time you hit the browser's reload button. You are sending 2 requests, period.
>
>Dancer sees 2 requests, and acts accordingly.
>
>Implementing a workaround to simulate the concept of "human requests" versus real "HTTP requests" sounds crazy to me and error-prone.
>
>What makes Dancer so appealing is its thin layer over the HTTP stack, this kind of change or enhancement is dangerous, I think.


I agree with this. The app doesn't know that it's a browser making an extra request to favicon.ico instead of a human doing so. In being a veteran of the "robot versus human" wars, I can tell you that trying to make the distinction is a nightmare and wastes time trying to fight a losing war when, instead, you can be building value.

If you really think something is wrong, dump the request object in the before hook so you can see exactly what is happening in each request. That will clear this up pretty fast, I suspect.

On the other hand, if you can demonstrate a foolproof method of determining which requests are of human origin and which are not, I suspect the Dancer team would be happy to incorporate this right after you pick up your Turing Award :)

Cheers,
Ovid
--
Twitter - http://twitter.com/OvidPerl/
Buy my book - http://bit.ly/beginning_perl
Buy my other book - http://www.oreilly.com/catalog/perlhks/
Live and work overseas - http://www.overseas-exile.com/



More information about the dancer-users mailing list