Mercurial > hg > nginx-vendor-0-6
comparison src/core/nginx.c @ 92:45945fa8b8ba NGINX_0_2_0
nginx 0.2.0
*) The pid-file names used during online upgrade was changed and now is
not required a manual rename operation. The old master process adds
the ".oldbin" suffix to its pid-file and executes a new binary file.
The new master process creates usual pid-file without the ".newbin"
suffix. If the master process exits, then old master process renames
back its pid-file with the ".oldbin" suffix to the pid-file without
suffix.
*) Change: the "worker_connections" directive, new name of the
"connections" directive; now the directive specifies maximum number
of connections, but not maximum socket descriptor number.
*) Feature: SSL supports the session cache inside one worker process.
*) Feature: the "satisfy_any" directive.
*) Change: the ngx_http_access_module and ngx_http_auth_basic_module do
not run for subrequests.
*) Feature: the "worker_rlimit_nofile" and "worker_rlimit_sigpending"
directives.
*) Bugfix: if all backend using in load-balancing failed after one
error, then nginx did not try do connect to them during 60 seconds.
*) Bugfix: in IMAP/POP3 command argument parsing.
Thanks to Rob Mueller.
*) Bugfix: errors while using SSL in IMAP/POP3 proxy.
*) Bugfix: errors while using SSI and gzipping.
*) Bugfix: the "Expires" and "Cache-Control" header lines were omitted
from the 304 responses.
Thanks to Alexandr Kukushkin.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 23 Sep 2005 00:00:00 +0400 |
parents | 71c46860eb55 |
children | 45f7329b4bd0 |
comparison
equal
deleted
inserted
replaced
91:c3eee83ea942 | 92:45945fa8b8ba |
---|---|
40 ngx_conf_set_flag_slot, | 40 ngx_conf_set_flag_slot, |
41 0, | 41 0, |
42 offsetof(ngx_core_conf_t, master), | 42 offsetof(ngx_core_conf_t, master), |
43 NULL }, | 43 NULL }, |
44 | 44 |
45 { ngx_string("pid"), | |
46 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
47 ngx_conf_set_str_slot, | |
48 0, | |
49 offsetof(ngx_core_conf_t, pid), | |
50 NULL }, | |
51 | |
45 { ngx_string("worker_processes"), | 52 { ngx_string("worker_processes"), |
46 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | 53 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
47 ngx_conf_set_num_slot, | 54 ngx_conf_set_num_slot, |
48 0, | 55 0, |
49 offsetof(ngx_core_conf_t, worker_processes), | 56 offsetof(ngx_core_conf_t, worker_processes), |
53 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | 60 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
54 ngx_conf_set_enum_slot, | 61 ngx_conf_set_enum_slot, |
55 0, | 62 0, |
56 offsetof(ngx_core_conf_t, debug_points), | 63 offsetof(ngx_core_conf_t, debug_points), |
57 &ngx_debug_points }, | 64 &ngx_debug_points }, |
58 | |
59 #if (NGX_THREADS) | |
60 | |
61 { ngx_string("worker_threads"), | |
62 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
63 ngx_conf_set_num_slot, | |
64 0, | |
65 offsetof(ngx_core_conf_t, worker_threads), | |
66 NULL }, | |
67 | |
68 { ngx_string("thread_stack_size"), | |
69 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
70 ngx_conf_set_size_slot, | |
71 0, | |
72 offsetof(ngx_core_conf_t, thread_stack_size), | |
73 NULL }, | |
74 | |
75 #endif | |
76 | 65 |
77 { ngx_string("user"), | 66 { ngx_string("user"), |
78 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12, | 67 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12, |
79 ngx_set_user, | 68 ngx_set_user, |
80 0, | 69 0, |
86 ngx_set_priority, | 75 ngx_set_priority, |
87 0, | 76 0, |
88 0, | 77 0, |
89 NULL }, | 78 NULL }, |
90 | 79 |
91 { ngx_string("pid"), | 80 { ngx_string("worker_rlimit_nofile"), |
81 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
82 ngx_conf_set_num_slot, | |
83 0, | |
84 offsetof(ngx_core_conf_t, rlimit_nofile), | |
85 NULL }, | |
86 | |
87 { ngx_string("worker_rlimit_sigpending"), | |
88 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
89 ngx_conf_set_num_slot, | |
90 0, | |
91 offsetof(ngx_core_conf_t, rlimit_sigpending), | |
92 NULL }, | |
93 | |
94 { ngx_string("working_directory"), | |
92 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | 95 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
93 ngx_conf_set_str_slot, | 96 ngx_conf_set_str_slot, |
94 0, | 97 0, |
95 offsetof(ngx_core_conf_t, pid), | |
96 NULL }, | |
97 | |
98 { ngx_string("working_directory"), | |
99 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
100 ngx_conf_set_str_slot, | |
101 0, | |
102 offsetof(ngx_core_conf_t, working_directory), | 98 offsetof(ngx_core_conf_t, working_directory), |
103 NULL }, | 99 NULL }, |
100 | |
101 #if (NGX_THREADS) | |
102 | |
103 { ngx_string("worker_threads"), | |
104 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
105 ngx_conf_set_num_slot, | |
106 0, | |
107 offsetof(ngx_core_conf_t, worker_threads), | |
108 NULL }, | |
109 | |
110 { ngx_string("thread_stack_size"), | |
111 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
112 ngx_conf_set_size_slot, | |
113 0, | |
114 offsetof(ngx_core_conf_t, thread_stack_size), | |
115 NULL }, | |
116 | |
117 #endif | |
104 | 118 |
105 ngx_null_command | 119 ngx_null_command |
106 }; | 120 }; |
107 | 121 |
108 | 122 |
322 | 336 |
323 return ngx_set_inherited_sockets(cycle); | 337 return ngx_set_inherited_sockets(cycle); |
324 } | 338 } |
325 | 339 |
326 | 340 |
327 ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) | 341 ngx_pid_t |
342 ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) | |
328 { | 343 { |
329 char *env[3], *var; | 344 char *env[3], *var; |
330 u_char *p; | 345 u_char *p; |
331 ngx_uint_t i; | 346 ngx_uint_t i; |
332 ngx_pid_t pid; | 347 ngx_pid_t pid; |
333 ngx_exec_ctx_t ctx; | 348 ngx_exec_ctx_t ctx; |
349 ngx_core_conf_t *ccf; | |
334 ngx_listening_t *ls; | 350 ngx_listening_t *ls; |
335 | 351 |
336 ctx.path = argv[0]; | 352 ctx.path = argv[0]; |
337 ctx.name = "new binary process"; | 353 ctx.name = "new binary process"; |
338 ctx.argv = argv; | 354 ctx.argv = argv; |
372 | 388 |
373 #endif | 389 #endif |
374 | 390 |
375 ctx.envp = (char *const *) &env; | 391 ctx.envp = (char *const *) &env; |
376 | 392 |
393 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | |
394 | |
395 if (ngx_rename_file((char *) ccf->pid.data, (char *) ccf->oldpid.data) | |
396 != NGX_OK) | |
397 { | |
398 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
399 ngx_rename_file_n " %s to %s failed " | |
400 "before executing new binary process \"%s\"", | |
401 ccf->pid.data, ccf->oldpid.data, argv[0]); | |
402 | |
403 ngx_free(var); | |
404 | |
405 return NGX_INVALID_PID; | |
406 } | |
407 | |
377 pid = ngx_execute(cycle, &ctx); | 408 pid = ngx_execute(cycle, &ctx); |
378 | 409 |
410 if (pid == NGX_INVALID_PID) { | |
411 if (ngx_rename_file((char *) ccf->oldpid.data, (char *) ccf->pid.data) | |
412 != NGX_OK) | |
413 { | |
414 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
415 ngx_rename_file_n " %s back to %s failed " | |
416 "after try to executing new binary process \"%s\"", | |
417 ccf->oldpid.data, ccf->pid.data, argv[0]); | |
418 } | |
419 } | |
420 | |
379 ngx_free(var); | 421 ngx_free(var); |
380 | 422 |
381 return pid; | 423 return pid; |
382 } | 424 } |
383 | 425 |
384 | 426 |
385 static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv) | 427 static ngx_int_t |
428 ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv) | |
386 { | 429 { |
387 ngx_int_t i; | 430 ngx_int_t i; |
388 | 431 |
389 for (i = 1; i < argc; i++) { | 432 for (i = 1; i < argc; i++) { |
390 if (argv[i][0] != '-') { | 433 if (argv[i][0] != '-') { |
483 | 526 |
484 /* | 527 /* |
485 * set by pcalloc() | 528 * set by pcalloc() |
486 * | 529 * |
487 * ccf->pid = NULL; | 530 * ccf->pid = NULL; |
488 * ccf->newpid = NULL; | 531 * ccf->oldpid = NULL; |
489 * ccf->priority = 0; | 532 * ccf->priority = 0; |
490 */ | 533 */ |
491 | 534 |
492 ccf->daemon = NGX_CONF_UNSET; | 535 ccf->daemon = NGX_CONF_UNSET; |
493 ccf->master = NGX_CONF_UNSET; | 536 ccf->master = NGX_CONF_UNSET; |
494 ccf->worker_processes = NGX_CONF_UNSET; | 537 ccf->worker_processes = NGX_CONF_UNSET; |
495 ccf->debug_points = NGX_CONF_UNSET; | 538 ccf->debug_points = NGX_CONF_UNSET; |
539 | |
540 ccf->rlimit_nofile = NGX_CONF_UNSET; | |
541 ccf->rlimit_sigpending = NGX_CONF_UNSET; | |
542 | |
496 ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT; | 543 ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT; |
497 ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT; | 544 ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT; |
545 | |
498 #if (NGX_THREADS) | 546 #if (NGX_THREADS) |
499 ccf->worker_threads = NGX_CONF_UNSET; | 547 ccf->worker_threads = NGX_CONF_UNSET; |
500 ccf->thread_stack_size = NGX_CONF_UNSET_SIZE; | 548 ccf->thread_stack_size = NGX_CONF_UNSET_SIZE; |
501 #endif | 549 #endif |
502 | 550 |
556 | 604 |
557 if (ngx_conf_full_name(cycle, &ccf->pid) == NGX_ERROR) { | 605 if (ngx_conf_full_name(cycle, &ccf->pid) == NGX_ERROR) { |
558 return NGX_CONF_ERROR; | 606 return NGX_CONF_ERROR; |
559 } | 607 } |
560 | 608 |
561 ccf->newpid.len = ccf->pid.len + sizeof(NGX_NEWPID_EXT); | 609 ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT); |
562 | 610 |
563 ccf->newpid.data = ngx_palloc(cycle->pool, ccf->newpid.len); | 611 ccf->oldpid.data = ngx_palloc(cycle->pool, ccf->oldpid.len); |
564 if (ccf->newpid.data == NULL) { | 612 if (ccf->oldpid.data == NULL) { |
565 return NGX_CONF_ERROR; | 613 return NGX_CONF_ERROR; |
566 } | 614 } |
567 | 615 |
568 ngx_memcpy(ngx_cpymem(ccf->newpid.data, ccf->pid.data, ccf->pid.len), | 616 ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len), |
569 NGX_NEWPID_EXT, sizeof(NGX_NEWPID_EXT)); | 617 NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT)); |
570 | 618 |
571 #endif | 619 #endif |
572 | 620 |
573 return NGX_CONF_OK; | 621 return NGX_CONF_OK; |
574 } | 622 } |