aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_script.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-11-16 12:19:02 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-11-16 12:19:02 +0000
commitc05f20ec2eace8239c53f680294c9a2154b39e7d (patch)
treefba2dd2e0c4f7a36f4b396b759645ced61c3c709 /src/http/ngx_http_script.c
parentc0ae4716ece5e48c4e82863959d3ae9ff6693e65 (diff)
downloadnginx-c05f20ec2eace8239c53f680294c9a2154b39e7d.tar.gz
nginx-c05f20ec2eace8239c53f680294c9a2154b39e7d.zip
regex named captures
Diffstat (limited to 'src/http/ngx_http_script.c')
-rw-r--r--src/http/ngx_http_script.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
index f79345715..b809e2b98 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -251,8 +251,6 @@ ngx_http_script_compile(ngx_http_script_compile_t *sc)
{
ngx_uint_t n;
- /* NGX_HTTP_MAX_CAPTURES is 9 */
-
if (sc->source->data[i] >= '1' && sc->source->data[i] <= '9') {
n = sc->source->data[i] - '0';
@@ -828,20 +826,9 @@ ngx_http_script_regex_start_code(ngx_http_script_engine_t *e)
e->line.data = e->sp->data;
}
- if (code->ncaptures && r->captures == NULL) {
-
- r->captures = ngx_palloc(r->pool,
- (NGX_HTTP_MAX_CAPTURES + 1) * 3 * sizeof(int));
- if (r->captures == NULL) {
- e->ip = ngx_http_script_exit;
- e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
- return;
- }
- }
-
- rc = ngx_regex_exec(code->regex, &e->line, r->captures, code->ncaptures);
+ rc = ngx_http_regex_exec(r, code->regex, &e->line);
- if (rc == NGX_REGEX_NO_MATCHED) {
+ if (rc == NGX_DECLINED) {
if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
"\"%V\" does not match \"%V\"",
@@ -870,11 +857,7 @@ ngx_http_script_regex_start_code(ngx_http_script_engine_t *e)
return;
}
- if (rc < 0) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"",
- rc, &e->line, &code->name);
-
+ if (rc == NGX_ERROR) {
e->ip = ngx_http_script_exit;
e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
return;
@@ -885,9 +868,6 @@ ngx_http_script_regex_start_code(ngx_http_script_engine_t *e)
"\"%V\" matches \"%V\"", &code->name, &e->line);
}
- r->ncaptures = code->ncaptures;
- r->captures_data = e->line.data;
-
if (code->test) {
if (code->negative_test) {
e->sp->len = 0;