Mercurial > hg > nginx-vendor-0-6
comparison src/http/modules/ngx_http_fastcgi_module.c @ 122:d25a1d6034f1 NGINX_0_3_8
nginx 0.3.8
*) Security: nginx now checks URI got from a backend in
"X-Accel-Redirect" header line or in SSI file for the "/../" paths
and zeroes.
*) Change: nginx now does not treat the empty user name in the
"Authorization" header line as valid one.
*) Feature: the "ssl_session_timeout" directives of the
ngx_http_ssl_module and ngx_imap_ssl_module.
*) Feature: the "auth_http_header" directive of the
ngx_imap_auth_http_module.
*) Feature: the "add_header" directive.
*) Feature: the ngx_http_realip_module.
*) Feature: the new variables to use in the "log_format" directive:
$bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri,
$request_time, $request_length, $upstream_status,
$upstream_response_time, $gzip_ratio, $uid_got, $uid_set,
$connection, $pipe, and $msec. The parameters in the "%name" form
will be canceled soon.
*) Change: now the false variable values in the "if" directive are the
empty string "" and string starting with "0".
*) Bugfix: while using proxied or FastCGI-server nginx may leave
connections and temporary files with client requests in open state.
*) Bugfix: the worker processes did not flush the buffered logs on
graceful exit.
*) Bugfix: if the request URI was changes by the "rewrite" directive
and the request was proxied in location given by regular expression,
then the incorrect request was transferred to backend; bug appeared
in 0.2.6.
*) Bugfix: the "expires" directive did not remove the previous
"Expires" header.
*) Bugfix: nginx may stop to accept requests if the "rtsig" method and
several worker processes were used.
*) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in
SSI commands.
*) Bugfix: if the response was ended just after the SSI command and
gzipping was used, then the response did not transferred complete or
did not transferred at all.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 09 Nov 2005 00:00:00 +0300 |
parents | dad2fe8ecf08 |
children | df17fbafec8f |
comparison
equal
deleted
inserted
replaced
121:737953b238a4 | 122:d25a1d6034f1 |
---|---|
15 | 15 |
16 ngx_peers_t *peers; | 16 ngx_peers_t *peers; |
17 | 17 |
18 ngx_str_t index; | 18 ngx_str_t index; |
19 | 19 |
20 ngx_array_t *flushes; | |
20 ngx_array_t *params_len; | 21 ngx_array_t *params_len; |
21 ngx_array_t *params; | 22 ngx_array_t *params; |
22 ngx_array_t *params_source; | 23 ngx_array_t *params_source; |
23 } ngx_http_fastcgi_loc_conf_t; | 24 } ngx_http_fastcgi_loc_conf_t; |
24 | 25 |
109 | 110 |
110 static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf); | 111 static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf); |
111 static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf); | 112 static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf); |
112 static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, | 113 static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, |
113 void *parent, void *child); | 114 void *parent, void *child); |
114 static ngx_http_variable_value_t * | 115 static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, |
115 ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, | 116 ngx_http_variable_value_t *v, uintptr_t data); |
116 uintptr_t data); | |
117 | 117 |
118 static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, | 118 static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
119 void *conf); | 119 void *conf); |
120 static char *ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, | 120 static char *ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, |
121 void *data); | 121 void *data); |
408 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); | 408 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); |
409 | 409 |
410 if (flcf->params_len) { | 410 if (flcf->params_len) { |
411 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); | 411 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
412 | 412 |
413 ngx_http_script_flush_no_cachable_variables(r, flcf->flushes); | |
414 le.flushed = 1; | |
415 | |
413 le.ip = flcf->params_len->elts; | 416 le.ip = flcf->params_len->elts; |
414 le.request = r; | 417 le.request = r; |
415 | 418 |
416 while (*(uintptr_t *) le.ip) { | 419 while (*(uintptr_t *) le.ip) { |
417 | 420 |
505 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); | 508 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); |
506 | 509 |
507 e.ip = flcf->params->elts; | 510 e.ip = flcf->params->elts; |
508 e.pos = b->last; | 511 e.pos = b->last; |
509 e.request = r; | 512 e.request = r; |
513 e.flushed = 1; | |
510 | 514 |
511 le.ip = flcf->params_len->elts; | 515 le.ip = flcf->params_len->elts; |
512 | 516 |
513 while (*(uintptr_t *) le.ip) { | 517 while (*(uintptr_t *) le.ip) { |
514 | 518 |
595 } | 599 } |
596 | 600 |
597 *b->last++ = ch; | 601 *b->last++ = ch; |
598 } | 602 } |
599 | 603 |
600 b->last = ngx_cpymem(b->last, header[i].value.data, | 604 b->last = ngx_copy(b->last, header[i].value.data, |
601 header[i].value.len); | 605 header[i].value.len); |
602 } | 606 } |
603 } | 607 } |
604 | 608 |
605 | 609 |
606 if (padding) { | 610 if (padding) { |
1632 if (conf->peers == NULL) { | 1636 if (conf->peers == NULL) { |
1633 conf->peers = prev->peers; | 1637 conf->peers = prev->peers; |
1634 } | 1638 } |
1635 | 1639 |
1636 if (conf->params_source == NULL) { | 1640 if (conf->params_source == NULL) { |
1637 conf->params_source = prev->params_source; | 1641 conf->flushes = prev->flushes; |
1638 conf->params_len = prev->params_len; | 1642 conf->params_len = prev->params_len; |
1639 conf->params = prev->params; | 1643 conf->params = prev->params; |
1644 conf->params_source = prev->params_source; | |
1640 | 1645 |
1641 if (conf->params_source == NULL) { | 1646 if (conf->params_source == NULL) { |
1642 return NGX_CONF_OK; | 1647 return NGX_CONF_OK; |
1643 } | 1648 } |
1644 } | 1649 } |
1645 | 1650 |
1646 conf->params_len = ngx_array_create(cf->pool, 64, 1); | 1651 conf->params_len = ngx_array_create(cf->pool, 64, 1); |
1647 if (conf->params_len == NULL) { | 1652 if (conf->params_len == NULL) { |
1648 return NGX_CONF_ERROR; | 1653 return NGX_CONF_ERROR; |
1649 } | 1654 } |
1650 | 1655 |
1651 conf->params = ngx_array_create(cf->pool, 512, 1); | 1656 conf->params = ngx_array_create(cf->pool, 512, 1); |
1652 if (conf->params == NULL) { | 1657 if (conf->params == NULL) { |
1653 return NGX_CONF_ERROR; | 1658 return NGX_CONF_ERROR; |
1654 } | 1659 } |
1655 | 1660 |
1727 | 1732 |
1728 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | 1733 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
1729 | 1734 |
1730 sc.cf = cf; | 1735 sc.cf = cf; |
1731 sc.source = &src[i].value; | 1736 sc.source = &src[i].value; |
1737 sc.flushes = &conf->flushes; | |
1732 sc.lengths = &conf->params_len; | 1738 sc.lengths = &conf->params_len; |
1733 sc.values = &conf->params; | 1739 sc.values = &conf->params; |
1734 | 1740 |
1735 if (ngx_http_script_compile(&sc) != NGX_OK) { | 1741 if (ngx_http_script_compile(&sc) != NGX_OK) { |
1736 return NGX_CONF_ERROR; | 1742 return NGX_CONF_ERROR; |
1762 | 1768 |
1763 return NGX_CONF_OK; | 1769 return NGX_CONF_OK; |
1764 } | 1770 } |
1765 | 1771 |
1766 | 1772 |
1767 static ngx_http_variable_value_t * | 1773 static ngx_int_t |
1768 ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, uintptr_t data) | 1774 ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, |
1775 ngx_http_variable_value_t *v, uintptr_t data) | |
1769 { | 1776 { |
1770 u_char *p; | 1777 u_char *p; |
1771 ngx_http_variable_value_t *vv; | |
1772 ngx_http_fastcgi_loc_conf_t *flcf; | 1778 ngx_http_fastcgi_loc_conf_t *flcf; |
1773 | 1779 |
1774 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); | 1780 v->valid = 1; |
1775 if (vv == NULL) { | 1781 v->no_cachable = 0; |
1776 return NULL; | 1782 v->not_found = 0; |
1777 } | |
1778 | |
1779 vv->value = 0; | |
1780 | 1783 |
1781 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); | 1784 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); |
1782 | 1785 |
1783 if (r->uri.data[r->uri.len - 1] != '/') { | 1786 if (r->uri.data[r->uri.len - 1] != '/') { |
1784 vv->text = r->uri; | 1787 v->len = r->uri.len; |
1785 return vv; | 1788 v->data = r->uri.data; |
1786 } | 1789 return NGX_OK; |
1787 | 1790 } |
1788 vv->text.len = r->uri.len + flcf->index.len; | 1791 |
1789 | 1792 v->len = r->uri.len + flcf->index.len; |
1790 vv->text.data = ngx_palloc(r->pool, vv->text.len); | 1793 |
1791 if (vv->text.data == NULL) { | 1794 v->data = ngx_palloc(r->pool, v->len); |
1792 return NULL; | 1795 if (v->data == NULL) { |
1793 } | 1796 return NGX_ERROR; |
1794 | 1797 } |
1795 p = ngx_cpymem(vv->text.data, r->uri.data, r->uri.len); | 1798 |
1799 p = ngx_copy(v->data, r->uri.data, r->uri.len); | |
1796 ngx_memcpy(p, flcf->index.data, flcf->index.len); | 1800 ngx_memcpy(p, flcf->index.data, flcf->index.len); |
1797 | 1801 |
1798 return vv; | 1802 return NGX_OK; |
1799 } | 1803 } |
1800 | 1804 |
1801 | 1805 |
1802 static char * | 1806 static char * |
1803 ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 1807 ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1858 | 1862 |
1859 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); | 1863 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
1860 | 1864 |
1861 clcf->handler = ngx_http_fastcgi_handler; | 1865 clcf->handler = ngx_http_fastcgi_handler; |
1862 | 1866 |
1863 lcf->upstream.location = &clcf->name; | 1867 lcf->upstream.location = clcf->name; |
1864 | 1868 |
1865 if (clcf->name.data[clcf->name.len - 1] == '/') { | 1869 if (clcf->name.data[clcf->name.len - 1] == '/') { |
1866 clcf->auto_redirect = 1; | 1870 clcf->auto_redirect = 1; |
1867 } | 1871 } |
1868 | 1872 |