From 1b73583ba2c0e4b72d951218827e0c621427d389 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 11 Nov 2004 14:07:14 +0000 Subject: nginx-0.1.5-RELEASE import *) 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. --- src/core/ngx_inet.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/core/ngx_inet.c') diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index bf8a788ea..5cabb49b5 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -9,6 +9,17 @@ #include +/* + * ngx_sock_ntop() and ngx_inet_ntop() may be implemented as + * "ngx_sprintf(text, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3])", + * however, they were implemented long before the ngx_sprintf() appeared + * and they are faster by 1.5-2.5 times, so it is worth to keep them. + * + * By the way, the implementation using ngx_sprintf() is faster by 2.5-3 times + * than using FreeBSD libc's snrpintf(). + */ + + ngx_inline static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len) { size_t n; @@ -105,15 +116,8 @@ size_t ngx_sock_ntop(int family, struct sockaddr *addr, u_char *text, text[n] = '\0'; return n; - -#if 0 - return ngx_snprintf((char *) text, - len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len, - "%u.%u.%u.%u", p[0], p[1], p[2], p[3]); -#endif } - size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len) { u_char *p; @@ -163,12 +167,6 @@ size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len) text[n] = '\0'; return n; - -#if 0 - return ngx_snprintf((char *) text, - len > INET_ADDRSTRLEN ? INET_ADDRSTRLEN : len, - "%u.%u.%u.%u", p[0], p[1], p[2], p[3]); -#endif } -- cgit