comparison src/http/ngx_http_script.c @ 2397:da6f70bb41f0

fix r2394
author Igor Sysoev <igor@sysoev.ru>
date Thu, 11 Dec 2008 06:38:14 +0000
parents fbff569bf456
children d3357bf23a5e
comparison
equal deleted inserted replaced
2396:848d944eae81 2397:da6f70bb41f0
618 } 618 }
619 619
620 rc = ngx_regex_exec(code->regex, &e->line, e->captures, code->ncaptures); 620 rc = ngx_regex_exec(code->regex, &e->line, e->captures, code->ncaptures);
621 621
622 if (rc == NGX_REGEX_NO_MATCHED) { 622 if (rc == NGX_REGEX_NO_MATCHED) {
623 if (e->log) { 623 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
624 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 624 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
625 "\"%V\" does not match \"%V\"", 625 "\"%V\" does not match \"%V\"",
626 &code->name, &e->line); 626 &code->name, &e->line);
627 } 627 }
628 628
656 e->ip = ngx_http_script_exit; 656 e->ip = ngx_http_script_exit;
657 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; 657 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
658 return; 658 return;
659 } 659 }
660 660
661 if (e->log) { 661 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
662 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 662 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
663 "\"%V\" matches \"%V\"", &code->name, &e->line); 663 "\"%V\" matches \"%V\"", &code->name, &e->line);
664 } 664 }
665 665
666 e->ncaptures = code->ncaptures; 666 e->ncaptures = code->ncaptures;
792 e->pos = ngx_copy(e->pos, r->args.data, r->args.len); 792 e->pos = ngx_copy(e->pos, r->args.data, r->args.len);
793 } 793 }
794 794
795 e->buf.len = e->pos - e->buf.data; 795 e->buf.len = e->pos - e->buf.data;
796 796
797 #if (NGX_DEBUG) 797 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
798 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
799 "rewritten redirect: \"%V\"", &e->buf);
800 #else
801 if (e->log) {
802 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 798 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
803 "rewritten redirect: \"%V\"", &e->buf); 799 "rewritten redirect: \"%V\"", &e->buf);
804 } 800 }
805 #endif
806 801
807 r->headers_out.location = ngx_list_push(&r->headers_out.headers); 802 r->headers_out.location = ngx_list_push(&r->headers_out.headers);
808 if (r->headers_out.location == NULL) { 803 if (r->headers_out.location == NULL) {
809 e->ip = ngx_http_script_exit; 804 e->ip = ngx_http_script_exit;
810 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; 805 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR;
839 if (!code->add_args) { 834 if (!code->add_args) {
840 r->args.len = 0; 835 r->args.len = 0;
841 } 836 }
842 } 837 }
843 838
844 #if (NGX_DEBUG) 839 if (e->log || (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP)) {
845 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
846 "rewritten data: \"%V\", args: \"%V\"", &e->buf, &r->args);
847 #else
848 if (e->log) {
849 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0, 840 ngx_log_error(NGX_LOG_NOTICE, r->connection->log, 0,
850 "rewritten data: \"%V\", args: \"%V\"", 841 "rewritten data: \"%V\", args: \"%V\"",
851 &e->buf, &r->args); 842 &e->buf, &r->args);
852 } 843 }
853 #endif
854 844
855 if (code->uri) { 845 if (code->uri) {
856 r->uri = e->buf; 846 r->uri = e->buf;
857 847
858 if (r->uri.len == 0) { 848 if (r->uri.len == 0) {