Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 323:ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 21 Apr 2004 18:54:33 +0000 |
parents | 56496082668b |
children | 8733703a37f3 |
comparison
equal
deleted
inserted
replaced
322:ab2f8c9a2a45 | 323:ba876b26b76d |
---|---|
1447 | 1447 |
1448 static char *ngx_set_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 1448 static char *ngx_set_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1449 { | 1449 { |
1450 ngx_http_core_loc_conf_t *lcf = conf; | 1450 ngx_http_core_loc_conf_t *lcf = conf; |
1451 | 1451 |
1452 ngx_uint_t i; | 1452 int overwrite; |
1453 ngx_uint_t i, n; | |
1453 ngx_str_t *value; | 1454 ngx_str_t *value; |
1454 ngx_http_err_page_t *err; | 1455 ngx_http_err_page_t *err; |
1455 | 1456 |
1456 if (lcf->error_pages == NULL) { | 1457 if (lcf->error_pages == NULL) { |
1457 lcf->error_pages = ngx_create_array(cf->pool, 5, | 1458 lcf->error_pages = ngx_create_array(cf->pool, 5, |
1461 } | 1462 } |
1462 } | 1463 } |
1463 | 1464 |
1464 value = cf->args->elts; | 1465 value = cf->args->elts; |
1465 | 1466 |
1466 for (i = 1; i < cf->args->nelts - 1; i++) { | 1467 i = cf->args->nelts - 2; |
1467 ngx_test_null(err, ngx_push_array(lcf->error_pages), NGX_CONF_ERROR); | 1468 |
1469 if (value[i].data[0] == '=') { | |
1470 if (i == 1) { | |
1471 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1472 "invalid value \"%s\"", value[i].data); | |
1473 return NGX_CONF_ERROR; | |
1474 } | |
1475 | |
1476 overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1); | |
1477 | |
1478 if (overwrite == NGX_ERROR) { | |
1479 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1480 "invalid value \"%s\"", value[i].data); | |
1481 return NGX_CONF_ERROR; | |
1482 } | |
1483 | |
1484 n = 2; | |
1485 | |
1486 } else { | |
1487 overwrite = 0; | |
1488 n = 1; | |
1489 } | |
1490 | |
1491 for (i = 1; i < cf->args->nelts - n; i++) { | |
1492 if (!(err = ngx_push_array(lcf->error_pages))) { | |
1493 return NGX_CONF_ERROR; | |
1494 } | |
1495 | |
1468 err->code = ngx_atoi(value[i].data, value[i].len); | 1496 err->code = ngx_atoi(value[i].data, value[i].len); |
1469 if (err->code == NGX_ERROR) { | 1497 if (err->code == NGX_ERROR) { |
1470 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 1498 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1471 "invalid value \"%s\"", value[i].data); | 1499 "invalid value \"%s\"", value[i].data); |
1472 return NGX_CONF_ERROR; | 1500 return NGX_CONF_ERROR; |
1477 "value \"%s\" must be between 400 and 599", | 1505 "value \"%s\" must be between 400 and 599", |
1478 value[i].data); | 1506 value[i].data); |
1479 return NGX_CONF_ERROR; | 1507 return NGX_CONF_ERROR; |
1480 } | 1508 } |
1481 | 1509 |
1510 err->overwrite = overwrite; | |
1482 err->uri = value[cf->args->nelts - 1]; | 1511 err->uri = value[cf->args->nelts - 1]; |
1483 } | 1512 } |
1484 | 1513 |
1485 return NGX_CONF_OK; | 1514 return NGX_CONF_OK; |
1486 } | 1515 } |