comparison src/core/nginx.c @ 22:8b6db3bda591 NGINX_0_1_11

nginx 0.1.11 *) Feature: the worker_priority directive. *) Change: both tcp_nopush and tcp_nodelay directives affect the transferred response. *) Bugfix: nginx did not call initgroups(). Thanks to Andrew Sitnikov and Andrei Nigmatulin. *) Change: now the ngx_http_autoindex_module shows the file size in the bytes. *) Bugfix: the ngx_http_autoindex_module returned the 500 error if the broken symlink was in a directory. *) Bugfix: the files bigger than 4G could not be transferred using sendfile. *) Bugfix: if the backend was resolved to several backends and there was an error while the response waiting then process may got caught in an endless loop. *) Bugfix: the worker process may exit with the "unknown cycle" message when the /dev/poll method was used. *) Bugfix: "close() channel failed" errors. *) Bugfix: the autodetection of the "nobody" and "nogroup" groups. *) Bugfix: the send_lowat directive did not work on Linux. *) Bugfix: the segmentation fault occurred if there was no events section in configuration. *) Bugfix: nginx could not be built on OpenBSD. *) Bugfix: the double slashes in "://" in the URI were converted to ":/".
author Igor Sysoev <http://sysoev.ru>
date Thu, 02 Dec 2004 00:00:00 +0300
parents 6f8b0dc0f8dd
children 7ca9bdc82b3f
comparison
equal deleted inserted replaced
21:4eeb9cfef970 22:8b6db3bda591
14 static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv); 14 static ngx_int_t ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv);
15 static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv); 15 static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv);
16 static void *ngx_core_module_create_conf(ngx_cycle_t *cycle); 16 static void *ngx_core_module_create_conf(ngx_cycle_t *cycle);
17 static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf); 17 static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf);
18 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); 18 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
19 static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
19 20
20 21
21 static ngx_conf_enum_t ngx_debug_points[] = { 22 static ngx_conf_enum_t ngx_debug_points[] = {
22 { ngx_string("stop"), NGX_DEBUG_POINTS_STOP }, 23 { ngx_string("stop"), NGX_DEBUG_POINTS_STOP },
23 { ngx_string("abort"), NGX_DEBUG_POINTS_ABORT }, 24 { ngx_string("abort"), NGX_DEBUG_POINTS_ABORT },
74 #endif 75 #endif
75 76
76 { ngx_string("user"), 77 { ngx_string("user"),
77 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12, 78 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12,
78 ngx_set_user, 79 ngx_set_user,
80 0,
81 0,
82 NULL },
83
84 { ngx_string("worker_priority"),
85 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
86 ngx_set_priority,
79 0, 87 0,
80 0, 88 0,
81 NULL }, 89 NULL },
82 90
83 { ngx_string("pid"), 91 { ngx_string("pid"),
445 } 453 }
446 /* set by pcalloc() 454 /* set by pcalloc()
447 * 455 *
448 * ccf->pid = NULL; 456 * ccf->pid = NULL;
449 * ccf->newpid = NULL; 457 * ccf->newpid = NULL;
458 * ccf->priority = 0;
450 */ 459 */
451 ccf->daemon = NGX_CONF_UNSET; 460 ccf->daemon = NGX_CONF_UNSET;
452 ccf->master = NGX_CONF_UNSET; 461 ccf->master = NGX_CONF_UNSET;
453 ccf->worker_processes = NGX_CONF_UNSET; 462 ccf->worker_processes = NGX_CONF_UNSET;
454 ccf->debug_points = NGX_CONF_UNSET; 463 ccf->debug_points = NGX_CONF_UNSET;
492 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 501 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
493 "getpwnam(\"" NGX_USER "\") failed"); 502 "getpwnam(\"" NGX_USER "\") failed");
494 return NGX_CONF_ERROR; 503 return NGX_CONF_ERROR;
495 } 504 }
496 505
506 ccf->username = NGX_USER;
497 ccf->user = pwd->pw_uid; 507 ccf->user = pwd->pw_uid;
498 508
499 grp = getgrnam(NGX_GROUP); 509 grp = getgrnam(NGX_GROUP);
500 if (grp == NULL) { 510 if (grp == NULL) {
501 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 511 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
560 return NGX_CONF_OK; 570 return NGX_CONF_OK;
561 } 571 }
562 572
563 value = (ngx_str_t *) cf->args->elts; 573 value = (ngx_str_t *) cf->args->elts;
564 574
575 ccf->username = (char *) value[1].data;
576
565 pwd = getpwnam((const char *) value[1].data); 577 pwd = getpwnam((const char *) value[1].data);
566 if (pwd == NULL) { 578 if (pwd == NULL) {
567 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, 579 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
568 "getpwnam(\"%s\") failed", value[1].data); 580 "getpwnam(\"%s\") failed", value[1].data);
569 return NGX_CONF_ERROR; 581 return NGX_CONF_ERROR;
584 596
585 return NGX_CONF_OK; 597 return NGX_CONF_OK;
586 598
587 #endif 599 #endif
588 } 600 }
601
602
603 static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
604 {
605 ngx_core_conf_t *ccf = conf;
606
607 ngx_str_t *value;
608 ngx_uint_t n, minus;
609
610 if (ccf->priority != 0) {
611 return "is duplicate";
612 }
613
614 value = cf->args->elts;
615
616 if (value[1].data[0] == '-') {
617 n = 1;
618 minus = 1;
619
620 } else if (value[1].data[0] == '+') {
621 n = 1;
622 minus = 0;
623
624 } else {
625 n = 0;
626 minus = 0;
627 }
628
629 ccf->priority = ngx_atoi(&value[1].data[n], value[1].len - n);
630 if (ccf->priority == NGX_ERROR) {
631 return "invalid number";
632 }
633
634 if (minus) {
635 ccf->priority = -ccf->priority;
636 }
637
638 return NGX_CONF_OK;
639 }