Mercurial > hg > nginx-vendor-0-7
comparison src/core/ngx_inet.c @ 348:e10168d6e371 NGINX_0_6_18
nginx 0.6.18
*) Change: now the ngx_http_userid_module adds start time microseconds
to the cookie field contains a pid value.
*) Change: now the full request line instead of URI only is written to
error_log.
*) Feature: variables support in the "proxy_pass" directive.
*) Feature: the "resolver" and "resolver_timeout" directives.
*) Feature: now the directive "add_header last-modified ''" deletes a
"Last-Modified" response header line.
*) Bugfix: the "limit_rate" directive did not allow to use full
throughput, even if limit value was very high.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 27 Nov 2007 00:00:00 +0300 |
parents | 10cc350ed8a1 |
children | 583decdb82a4 |
comparison
equal
deleted
inserted
replaced
347:d53199b68e17 | 348:e10168d6e371 |
---|---|
4 */ | 4 */ |
5 | 5 |
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | |
10 | |
11 /* AF_INET only */ | |
12 | |
13 in_addr_t | |
14 ngx_inet_addr(u_char *text, size_t len) | |
15 { | |
16 u_char *p, c; | |
17 in_addr_t addr; | |
18 ngx_uint_t octet, n; | |
19 | |
20 addr = 0; | |
21 octet = 0; | |
22 n = 0; | |
23 | |
24 for (p = text; p < text + len; p++) { | |
25 | |
26 c = *p; | |
27 | |
28 if (c >= '0' && c <= '9') { | |
29 octet = octet * 10 + (c - '0'); | |
30 continue; | |
31 } | |
32 | |
33 if (c == '.' && octet < 256) { | |
34 addr = (addr << 8) + octet; | |
35 octet = 0; | |
36 n++; | |
37 continue; | |
38 } | |
39 | |
40 return INADDR_NONE; | |
41 } | |
42 | |
43 if (n != 3) { | |
44 return INADDR_NONE; | |
45 } | |
46 | |
47 if (octet < 256) { | |
48 addr = (addr << 8) + octet; | |
49 return htonl(addr); | |
50 } | |
51 | |
52 return INADDR_NONE; | |
53 } | |
9 | 54 |
10 | 55 |
11 /* | 56 /* |
12 * ngx_sock_ntop() and ngx_inet_ntop() may be implemented as | 57 * ngx_sock_ntop() and ngx_inet_ntop() may be implemented as |
13 * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])", however, | 58 * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])", however, |