summaryrefslogtreecommitdiff
path: root/modules/proxy/mod_proxy_fdpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/proxy/mod_proxy_fdpass.c')
-rw-r--r--modules/proxy/mod_proxy_fdpass.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/modules/proxy/mod_proxy_fdpass.c b/modules/proxy/mod_proxy_fdpass.c
index 26a7b13e..63cf4696 100644
--- a/modules/proxy/mod_proxy_fdpass.c
+++ b/modules/proxy/mod_proxy_fdpass.c
@@ -24,12 +24,6 @@
#error This module only works on unix platforms with the correct OS support
#endif
-#include "apr_version.h"
-#if APR_MAJOR_VERSION < 2
-/* for apr_wait_for_io_or_timeout */
-#include "apr_support.h"
-#endif
-
#include "mod_proxy_fdpass.h"
module AP_MODULE_DECLARE_DATA proxy_fdpass_module;
@@ -54,54 +48,10 @@ static int proxy_fdpass_canon(request_rec *r, char *url)
return OK;
}
-/* TODO: In APR 2.x: Extend apr_sockaddr_t to possibly be a path !!! */
-static apr_status_t socket_connect_un(apr_socket_t *sock,
- struct sockaddr_un *sa)
-{
- apr_status_t rv;
- apr_os_sock_t rawsock;
- apr_interval_time_t t;
-
- rv = apr_os_sock_get(&rawsock, sock);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- rv = apr_socket_timeout_get(sock, &t);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- do {
- rv = connect(rawsock, (struct sockaddr*)sa,
- sizeof(*sa) + strlen(sa->sun_path));
- } while (rv == -1 && errno == EINTR);
-
- if ((rv == -1) && (errno == EINPROGRESS || errno == EALREADY)
- && (t > 0)) {
-#if APR_MAJOR_VERSION < 2
- rv = apr_wait_for_io_or_timeout(NULL, sock, 0);
-#else
- rv = apr_socket_wait(sock, APR_WAIT_WRITE);
-#endif
-
- if (rv != APR_SUCCESS) {
- return rv;
- }
- }
-
- if (rv == -1 && errno != EISCONN) {
- return errno;
- }
-
- return APR_SUCCESS;
-}
-
static apr_status_t get_socket_from_path(apr_pool_t *p,
const char* path,
apr_socket_t **out_sock)
{
- struct sockaddr_un sa;
apr_socket_t *s;
apr_status_t rv;
*out_sock = NULL;
@@ -112,10 +62,7 @@ static apr_status_t get_socket_from_path(apr_pool_t *p,
return rv;
}
- sa.sun_family = AF_UNIX;
- apr_cpystrn(sa.sun_path, path, sizeof(sa.sun_path));
-
- rv = socket_connect_un(s, &sa);
+ rv = ap_proxy_connect_uds(s, path, p);
if (rv != APR_SUCCESS) {
return rv;
}