Mercurial > hg > nginx-mail
comparison src/http/ngx_http_core_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 | 644a7935144b |
children | df17fbafec8f |
comparison
equal
deleted
inserted
replaced
121:737953b238a4 | 122:d25a1d6034f1 |
---|---|
20 static void ngx_http_core_run_phases(ngx_http_request_t *r); | 20 static void ngx_http_core_run_phases(ngx_http_request_t *r); |
21 static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r, | 21 static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r, |
22 ngx_array_t *locations, size_t len); | 22 ngx_array_t *locations, size_t len); |
23 | 23 |
24 static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf); | 24 static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf); |
25 static ngx_int_t ngx_http_core_postconfiguration(ngx_conf_t *cf); | |
26 static void *ngx_http_core_create_main_conf(ngx_conf_t *cf); | 25 static void *ngx_http_core_create_main_conf(ngx_conf_t *cf); |
27 static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf); | 26 static char *ngx_http_core_init_main_conf(ngx_conf_t *cf, void *conf); |
28 static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf); | 27 static void *ngx_http_core_create_srv_conf(ngx_conf_t *cf); |
29 static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf, | 28 static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf, |
30 void *parent, void *child); | 29 void *parent, void *child); |
366 }; | 365 }; |
367 | 366 |
368 | 367 |
369 ngx_http_module_t ngx_http_core_module_ctx = { | 368 ngx_http_module_t ngx_http_core_module_ctx = { |
370 ngx_http_core_preconfiguration, /* preconfiguration */ | 369 ngx_http_core_preconfiguration, /* preconfiguration */ |
371 ngx_http_core_postconfiguration, /* postconfiguration */ | 370 NULL, /* postconfiguration */ |
372 | 371 |
373 ngx_http_core_create_main_conf, /* create main configuration */ | 372 ngx_http_core_create_main_conf, /* create main configuration */ |
374 ngx_http_core_init_main_conf, /* init main configuration */ | 373 ngx_http_core_init_main_conf, /* init main configuration */ |
375 | 374 |
376 ngx_http_core_create_srv_conf, /* create server configuration */ | 375 ngx_http_core_create_srv_conf, /* create server configuration */ |
446 r->valid_unparsed_uri = 1; | 445 r->valid_unparsed_uri = 1; |
447 r->valid_location = 1; | 446 r->valid_location = 1; |
448 r->uri_changed = 1; | 447 r->uri_changed = 1; |
449 r->uri_changes = NGX_HTTP_MAX_REWRITE_CYCLES + 1; | 448 r->uri_changes = NGX_HTTP_MAX_REWRITE_CYCLES + 1; |
450 | 449 |
451 r->phase = NGX_HTTP_REWRITE_PHASE; | 450 r->phase = (r->main == r) ? NGX_HTTP_POST_READ_PHASE: |
451 NGX_HTTP_SERVER_REWRITE_PHASE; | |
452 r->phase_handler = 0; | 452 r->phase_handler = 0; |
453 | 453 |
454 ngx_http_core_run_phases(r); | 454 ngx_http_core_run_phases(r); |
455 } | 455 } |
456 | 456 |
989 path->data = ngx_palloc(r->pool, path->len); | 989 path->data = ngx_palloc(r->pool, path->len); |
990 if (path->data == NULL) { | 990 if (path->data == NULL) { |
991 return NULL; | 991 return NULL; |
992 } | 992 } |
993 | 993 |
994 last = ngx_cpymem(path->data, clcf->root.data, clcf->root.len); | 994 last = ngx_copy(path->data, clcf->root.data, clcf->root.len); |
995 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); | 995 last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1); |
996 | 996 |
997 return last; | 997 return last; |
998 } | 998 } |
999 | 999 |
1052 if (auth.data[len] == ':') { | 1052 if (auth.data[len] == ':') { |
1053 break; | 1053 break; |
1054 } | 1054 } |
1055 } | 1055 } |
1056 | 1056 |
1057 if (len == auth.len) { | 1057 if (len == 0 || len == auth.len) { |
1058 r->headers_in.user.data = (u_char *) ""; | 1058 r->headers_in.user.data = (u_char *) ""; |
1059 return NGX_DECLINED; | 1059 return NGX_DECLINED; |
1060 } | 1060 } |
1061 | 1061 |
1062 r->headers_in.user.len = len; | 1062 r->headers_in.user.len = len; |
1068 } | 1068 } |
1069 | 1069 |
1070 | 1070 |
1071 ngx_int_t | 1071 ngx_int_t |
1072 ngx_http_subrequest(ngx_http_request_t *r, | 1072 ngx_http_subrequest(ngx_http_request_t *r, |
1073 ngx_str_t *uri, ngx_str_t *args) | 1073 ngx_str_t *uri, ngx_str_t *args, ngx_uint_t flags) |
1074 { | 1074 { |
1075 ngx_http_request_t *sr; | 1075 ngx_http_request_t *sr; |
1076 ngx_http_core_srv_conf_t *cscf; | 1076 ngx_http_core_srv_conf_t *cscf; |
1077 ngx_http_postponed_request_t *pr, *p; | 1077 ngx_http_postponed_request_t *pr, *p; |
1078 | 1078 |
1114 sr->http_version = r->http_version; | 1114 sr->http_version = r->http_version; |
1115 sr->http_major = r->http_minor; | 1115 sr->http_major = r->http_minor; |
1116 | 1116 |
1117 sr->request_line = r->request_line; | 1117 sr->request_line = r->request_line; |
1118 sr->uri = *uri; | 1118 sr->uri = *uri; |
1119 | |
1120 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1121 "http subrequest \"%V\"", uri); | |
1122 | |
1119 if (args) { | 1123 if (args) { |
1120 sr->args = *args; | 1124 sr->args = *args; |
1121 } | 1125 |
1126 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1127 "http subrequest args \"%V\"", args); | |
1128 } | |
1129 | |
1130 if (flags & NGX_HTTP_ZERO_IN_URI) { | |
1131 sr->zero_in_uri = 1; | |
1132 } | |
1133 | |
1122 sr->unparsed_uri = r->unparsed_uri; | 1134 sr->unparsed_uri = r->unparsed_uri; |
1123 sr->method_name = r->method_name; | 1135 sr->method_name = r->method_name; |
1124 sr->http_protocol = r->http_protocol; | 1136 sr->http_protocol = r->http_protocol; |
1125 | 1137 |
1126 if (ngx_http_set_exten(sr) != NGX_OK) { | 1138 if (ngx_http_set_exten(sr) != NGX_OK) { |
1165 sr->internal = 1; | 1177 sr->internal = 1; |
1166 | 1178 |
1167 sr->discard_body = r->discard_body; | 1179 sr->discard_body = r->discard_body; |
1168 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; | 1180 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; |
1169 | 1181 |
1170 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1171 "http subrequest \"%V\"", uri); | |
1172 | |
1173 ngx_http_handler(sr); | 1182 ngx_http_handler(sr); |
1174 | 1183 |
1175 /* the request pool may be already destroyed */ | 1184 /* the request pool may be already destroyed */ |
1176 | 1185 |
1177 return NGX_OK; | 1186 return NGX_OK; |
1189 | 1198 |
1190 r->uri = *uri; | 1199 r->uri = *uri; |
1191 | 1200 |
1192 if (args) { | 1201 if (args) { |
1193 r->args = *args; | 1202 r->args = *args; |
1203 | |
1204 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1205 "internal redirect args: \"%V\"", args); | |
1194 | 1206 |
1195 } else { | 1207 } else { |
1196 r->args.len = 0; | 1208 r->args.len = 0; |
1197 r->args.data = NULL; | 1209 r->args.data = NULL; |
1198 } | 1210 } |
1652 | 1664 |
1653 static ngx_int_t | 1665 static ngx_int_t |
1654 ngx_http_core_preconfiguration(ngx_conf_t *cf) | 1666 ngx_http_core_preconfiguration(ngx_conf_t *cf) |
1655 { | 1667 { |
1656 return ngx_http_variables_add_core_vars(cf); | 1668 return ngx_http_variables_add_core_vars(cf); |
1657 } | |
1658 | |
1659 | |
1660 static ngx_int_t | |
1661 ngx_http_core_postconfiguration(ngx_conf_t *cf) | |
1662 { | |
1663 return ngx_http_variables_init_vars(cf); | |
1664 } | 1669 } |
1665 | 1670 |
1666 | 1671 |
1667 static void * | 1672 static void * |
1668 ngx_http_core_create_main_conf(ngx_conf_t *cf) | 1673 ngx_http_core_create_main_conf(ngx_conf_t *cf) |