137 |
* virthost structure or NULL if not found |
* virthost structure or NULL if not found |
138 |
*/ |
*/ |
139 |
|
|
140 |
virthost *find_virthost(const char *host, int hostlen) |
virthost *find_virthost(const char *_host, int hostlen) |
141 |
{ |
{ |
142 |
virthost *current; |
virthost *current; |
143 |
int hash; |
int hash; |
144 |
|
char host[MAX_SITENAME_LENGTH], *p; |
145 |
|
|
146 |
/* Find Hostname, IP, document root */ |
/* Find Hostname, IP, document root */ |
147 |
if (host==NULL) return NULL; |
if (_host==NULL) return NULL; |
148 |
|
|
149 |
if (hostlen == 0) |
if (hostlen == 0) |
150 |
hostlen = strlen(host); |
hostlen = strlen(_host); |
151 |
|
|
152 |
|
if (hostlen >= MAX_SITENAME_LENGTH) |
153 |
|
return NULL; |
154 |
|
|
155 |
|
/* Remove port number.. Ie www.site.gr:8080 |
156 |
|
*/ |
157 |
|
strcpy( host, _host); |
158 |
|
p = strrchr( host, ':'); |
159 |
|
if (p) { |
160 |
|
*p = 0; |
161 |
|
hostlen = strlen( host); |
162 |
|
} |
163 |
|
|
164 |
hash = get_host_hash_value( host); |
hash = get_host_hash_value( host); |
165 |
|
|