regex captures

Hassan Syed h.a.syed at gmail.com
Thu Aug 12 17:39:24 MSD 2010


Hello,

I am working with the 0.7* code base, and I need to extract a sub-string
from a location URL regex capture during the access phase. I'm working on an
authentication scheme that matches a capture from a location with the
payload of an encrypted cookie (similar to kerberos tickets). I could only
find code that did this in the scripting engine codes, and I do not at this
point require this level of dynamism at request-time; therefore, I would
prefer not to instantiate a scripting engine within my module.

My question: Since "r->ncaptures" and "r->captures" represent the ovecsize
and ovector respectively, Would it be advisable to use the extraction helper
functions from the PCRE api ?

PCRE api documentation link:
http://regexkit.sourceforge.net/Documentation/pcre/pcreapi.html#SEC15

Thanks

Hassan

P.S., I would advise that at certain point in the code base (for example
struct ngx_http_request_s { ..) the parallels between "r->ncaptures" and
"r->captures" and the PCRE counterparts be made explicit with a comment --
Since I did not have any PCRE experience before Nginx, I assumed the ovector
was a concept native to the Nginx code-base.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20100812/9486305e/attachment.html>


More information about the nginx-devel mailing list