Changeset 1790
- Timestamp:
- 08/13/08 13:09:46 (3 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/resolv_cache.c (modified) (1 diff)
- cherokee/trunk/cherokee/socket.c (modified) (4 diffs)
- cherokee/trunk/cherokee/socket.h (modified) (1 diff)
- cherokee/trunk/cherokee/source.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1789 r1790 1 1 2008-08-13 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/resolv_cache.c, cherokee/socket.c, cherokee/socket.h, 4 cherokee/source.c: Fixes the Unix socket support of the FastCGI 5 and SCGI handlers (plus some code clean up). 2 6 3 7 * cherokee/handler_mirror.c, cherokee/handler_mirror.h: Fixes the cherokee/trunk/cherokee/resolv_cache.c
r1131 r1790 166 166 */ 167 167 ret = entry_fill_up (n, domain); 168 if (unlikely (ret != ret )) {168 if (unlikely (ret != ret_ok)) { 169 169 entry_free (n); 170 170 return ret; cherokee/trunk/cherokee/socket.c
r1769 r1790 784 784 #endif 785 785 #ifdef HAVE_SOCKADDR_UN 786 case AF_ LOCAL:786 case AF_UNIX: 787 787 memset (&sock->client_addr, 0, sizeof (struct sockaddr_un)); 788 788 break; … … 903 903 #endif 904 904 #ifdef HAVE_SOCKADDR_UN 905 case AF_ LOCAL:905 case AF_UNIX: 906 906 return cherokee_bind_local (sock, listen_to); 907 907 #endif … … 1654 1654 return ret_no_sys; 1655 1655 #else 1656 memset ((char*) SOCKET_SUN_PATH (socket), 0, sizeof (SOCKET_ADDR_UNIX(socket))); 1656 memset ((char*) SOCKET_SUN_PATH(socket), 0, 1657 sizeof (SOCKET_ADDR_UNIX(socket))); 1657 1658 1658 1659 SOCKET_ADDR_UNIX(socket)->sun_family = AF_UNIX; 1659 strncpy (SOCKET_SUN_PATH (socket), hostname->buf, hostname->len); 1660 1661 strncpy (SOCKET_SUN_PATH (socket), hostname->buf, 1662 sizeof (SOCKET_ADDR_UNIX(socket)->sun_path) - sizeof(short)); 1660 1663 1661 1664 return ret_ok; … … 1676 1679 switch (SOCKET_AF(sock)) { 1677 1680 case AF_INET: 1678 r = connect (SOCKET_FD(sock), (struct sockaddr *) &SOCKET_ADDR(sock), sizeof(struct sockaddr_in)); 1681 r = connect (SOCKET_FD(sock), 1682 (struct sockaddr *) &SOCKET_ADDR(sock), 1683 sizeof(struct sockaddr_in)); 1679 1684 break; 1680 1685 #ifdef HAVE_IPV6 1681 1686 case AF_INET6: 1682 r = connect (SOCKET_FD(sock), (struct sockaddr *) &SOCKET_ADDR(sock), sizeof(struct sockaddr_in6)); 1687 r = connect (SOCKET_FD(sock), 1688 (struct sockaddr *) &SOCKET_ADDR(sock), 1689 sizeof(struct sockaddr_in6)); 1683 1690 break; 1684 1691 #endif 1685 1692 #ifdef HAVE_SOCKADDR_UN 1686 case AF_LOCAL: 1687 r = connect (SOCKET_FD(sock), (struct sockaddr *) SOCKET_ADDR_UNIX(sock), sizeof(SOCKET_ADDR_UNIX(sock))); 1693 case AF_UNIX: 1694 r = connect (SOCKET_FD(sock), 1695 (struct sockaddr *) &SOCKET_ADDR(sock), 1696 SUN_LEN (SOCKET_ADDR_UNIX(sock))); 1688 1697 break; 1689 1698 #endif cherokee/trunk/cherokee/socket.h
r1747 r1790 82 82 #endif 83 83 84 #ifndef SUN_LEN 85 #define SUN_LEN(sa) \ 86 (strlen((sa)->sun_path) + \ 87 (size_t)(((struct sockaddr_un*)0)->sun_path)) 88 #endif 84 89 85 90 /* Socket status cherokee/trunk/cherokee/source.c
r1754 r1790 93 93 if (! cherokee_buffer_is_empty (&src->unix_socket)) { 94 94 ret = cherokee_socket_set_client (sock, AF_UNIX); 95 if (ret != ret_ok) return ret; 96 97 ret = cherokee_resolv_cache_get_host (resolv, src->unix_socket.buf, sock); 98 if (ret != ret_ok) return ret; 95 if (ret != ret_ok) 96 return ret; 97 98 /* Copy the unix socket path */ 99 ret = cherokee_socket_gethostbyname (sock, &src->unix_socket); 100 if (ret != ret_ok) 101 return ret; 99 102 100 103 /* Set non-blocking */