comparison src/http/ngx_http_request.c @ 573:58475592100c release-0.3.8

nginx-0.3.8-RELEASE import *) 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; the bug had 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 <igor@sysoev.ru>
date Wed, 09 Nov 2005 17:25:55 +0000
parents 174f1e853e1e
children 4d9ea73a627a
comparison
equal deleted inserted replaced
572:ae8920455206 573:58475592100c
110 ngx_http_process_unique_header_line }, 110 ngx_http_process_unique_header_line },
111 111
112 { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive), 112 { ngx_string("Keep-Alive"), offsetof(ngx_http_headers_in_t, keep_alive),
113 ngx_http_process_header_line }, 113 ngx_http_process_header_line },
114 114
115 #if (NGX_HTTP_PROXY) 115 #if (NGX_HTTP_PROXY || NGX_HTTP_REALIP)
116 { ngx_string("X-Forwarded-For"), 116 { ngx_string("X-Forwarded-For"),
117 offsetof(ngx_http_headers_in_t, x_forwarded_for), 117 offsetof(ngx_http_headers_in_t, x_forwarded_for),
118 ngx_http_process_header_line },
119 #endif
120
121 #if (NGX_HTTP_REALIP)
122 { ngx_string("X-Real-IP"),
123 offsetof(ngx_http_headers_in_t, x_real_ip),
118 ngx_http_process_header_line }, 124 ngx_http_process_header_line },
119 #endif 125 #endif
120 126
121 #if (NGX_HTTP_HEADERS) 127 #if (NGX_HTTP_HEADERS)
122 { ngx_string("Accept"), offsetof(ngx_http_headers_in_t, accept), 128 { ngx_string("Accept"), offsetof(ngx_http_headers_in_t, accept),
188 194
189 195
190 static 196 static
191 void ngx_http_init_request(ngx_event_t *rev) 197 void ngx_http_init_request(ngx_event_t *rev)
192 { 198 {
193 ngx_uint_t i; 199 ngx_uint_t i;
194 socklen_t len; 200 socklen_t len;
195 struct sockaddr_in sin; 201 struct sockaddr_in sin;
196 ngx_connection_t *c; 202 ngx_connection_t *c;
197 ngx_http_request_t *r; 203 ngx_http_request_t *r;
198 ngx_http_in_port_t *in_port; 204 ngx_http_in_port_t *in_port;
199 ngx_http_in_addr_t *in_addr; 205 ngx_http_in_addr_t *in_addr;
200 ngx_http_log_ctx_t *ctx; 206 ngx_http_log_ctx_t *ctx;
201 ngx_http_connection_t *hc; 207 ngx_http_connection_t *hc;
202 ngx_http_server_name_t *server_name; 208 ngx_http_server_name_t *server_name;
203 ngx_http_core_srv_conf_t *cscf; 209 ngx_http_core_srv_conf_t *cscf;
204 ngx_http_core_loc_conf_t *clcf; 210 ngx_http_core_loc_conf_t *clcf;
211 ngx_http_core_main_conf_t *cmcf;
205 #if (NGX_HTTP_SSL) 212 #if (NGX_HTTP_SSL)
206 ngx_http_ssl_srv_conf_t *sscf; 213 ngx_http_ssl_srv_conf_t *sscf;
207 #endif 214 #endif
208 215
209 #if (NGX_STAT_STUB) 216 #if (NGX_STAT_STUB)
210 ngx_atomic_fetch_add(ngx_stat_reading, -1); 217 ngx_atomic_fetch_add(ngx_stat_reading, -1);
211 #endif 218 #endif
375 { 382 {
376 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 383 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
377 return; 384 return;
378 } 385 }
379 386
380
381 r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); 387 r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
382 if (r->ctx == NULL) { 388 if (r->ctx == NULL) {
389 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
390 return;
391 }
392
393 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
394
395 r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts
396 * sizeof(ngx_http_variable_value_t));
397 if (r->variables == NULL) {
383 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 398 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
384 return; 399 return;
385 } 400 }
386 401
387 c->single_connection = 1; 402 c->single_connection = 1;