| From | Sent On | Attachments |
|---|---|---|
| David Yu | Jul 21, 2011 7:17 am | |
| Igor Sysoev | Jul 21, 2011 7:43 am | |
| David Yu | Jul 21, 2011 7:53 am | |
| David Yu | Jul 21, 2011 7:55 am | |
| Igor Sysoev | Jul 21, 2011 11:09 am | |
| David Yu | Jul 21, 2011 6:23 pm |
| Subject: | Same regex caching | |
|---|---|---|
| From: | David Yu (davi...@gmail.com) | |
| Date: | Jul 21, 2011 7:17:43 am | |
| List: | ru.sysoev.nginx | |
Hi,
I wanted to ask if the same regex used in multiple conditions is the same cached-compiled version? Eg I need to validate the all the (sub)request params before sending it upstream:
location /foo {
if ($time !~ /(\d\d):(\d\d):(\d\d)/) { return 400; } if ($arg_time !~ /(\d\d):(\d\d):(\d\d)/) { return 400; }
}
#note that in the real app, I'll have lots of repeated regex for email, phone, used in every if directive
location /bar {
if ($arg_time !~ /(\d\d):(\d\d):(\d\d)/) { return 400; } set_form_input $form_time time_finished; if ($form_time !~ /(\d\d):(\d\d):(\d\d)/) { return 400; }
}
What I'm trying to do is send the params to redis with its lua scripting engine handling the *pre-validated* request. Redis is single-process while nginx can have multiple workers ... so its only fitting to let nginx do validation for redis :-)
Cheers
-- When the cat is away, the mouse is alone. - David Yu
_______________________________________________ nginx mailing list ngi...@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx





