comparison src/http/modules/ngx_http_referer_module.c @ 546:e19e5f542878 NGINX_0_8_25

nginx 0.8.25 *) Change: now no message is written in an error log if a variable is not found by $r->variable() method. *) Feature: the ngx_http_degradation_module. *) Feature: regular expression named captures. *) Feature: now URI part is not required a "proxy_pass" directive if variables are used. *) Feature: now the "msie_padding" directive works for Chrome too. *) Bugfix: a segmentation fault occurred in a worker process on low memory condition; the bug had appeared in 0.8.18. *) Bugfix: nginx sent gzipped responses to clients those do not support gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared in 0.8.16.
author Igor Sysoev <http://sysoev.ru>
date Mon, 16 Nov 2009 00:00:00 +0300
parents 0161f3197817
children da3c99095432
comparison
equal deleted inserted replaced
545:91e4b06e1a01 546:e19e5f542878
410 410
411 #if (NGX_PCRE) 411 #if (NGX_PCRE)
412 if (sn[n].regex) { 412 if (sn[n].regex) {
413 413
414 if (ngx_http_add_regex_referer(cf, rlcf, &sn[n].name, 414 if (ngx_http_add_regex_referer(cf, rlcf, &sn[n].name,
415 sn[n].regex) 415 sn[n].regex->regex)
416 != NGX_OK) 416 != NGX_OK)
417 { 417 {
418 return NGX_CONF_ERROR; 418 return NGX_CONF_ERROR;
419 } 419 }
420 420
500 static char * 500 static char *
501 ngx_http_add_regex_referer(ngx_conf_t *cf, ngx_http_referer_conf_t *rlcf, 501 ngx_http_add_regex_referer(ngx_conf_t *cf, ngx_http_referer_conf_t *rlcf,
502 ngx_str_t *name, ngx_regex_t *regex) 502 ngx_str_t *name, ngx_regex_t *regex)
503 { 503 {
504 #if (NGX_PCRE) 504 #if (NGX_PCRE)
505 ngx_str_t err; 505 ngx_regex_elt_t *re;
506 ngx_regex_elt_t *re; 506 ngx_regex_compile_t rc;
507 u_char errstr[NGX_MAX_CONF_ERRSTR]; 507 u_char errstr[NGX_MAX_CONF_ERRSTR];
508 508
509 if (name->len == 1) { 509 if (name->len == 1) {
510 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty regex in \"%V\"", name); 510 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "empty regex in \"%V\"", name);
511 return NGX_CONF_ERROR; 511 return NGX_CONF_ERROR;
512 } 512 }
528 re->name = name->data; 528 re->name = name->data;
529 529
530 return NGX_CONF_OK; 530 return NGX_CONF_OK;
531 } 531 }
532 532
533 err.len = NGX_MAX_CONF_ERRSTR;
534 err.data = errstr;
535
536 name->len--; 533 name->len--;
537 name->data++; 534 name->data++;
538 535
539 re->regex = ngx_regex_compile(name, NGX_REGEX_CASELESS, cf->pool, &err); 536 ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
540 537
541 if (re->regex == NULL) { 538 rc.pattern = *name;
542 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); 539 rc.pool = cf->pool;
540 rc.options = NGX_REGEX_CASELESS;
541 rc.err.len = NGX_MAX_CONF_ERRSTR;
542 rc.err.data = errstr;
543
544 if (ngx_regex_compile(&rc) != NGX_OK) {
545 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err);
543 return NGX_CONF_ERROR; 546 return NGX_CONF_ERROR;
544 } 547 }
545 548
549 re->regex = rc.regex;
546 re->name = name->data; 550 re->name = name->data;
547 551
548 return NGX_CONF_OK; 552 return NGX_CONF_OK;
549 553
550 #else 554 #else