Commit e3f953c5 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

nth_server.c: fixed crash when wildcard host was used.

darcs-hash:20061121150632-65a35-67faeb353923246021624ba34a1a70c2881796d2.gz
parent 6001457a
...@@ -273,7 +273,7 @@ nth_site_t *nth_site_create(nth_site_t *parent, ...@@ -273,7 +273,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
ta_list ta; ta_list ta;
char *path = NULL; char *path = NULL;
size_t usize; size_t usize;
int is_host, is_path; int is_host, is_path, wildcard = 0;
su_home_auto(home, sizeof home); su_home_auto(home, sizeof home);
...@@ -373,10 +373,9 @@ nth_site_t *nth_site_create(nth_site_t *parent, ...@@ -373,10 +373,9 @@ nth_site_t *nth_site_create(nth_site_t *parent,
if (!parent) { if (!parent) {
if (strcmp(url->url_host, "*") == 0 || if (strcmp(url->url_host, "*") == 0 ||
strcmp(url->url_host, "0.0.0.0") == 0 || host_cmp(url->url_host, "0.0.0.0") == 0 ||
strcmp(url->url_host, "[::]") == 0 || host_cmp(url->url_host, "::") == 0)
strcmp(url->url_host, "::") == 0) wildcard = 1, url->url_host = "*";
site->site_wildcard = 1, url->url_host = "*";
} }
usize = sizeof(*url) + url_xtra(url); usize = sizeof(*url) + url_xtra(url);
...@@ -399,7 +398,6 @@ nth_site_t *nth_site_create(nth_site_t *parent, ...@@ -399,7 +398,6 @@ nth_site_t *nth_site_create(nth_site_t *parent,
*prev = site, site->site_prev = prev; *prev = site, site->site_prev = prev;
site->site_server = srv; site->site_server = srv;
if (path) { if (path) {
size_t path_len; size_t path_len;
...@@ -415,6 +413,7 @@ nth_site_t *nth_site_create(nth_site_t *parent, ...@@ -415,6 +413,7 @@ nth_site_t *nth_site_create(nth_site_t *parent,
site->site_path_len = 0; site->site_path_len = 0;
} }
site->site_wildcard = wildcard;
site->site_callback = callback; site->site_callback = callback;
site->site_magic = magic; site->site_magic = magic;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment