comparison src/http/ngx_http_core_module.c @ 540:c04fa65fe604 NGINX_0_8_22

nginx 0.8.22 *) Feature: the "proxy_bind", "fastcgi_bind", and "memcached_bind" directives. *) Feature: the "access" and the "deny" directives support IPv6. *) Feature: the "set_real_ip_from" directive supports IPv6 addresses in request headers. *) Feature: the "unix:" parameter of the "set_real_ip_from" directive. *) Bugfix: nginx did not delete unix domain socket after configuration testing. *) Bugfix: nginx deleted unix domain socket while online upgrade. *) Bugfix: the "!-x" operator did not work. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process, if limit_rate was used in HTTPS server. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process while $limit_rate logging. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault might occur in a worker process, if there was no "listen" directive in "server" block; the bug had appeared in 0.8.21.
author Igor Sysoev <http://sysoev.ru>
date Tue, 03 Nov 2009 00:00:00 +0300
parents 1dcf6adad484
children e19e5f542878
comparison
equal deleted inserted replaced
539:c88014f74832 540:c04fa65fe604
2836 ngx_http_listen_opt_t lsopt; 2836 ngx_http_listen_opt_t lsopt;
2837 ngx_http_server_name_t *sn; 2837 ngx_http_server_name_t *sn;
2838 2838
2839 /* TODO: it does not merge, it inits only */ 2839 /* TODO: it does not merge, it inits only */
2840 2840
2841 if (!conf->listen) {
2842 ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
2843
2844 sin = (struct sockaddr_in *) &lsopt.sockaddr;
2845
2846 sin->sin_family = AF_INET;
2847 #if (NGX_WIN32)
2848 sin->sin_port = htons(80);
2849 #else
2850 sin->sin_port = htons((getuid() == 0) ? 80 : 8000);
2851 #endif
2852 sin->sin_addr.s_addr = INADDR_ANY;
2853
2854 lsopt.socklen = sizeof(struct sockaddr_in);
2855
2856 lsopt.backlog = NGX_LISTEN_BACKLOG;
2857 lsopt.rcvbuf = -1;
2858 lsopt.sndbuf = -1;
2859 lsopt.wildcard = 1;
2860
2861 (void) ngx_sock_ntop((struct sockaddr *) &lsopt.sockaddr, lsopt.addr,
2862 NGX_SOCKADDR_STRLEN, 1);
2863
2864 if (ngx_http_add_listen(cf, conf, &lsopt) == NGX_OK) {
2865 return NGX_CONF_OK;
2866 }
2867 }
2868
2869 if (conf->server_name.data == NULL) {
2870 conf->server_name = cf->cycle->hostname;
2871
2872 sn = ngx_array_push(&conf->server_names);
2873 if (sn == NULL) {
2874 return NGX_CONF_ERROR;
2875 }
2876
2877 #if (NGX_PCRE)
2878 sn->regex = NULL;
2879 #endif
2880 sn->server = conf;
2881 sn->name.len = conf->server_name.len;
2882 sn->name.data = conf->server_name.data;
2883 }
2884
2885 ngx_conf_merge_size_value(conf->connection_pool_size, 2841 ngx_conf_merge_size_value(conf->connection_pool_size,
2886 prev->connection_pool_size, 256); 2842 prev->connection_pool_size, 256);
2887 ngx_conf_merge_size_value(conf->request_pool_size, 2843 ngx_conf_merge_size_value(conf->request_pool_size,
2888 prev->request_pool_size, 4096); 2844 prev->request_pool_size, 4096);
2889 ngx_conf_merge_msec_value(conf->client_header_timeout, 2845 ngx_conf_merge_msec_value(conf->client_header_timeout,
2906 2862
2907 ngx_conf_merge_value(conf->merge_slashes, prev->merge_slashes, 1); 2863 ngx_conf_merge_value(conf->merge_slashes, prev->merge_slashes, 1);
2908 2864
2909 ngx_conf_merge_value(conf->underscores_in_headers, 2865 ngx_conf_merge_value(conf->underscores_in_headers,
2910 prev->underscores_in_headers, 0); 2866 prev->underscores_in_headers, 0);
2867
2868 if (!conf->listen) {
2869 ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
2870
2871 sin = (struct sockaddr_in *) &lsopt.sockaddr;
2872
2873 sin->sin_family = AF_INET;
2874 #if (NGX_WIN32)
2875 sin->sin_port = htons(80);
2876 #else
2877 sin->sin_port = htons((getuid() == 0) ? 80 : 8000);
2878 #endif
2879 sin->sin_addr.s_addr = INADDR_ANY;
2880
2881 lsopt.socklen = sizeof(struct sockaddr_in);
2882
2883 lsopt.backlog = NGX_LISTEN_BACKLOG;
2884 lsopt.rcvbuf = -1;
2885 lsopt.sndbuf = -1;
2886 lsopt.wildcard = 1;
2887
2888 (void) ngx_sock_ntop((struct sockaddr *) &lsopt.sockaddr, lsopt.addr,
2889 NGX_SOCKADDR_STRLEN, 1);
2890
2891 if (ngx_http_add_listen(cf, conf, &lsopt) == NGX_OK) {
2892 return NGX_CONF_OK;
2893 }
2894 }
2895
2896 if (conf->server_name.data == NULL) {
2897 conf->server_name = cf->cycle->hostname;
2898
2899 sn = ngx_array_push(&conf->server_names);
2900 if (sn == NULL) {
2901 return NGX_CONF_ERROR;
2902 }
2903
2904 #if (NGX_PCRE)
2905 sn->regex = NULL;
2906 #endif
2907 sn->server = conf;
2908 sn->name.len = conf->server_name.len;
2909 sn->name.data = conf->server_name.data;
2910 }
2911 2911
2912 return NGX_CONF_OK; 2912 return NGX_CONF_OK;
2913 } 2913 }
2914 2914
2915 2915