comparison src/core/ngx_inet.c @ 425:bd39260a1383

nginx-0.0.10-2004-09-14-19:55:24 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 14 Sep 2004 15:55:24 +0000
parents 37b5381fb6d8
children da8c5707af39
comparison
equal deleted inserted replaced
424:84c527908237 425:bd39260a1383
208 208
209 in_cidr->mask = htonl((ngx_uint_t) (0 - (1 << (32 - m)))); 209 in_cidr->mask = htonl((ngx_uint_t) (0 - (1 << (32 - m))));
210 210
211 return NGX_OK; 211 return NGX_OK;
212 } 212 }
213
214
215 #if 0
216
217 ngx_int_t ngx_inet_addr_port(ngx_conf_t *cf, ngx_command_t *cmd,
218 ngx_str_t *addr_port)
219 {
220 u_char *host;
221 ngx_int_t port;
222 ngx_uint_t p;
223 struct hostent *h;
224
225 for (p = 0; p < addr_port->len; p++) {
226 if (addr_port->data[p] == ':') {
227 break;
228 }
229 }
230
231 in_addr->host.len = p;
232 if (!(in_addr->host.data = ngx_palloc(pool, p + 1))) {
233 return NGX_ERROR;
234 }
235
236 ngx_cpystrn(in_addr->host.data, addr_port->data, p + 1);
237
238 if (p == addr_port->len) {
239 p = 0;
240 }
241
242 port = ngx_atoi(&addr[p], args[1].len - p);
243 if (port == NGX_ERROR && p == 0) {
244
245 /* default port */
246 iap->port = 0;
247
248 } else if ((port == NGX_ERROR && p != 0) /* "listen host:NONNUMBER" */
249 || (port < 1 || port > 65536)) { /* "listen 99999" */
250
251 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
252 "invalid port \"%s\" in \"%s\" directive, "
253 "it must be a number between 1 and 65535",
254 &addr[p], cmd->name.data);
255
256 return NGX_CONF_ERROR;
257
258 } else if (p == 0) {
259 ls->addr = INADDR_ANY;
260 ls->port = (in_port_t) port;
261 return NGX_CONF_OK;
262 }
263
264 return NGX_OK;
265 }
266
267 #endif