aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-10-21 08:48:04 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-10-21 08:48:04 +0000
commitd2d0931ed5a40d63bc6d9593c06604cb5e0eeca6 (patch)
treeb3d1ab53a439ff9be2b7e2041c3e9b714235b53e /src
parent79d630ac11d8a7979622925a39be65d606294609 (diff)
downloadnginx-d2d0931ed5a40d63bc6d9593c06604cb5e0eeca6.tar.gz
nginx-d2d0931ed5a40d63bc6d9593c06604cb5e0eeca6.zip
refactor http listen code: remove duplicate options fields
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http.c28
-rw-r--r--src/http/ngx_http_core_module.h7
2 files changed, 9 insertions, 26 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 942f24c31..6337b1521 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1213,17 +1213,13 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
if (listen->opt.default_server) {
- if (addr[i].default_server) {
+ if (addr[i].opt.default_server) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the duplicate default server");
return NGX_ERROR;
}
addr[i].core_srv_conf = cscf;
- addr[i].default_server = 1;
-#if (NGX_HTTP_SSL)
- addr[i].ssl = listen->opt.ssl;
-#endif
addr[i].opt = listen->opt;
}
@@ -1273,12 +1269,6 @@ ngx_http_add_address(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
addr->regex = NULL;
#endif
addr->core_srv_conf = cscf;
- addr->default_server = listen->opt.default_server;
- addr->bind = listen->opt.bind;
- addr->wildcard = listen->opt.wildcard;
-#if (NGX_HTTP_SSL)
- addr->ssl = listen->opt.ssl;
-#endif
addr->opt = listen->opt;
return ngx_http_add_names(cf, cscf, addr);
@@ -1531,17 +1521,17 @@ ngx_http_cmp_conf_addrs(const void *one, const void *two)
first = (ngx_http_conf_addr_t *) one;
second = (ngx_http_conf_addr_t *) two;
- if (first->wildcard) {
+ if (first->opt.wildcard) {
/* a wildcard address must be the last resort, shift it to the end */
return 1;
}
- if (first->bind && !second->bind) {
+ if (first->opt.bind && !second->opt.bind) {
/* shift explicit bind()ed addresses to the start */
return -1;
}
- if (!first->bind && second->bind) {
+ if (!first->opt.bind && second->opt.bind) {
/* shift explicit bind()ed addresses to the start */
return 1;
}
@@ -1582,8 +1572,8 @@ ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port)
* implicit bindings go, and wildcard binding is in the end.
*/
- if (addr[last - 1].wildcard) {
- addr[last - 1].bind = 1;
+ if (addr[last - 1].opt.wildcard) {
+ addr[last - 1].opt.bind = 1;
bind_wildcard = 1;
} else {
@@ -1594,7 +1584,7 @@ ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port)
while (i < last) {
- if (bind_wildcard && !addr[i].bind) {
+ if (bind_wildcard && !addr[i].opt.bind) {
i++;
continue;
}
@@ -1723,7 +1713,7 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_http_port_t *hport,
addrs[i].addr = sin->sin_addr.s_addr;
addrs[i].conf.core_srv_conf = addr[i].core_srv_conf;
#if (NGX_HTTP_SSL)
- addrs[i].conf.ssl = addr[i].ssl;
+ addrs[i].conf.ssl = addr[i].opt.ssl;
#endif
if (addr[i].hash.buckets == NULL
@@ -1784,7 +1774,7 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_http_port_t *hport,
addrs6[i].addr6 = sin6->sin6_addr;
addrs6[i].conf.core_srv_conf = addr[i].core_srv_conf;
#if (NGX_HTTP_SSL)
- addrs6[i].conf.ssl = addr[i].ssl;
+ addrs6[i].conf.ssl = addr[i].opt.ssl;
#endif
if (addr[i].hash.buckets == NULL
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 10c61e75b..e38602263 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -237,13 +237,6 @@ typedef struct {
/* the default server configuration for this address:port */
ngx_http_core_srv_conf_t *core_srv_conf;
- unsigned default_server:1;
- unsigned bind:1;
- unsigned wildcard:1;
-#if (NGX_HTTP_SSL)
- unsigned ssl:1;
-#endif
-
ngx_http_listen_opt_t opt;
} ngx_http_conf_addr_t;