comparison src/event/ngx_event.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 e38f51cd0905
children df17fbafec8f
comparison
equal deleted inserted replaced
121:737953b238a4 122:d25a1d6034f1
46 ngx_atomic_t connection_counter = 1; 46 ngx_atomic_t connection_counter = 1;
47 ngx_atomic_t *ngx_connection_counter = &connection_counter; 47 ngx_atomic_t *ngx_connection_counter = &connection_counter;
48 48
49 49
50 ngx_atomic_t *ngx_accept_mutex_ptr; 50 ngx_atomic_t *ngx_accept_mutex_ptr;
51 ngx_atomic_t *ngx_accept_mutex_last_owner;
51 ngx_atomic_t *ngx_accept_mutex; 52 ngx_atomic_t *ngx_accept_mutex;
52 ngx_uint_t ngx_accept_mutex_held; 53 ngx_uint_t ngx_accept_mutex_held;
53 ngx_msec_t ngx_accept_mutex_delay; 54 ngx_msec_t ngx_accept_mutex_delay;
54 ngx_int_t ngx_accept_disabled; 55 ngx_int_t ngx_accept_disabled;
55 ngx_file_t ngx_accept_mutex_lock_file; 56 ngx_file_t ngx_accept_mutex_lock_file;
247 delta = ngx_current_msec - delta; 248 delta = ngx_current_msec - delta;
248 249
249 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 250 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
250 "timer delta: %M", delta); 251 "timer delta: %M", delta);
251 252
253 if (ngx_posted_accept_events) {
254 ngx_event_process_posted(cycle, &ngx_posted_accept_events);
255 }
256
257 if (ngx_accept_mutex_held) {
258 *ngx_accept_mutex = 0;
259 }
260
252 if (delta) { 261 if (delta) {
253 ngx_event_expire_timers(); 262 ngx_event_expire_timers();
254 }
255
256 if (ngx_posted_accept_events) {
257 ngx_event_process_posted(cycle, &ngx_posted_accept_events);
258 }
259
260 if (ngx_accept_mutex_held) {
261 *ngx_accept_mutex = 0;
262 } 263 }
263 264
264 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, 265 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
265 "posted events %p", ngx_posted_events); 266 "posted events %p", ngx_posted_events);
266 267
468 469
469 470
470 /* TODO: adjust cache line size, 128 is P4 cache line size */ 471 /* TODO: adjust cache line size, 128 is P4 cache line size */
471 472
472 size = 128 /* ngx_accept_mutex */ 473 size = 128 /* ngx_accept_mutex */
474 + 128 /* ngx_accept_mutex_last_owner */
473 + 128; /* ngx_connection_counter */ 475 + 128; /* ngx_connection_counter */
474 476
475 #if (NGX_STAT_STUB) 477 #if (NGX_STAT_STUB)
476 478
477 size += 128 /* ngx_stat_accepted */ 479 size += 128 /* ngx_stat_accepted */
487 if (shared == NULL) { 489 if (shared == NULL) {
488 return NGX_ERROR; 490 return NGX_ERROR;
489 } 491 }
490 492
491 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared; 493 ngx_accept_mutex_ptr = (ngx_atomic_t *) shared;
492 ngx_connection_counter = (ngx_atomic_t *) (shared + 128); 494 ngx_accept_mutex_last_owner = (ngx_atomic_t *) (shared + 1 * 128);
495 ngx_connection_counter = (ngx_atomic_t *) (shared + 2 * 128);
493 496
494 #if (NGX_STAT_STUB) 497 #if (NGX_STAT_STUB)
495 498
496 ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * 128); 499 ngx_stat_accepted = (ngx_atomic_t *) (shared + 3 * 128);
497 ngx_stat_handled = (ngx_atomic_t *) (shared + 3 * 128); 500 ngx_stat_handled = (ngx_atomic_t *) (shared + 4 * 128);
498 ngx_stat_requests = (ngx_atomic_t *) (shared + 4 * 128); 501 ngx_stat_requests = (ngx_atomic_t *) (shared + 5 * 128);
499 ngx_stat_active = (ngx_atomic_t *) (shared + 5 * 128); 502 ngx_stat_active = (ngx_atomic_t *) (shared + 6 * 128);
500 ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * 128); 503 ngx_stat_reading = (ngx_atomic_t *) (shared + 7 * 128);
501 ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * 128); 504 ngx_stat_writing = (ngx_atomic_t *) (shared + 8 * 128);
502 505
503 #endif 506 #endif
504 507
505 *ngx_connection_counter = 1; 508 *ngx_connection_counter = 1;
506 509
1080 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) 1083 #if (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL)
1081 int fd; 1084 int fd;
1082 #endif 1085 #endif
1083 #if (NGX_HAVE_RTSIG) 1086 #if (NGX_HAVE_RTSIG)
1084 ngx_uint_t rtsig; 1087 ngx_uint_t rtsig;
1088 ngx_core_conf_t *ccf;
1085 #endif 1089 #endif
1086 ngx_int_t i, connections; 1090 ngx_int_t i, connections;
1087 ngx_module_t *module; 1091 ngx_module_t *module;
1088 ngx_core_conf_t *ccf;
1089 ngx_event_module_t *event_module; 1092 ngx_event_module_t *event_module;
1090 1093
1091 connections = NGX_CONF_UNSET_UINT; 1094 connections = NGX_CONF_UNSET_UINT;
1092 module = NULL; 1095 module = NULL;
1093 1096
1187 1190
1188 if (!rtsig) { 1191 if (!rtsig) {
1189 return NGX_CONF_OK; 1192 return NGX_CONF_OK;
1190 } 1193 }
1191 1194
1192 #endif
1193
1194 if (ecf->accept_mutex) { 1195 if (ecf->accept_mutex) {
1195 return NGX_CONF_OK; 1196 return NGX_CONF_OK;
1196 } 1197 }
1197 1198
1198 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); 1199 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
1203 1204
1204 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, 1205 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
1205 "the \"rtsig\" method requires \"accept_mutex\" to be on"); 1206 "the \"rtsig\" method requires \"accept_mutex\" to be on");
1206 1207
1207 return NGX_CONF_ERROR; 1208 return NGX_CONF_ERROR;
1209
1210 #else
1211
1212 return NGX_CONF_OK;
1213
1214 #endif
1208 } 1215 }
1209 1216
1210 1217
1211 static char * 1218 static char *
1212 ngx_accept_mutex_check(ngx_conf_t *cf, void *post, void *data) 1219 ngx_accept_mutex_check(ngx_conf_t *cf, void *post, void *data)