Changeset 456
- Timestamp:
- 11/13/06 13:13:12 (2 years ago)
- Files:
-
- cherokee/trunk/cherokee/server-protected.h (modified) (1 diff)
- cherokee/trunk/cherokee/server.c (modified) (6 diffs)
- cherokee/trunk/cherokee/socket.h (modified) (3 diffs)
- cherokee/trunk/configure.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/cherokee/server-protected.h
r454 r456 135 135 unsigned short port_tls; 136 136 cherokee_boolean_t tls_enabled; 137 cherokee_buffer_t unix_socket; 137 138 138 139 /* Server name cherokee/trunk/cherokee/server.c
r454 r456 106 106 cherokee_socket_init (&n->socket_tls); 107 107 108 cherokee_buffer_init (&n->unix_socket); 109 108 110 n->ipv6 = true; 109 111 n->fdpoll_method = cherokee_poll_UNSET; … … 325 327 /* File descriptors 326 328 */ 329 cherokee_buffer_mrproper (&srv->unix_socket); 330 327 331 cherokee_socket_close (&srv->socket); 328 332 cherokee_socket_mrproper (&srv->socket); … … 546 550 547 551 static ret_t 552 initialize_server_socket_unix (cherokee_server_t *srv, cherokee_socket_t *sock, unsigned short port) 553 { 554 #ifndef AF_LOCAL 555 return ret_no_sys; 556 #else 557 ret_t ret; 558 559 /* Create the socket, and set its properties 560 */ 561 ret = cherokee_socket_set_client (sock, AF_LOCAL); 562 if (ret != ret_ok) return ret; 563 564 /* Bind the socket 565 */ 566 ret = cherokee_socket_bind (sock, port, &srv->listen_to); 567 if (ret != ret_ok) return ret; 568 569 return ret_ok; 570 #endif 571 } 572 573 static ret_t 548 574 print_banner (cherokee_server_t *srv) 549 575 { … … 645 671 /* Initialize the socket 646 672 */ 673 ret = ret_not_found; 674 675 #ifdef AF_LOCAL 676 if (! cherokee_buffer_is_empty (&srv->unix_socket)) { 677 ret = initialize_server_socket_unix (srv, socket, port); 678 } 679 #endif 680 647 681 #ifdef HAVE_IPV6 648 if (srv->ipv6 ) {682 if (srv->ipv6 && (ret != ret_ok)) { 649 683 ret = initialize_server_socket6 (srv, socket, port); 650 684 } … … 653 687 #endif 654 688 655 if ( (srv->ipv6 == false) || (ret != ret_ok)) {689 if (ret != ret_ok) { 656 690 ret = initialize_server_socket4 (srv, socket, port); 657 691 } 658 692 659 693 if (ret != ret_ok) { 660 PRINT_ERROR ("Can't bind() socket (port=%d, UID=%d, GID=%d)\n", 661 port, getuid(), getgid()); 694 if (cherokee_buffer_is_empty (&srv->unix_socket)) 695 PRINT_ERROR ("Can't bind() socket (port=%d, UID=%d, GID=%d)\n", 696 port, getuid(), getgid()); 697 else 698 PRINT_ERROR ("Can't bind() socket (unix=%s, UID=%d, GID=%d)\n", 699 srv->unix_socket.buf, getuid(), getgid()); 662 700 return ret_error; 663 701 } … … 1307 1345 } else if (equal_buf_str (&conf->key, "keepalive_max_requests")) { 1308 1346 srv->keepalive_max = atoi (conf->val.buf); 1347 1348 } else if (equal_buf_str (&conf->key, "unix_socket")) { 1349 cherokee_buffer_clean (&srv->unix_socket); 1350 cherokee_buffer_add_buffer (&srv->unix_socket, &conf->val); 1309 1351 1310 1352 } else if (equal_buf_str (&conf->key, "panic_action")) { cherokee/trunk/cherokee/socket.h
r454 r456 63 63 # include <openssl/rand.h> 64 64 #endif 65 66 65 67 66 #include "buffer.h" … … 79 78 #endif 80 79 80 #ifndef AF_LOCAL 81 # define AF_LOCAL AF_UNIX 82 #endif 83 81 84 82 85 /* Socket status … … 143 146 #define SOCKET(s) ((cherokee_socket_t *)(s)) 144 147 #define SOCKET_FD(s) (SOCKET(s)->socket) 148 #define SOCKET_AF(s) (SOCKET(s)->client_addr.sa.sa_family) 149 #define SOCKET_STATUS(s) (SOCKET(s)->status) 150 145 151 #define SOCKET_ADDR(s) (SOCKET(s)->client_addr) 146 #define SOCKET_AF(s) (SOCKET(s)->client_addr.sa.sa_family) 147 #define SOCKET_ADDR_UNIX(s) (SOCKET(s)->client_addr.sa_un) 152 #define SOCKET_ADDR_UNIX(s) ((struct sockaddr_un *) &SOCKET_ADDR(s)) 148 153 #define SOCKET_ADDR_IPv4(s) ((struct sockaddr_in *) &SOCKET_ADDR(s)) 149 154 #define SOCKET_ADDR_IPv6(s) ((struct sockaddr_in6 *) &SOCKET_ADDR(s)) 150 #define SOCKET_STATUS(s) (SOCKET(s)->status)151 155 152 156 #define SOCKET_SIN_PORT(s) (SOCKET(s)->client_addr.sa_in.sin_port) cherokee/trunk/configure.in
r453 r456 251 251 AC_SEARCH_LIBS(setsockopt, socket) 252 252 253 254 253 dnl 255 254 dnl Check for fd events inspect functions