comparison src/core/ngx_inet.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents f0b350454894
children 74b1868dd3cd
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
5 5
6 6
7 7
8 #include <ngx_config.h> 8 #include <ngx_config.h>
9 #include <ngx_core.h> 9 #include <ngx_core.h>
10
11
12 /*
13 * ngx_sock_ntop() and ngx_inet_ntop() may be implemented as
14 * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])",
15 * however, they were implemented long before the ngx_sprintf() appeared
16 * and they are faster by 1.5-2.5 times, so it is worth to keep them.
17 *
18 * By the way, the implementation using ngx_sprintf() is faster by 2.5-3 times
19 * than using FreeBSD libc's snrpintf().
20 */
10 21
11 22
12 ngx_inline static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len) 23 ngx_inline static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
13 { 24 {
14 size_t n; 25 size_t n;
103 } 114 }
104 115
105 text[n] = '\0'; 116 text[n] = '\0';
106 117
107 return n; 118 return n;
108 119 }
109 #if 0
110 return ngx_snprintf((char *) text,
111 len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
112 "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
113 #endif
114 }
115
116 120
117 size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len) 121 size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len)
118 { 122 {
119 u_char *p; 123 u_char *p;
120 size_t n; 124 size_t n;
161 } 165 }
162 166
163 text[n] = '\0'; 167 text[n] = '\0';
164 168
165 return n; 169 return n;
166
167 #if 0
168 return ngx_snprintf((char *) text,
169 len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len,
170 "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
171 #endif
172 } 170 }
173 171
174 172
175 /* AF_INET only */ 173 /* AF_INET only */
176 174