comparison src/http/ngx_http_script.c @ 366:babd3d9efb62 NGINX_0_6_27

nginx 0.6.27 *) Change: now by default the rtsig method is not built on Linux 2.6.18+. *) Change: now a request method is not changed while redirection to a named location via an "error_page" directive. *) Feature: the "resolver" and "resolver_timeout" directives in SMTP proxy. *) Feature: the "post_action" directive supports named locations. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: browsers did not repeat SSL handshake if there is no valid client certificate in first handshake. Thanks to Alexander V. Inyukhin. *) Bugfix: if response code 495-497 was redirected via an "error_page" directive without code change, then nginx tried to allocate too many memory. *) Bugfix: memory leak in long-lived non buffered connections. *) Bugfix: memory leak in resolver. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: in the $proxy_host and $proxy_port variables caching. Thanks to Sergey Bochenkov. *) Bugfix: a "proxy_pass" directive with variables used incorrectly the same port as in another "proxy_pass" directive with the same host name and without variables. Thanks to Sergey Bochenkov. *) Bugfix: an alert "sendmsg() failed (9: Bad file descriptor)" on some 64-bit platforms while reconfiguration. *) Bugfix: a segmentation fault occurred in worker process, if empty stub block was used second time in SSI. *) Bugfix: in copying URI part contained escaped symbols into arguments.
author Igor Sysoev <http://sysoev.ru>
date Wed, 12 Mar 2008 00:00:00 +0300
parents 54fad6c4b555
children 984bb0b1399b
comparison
equal deleted inserted replaced
365:9b0140fa1132 366:babd3d9efb62
219 219
220 if (sc->source->data[i] == '?' && sc->compile_args) { 220 if (sc->source->data[i] == '?' && sc->compile_args) {
221 sc->args = 1; 221 sc->args = 1;
222 sc->compile_args = 0; 222 sc->compile_args = 0;
223 223
224 code = ngx_http_script_add_code(*sc->lengths, sizeof(uintptr_t),
225 NULL);
226 if (code == NULL) {
227 return NGX_ERROR;
228 }
229
230 *code = (uintptr_t) ngx_http_script_mark_args_code;
231
224 code = ngx_http_script_add_code(*sc->values, sizeof(uintptr_t), 232 code = ngx_http_script_add_code(*sc->values, sizeof(uintptr_t),
225 &sc->main); 233 &sc->main);
226 if (code == NULL) { 234 if (code == NULL) {
227 return NGX_ERROR; 235 return NGX_ERROR;
228 } 236 }
502 code = (ngx_http_script_copy_capture_code_t *) e->ip; 510 code = (ngx_http_script_copy_capture_code_t *) e->ip;
503 511
504 e->ip += sizeof(ngx_http_script_copy_capture_code_t); 512 e->ip += sizeof(ngx_http_script_copy_capture_code_t);
505 513
506 if (code->n < e->ncaptures) { 514 if (code->n < e->ncaptures) {
507 if ((e->args || e->quote) 515 if ((e->is_args || e->quote)
508 && (e->request->quoted_uri || e->request->plus_in_uri)) 516 && (e->request->quoted_uri || e->request->plus_in_uri))
509 { 517 {
510 return e->captures[code->n + 1] - e->captures[code->n] 518 return e->captures[code->n + 1] - e->captures[code->n]
511 + 2 * ngx_escape_uri(NULL, 519 + 2 * ngx_escape_uri(NULL,
512 &e->line.data[e->captures[code->n]], 520 &e->line.data[e->captures[code->n]],
529 code = (ngx_http_script_copy_capture_code_t *) e->ip; 537 code = (ngx_http_script_copy_capture_code_t *) e->ip;
530 538
531 e->ip += sizeof(ngx_http_script_copy_capture_code_t); 539 e->ip += sizeof(ngx_http_script_copy_capture_code_t);
532 540
533 if (code->n < e->ncaptures) { 541 if (code->n < e->ncaptures) {
534 if ((e->args || e->quote) 542 if ((e->is_args || e->quote)
535 && (e->request->quoted_uri || e->request->plus_in_uri)) 543 && (e->request->quoted_uri || e->request->plus_in_uri))
536 { 544 {
537 e->pos = (u_char *) ngx_escape_uri(e->pos, 545 e->pos = (u_char *) ngx_escape_uri(e->pos,
538 &e->line.data[e->captures[code->n]], 546 &e->line.data[e->captures[code->n]],
539 e->captures[code->n + 1] - e->captures[code->n], 547 e->captures[code->n + 1] - e->captures[code->n],
548 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, 556 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
549 "http script capture: \"%V\"", &e->buf); 557 "http script capture: \"%V\"", &e->buf);
550 } 558 }
551 559
552 560
561 size_t
562 ngx_http_script_mark_args_code(ngx_http_script_engine_t *e)
563 {
564 e->is_args = 1;
565 e->ip += sizeof(uintptr_t);
566
567 return 1;
568 }
569
570
553 void 571 void
554 ngx_http_script_start_args_code(ngx_http_script_engine_t *e) 572 ngx_http_script_start_args_code(ngx_http_script_engine_t *e)
555 { 573 {
556 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, 574 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
557 "http script args"); 575 "http script args");
698 le.request = r; 716 le.request = r;
699 le.captures = e->captures; 717 le.captures = e->captures;
700 le.ncaptures = e->ncaptures; 718 le.ncaptures = e->ncaptures;
701 le.quote = code->redirect; 719 le.quote = code->redirect;
702 720
703 len = 1; /* reserve 1 byte for possible "?" */ 721 len = 0;
704 722
705 while (*(uintptr_t *) le.ip) { 723 while (*(uintptr_t *) le.ip) {
706 lcode = *(ngx_http_script_len_code_pt *) le.ip; 724 lcode = *(ngx_http_script_len_code_pt *) le.ip;
707 len += lcode(&le); 725 len += lcode(&le);
708 } 726 }
709 727
710 e->buf.len = len; 728 e->buf.len = len;
729 e->is_args = le.is_args;
711 } 730 }
712 731
713 if (code->add_args && r->args.len) { 732 if (code->add_args && r->args.len) {
714 e->buf.len += r->args.len + 1; 733 e->buf.len += r->args.len + 1;
715 } 734 }