comparison src/http/ngx_http_core_module.c @ 1982:dd388c80f5a2

args support in static error_page
author Igor Sysoev <igor@sysoev.ru>
date Tue, 29 Apr 2008 10:06:43 +0000
parents fe30478341f0
children b52cb9bf2064
comparison
equal deleted inserted replaced
1981:65581f79e81b 1982:dd388c80f5a2
3469 static char * 3469 static char *
3470 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 3470 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
3471 { 3471 {
3472 ngx_http_core_loc_conf_t *lcf = conf; 3472 ngx_http_core_loc_conf_t *lcf = conf;
3473 3473
3474 u_char *args;
3474 ngx_int_t overwrite; 3475 ngx_int_t overwrite;
3475 ngx_str_t *value, uri; 3476 ngx_str_t *value, uri;
3476 ngx_uint_t i, n, nvar; 3477 ngx_uint_t i, n, nvar;
3477 ngx_array_t *uri_lengths, *uri_values; 3478 ngx_array_t *uri_lengths, *uri_values;
3478 ngx_http_err_page_t *err; 3479 ngx_http_err_page_t *err;
3537 if (ngx_http_script_compile(&sc) != NGX_OK) { 3538 if (ngx_http_script_compile(&sc) != NGX_OK) {
3538 return NGX_CONF_ERROR; 3539 return NGX_CONF_ERROR;
3539 } 3540 }
3540 } 3541 }
3541 3542
3543 args = (u_char *) ngx_strchr(uri.data, '?');
3544
3542 for (i = 1; i < cf->args->nelts - n; i++) { 3545 for (i = 1; i < cf->args->nelts - n; i++) {
3543 err = ngx_array_push(lcf->error_pages); 3546 err = ngx_array_push(lcf->error_pages);
3544 if (err == NULL) { 3547 if (err == NULL) {
3545 return NGX_CONF_ERROR; 3548 return NGX_CONF_ERROR;
3546 } 3549 }
3575 err->overwrite = err->status; 3578 err->overwrite = err->status;
3576 break; 3579 break;
3577 } 3580 }
3578 } 3581 }
3579 3582
3580 err->uri = uri; 3583 if (args) {
3584 err->uri.len = args - uri.data;
3585 err->uri.data = uri.data;
3586 args++;
3587 err->args.len = (uri.data + uri.len) - args;
3588 err->args.data = args;
3589
3590 } else {
3591 err->uri = uri;
3592 err->args.len = 0;
3593 err->args.data = NULL;
3594 }
3595
3581 err->uri_lengths = uri_lengths; 3596 err->uri_lengths = uri_lengths;
3582 err->uri_values = uri_values; 3597 err->uri_values = uri_values;
3583 } 3598 }
3584 3599
3585 return NGX_CONF_OK; 3600 return NGX_CONF_OK;