{
apr_status_t rv;
int i;
+ apr_sockaddr_t *destsa;
- for (i = 0; host[i] != '\0'; i++)
- if (!apr_isdigit(host[i]) && host[i] != '.')
- break;
-
- apr_set_port(sock, APR_REMOTE, port);
- if (host[i] == '\0') {
- apr_set_ipaddr(sock, APR_REMOTE, host);
- host = NULL;
+ rv = apr_getaddrinfo(&destsa, host, AF_INET, port, r->pool);
+ if (rv == APR_SUCCESS) {
+ rv = apr_connect(sock, destsa);
}
-
- do
- {
- rv = apr_connect(sock, host);
- } while (APR_STATUS_IS_EINTR(rv));
-
if (rv != APR_SUCCESS)
{
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"proxy connect to %s port %d failed", host, port);
}
return rv;
/* bind_connect - bind both ends of a socket */
/* Ambarish fix this. Very broken */
-static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
- const char *rmt_ip,
+static int get_rfc1413(apr_socket_t *sock, apr_pool_t *p,
+ const char *local_ip, const char *rmt_ip,
char user[RFC1413_USERLEN+1], server_rec *srv)
{
apr_port_t rmt_port, our_port;
char *cp;
char buffer[RFC1413_MAXDATA + 1];
int buflen;
+ apr_sockaddr_t *destsa;
/*
* Bind the local and remote ends of the query socket to the same
return -1;
}
+ if ((status = apr_getaddrinfo(&destsa, rmt_ip, AF_INET, RFC1413_PORT, 0,
+ p)) != APR_SUCCESS) {
+ /* This should not fail since we have a numeric address string
+ * as the host. */
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
+ "rfc1413: apr_getaddrinfo() failed");
+ return -1;
+ }
/*
* errors from connect usually imply the remote machine doesn't support
* the service
*/
- apr_set_port(sock, APR_REMOTE, RFC1413_PORT);
- apr_set_ipaddr(sock, APR_REMOTE, rmt_ip);
-
- if (apr_connect(sock, NULL) != APR_SUCCESS)
+ if (apr_connect(sock, destsa) != APR_SUCCESS)
return -1;
apr_get_port(&sav_our_port, APR_LOCAL, sock);
apr_get_port(&sav_rmt_port, APR_REMOTE, sock);
conn->remote_logname = result;
}
- if (get_rfc1413(sock, conn->local_ip, conn->remote_ip, user, srv) >= 0)
+ if (get_rfc1413(sock, conn->pool, conn->local_ip, conn->remote_ip, user, srv) >= 0)
result = user;
apr_close_socket(sock);
conn->remote_logname = result;
static void start_connect(struct connection *c)
{
apr_status_t rv;
+ apr_sockaddr_t *destsa;
if(!(started < requests)) return;
c->cbx = 0;
c->gotheader = 0;
+ if ((rv = apr_getaddrinfo(&destsa, hostname, AF_INET, port, 0, cntxt))
+ != APR_SUCCESS) {
+ apr_err("apr_getaddrinfo()", rv);
+ }
if ((rv = apr_create_tcp_socket(&c->aprsock, cntxt)) != APR_SUCCESS) {
apr_err("Socket:", rv);
}
- if ((rv = apr_set_port(c->aprsock, APR_REMOTE, port)) != APR_SUCCESS) {
- apr_err("Port:", rv);
- }
c->start = apr_now();
- if ((rv = apr_connect(c->aprsock, hostname)) != APR_SUCCESS) {
+ if ((rv = apr_connect(c->aprsock, destsa)) != APR_SUCCESS) {
if (APR_STATUS_IS_EINPROGRESS(rv)) {
c->state = STATE_CONNECTING;
apr_add_poll_socket(readbits, c->aprsock, APR_POLLOUT);
static void copyright(void)
{
if (!use_html) {
- printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.32 $> apache-2.0");
+ printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.33 $> apache-2.0");
printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
printf("\n");
}
else {
printf("<p>\n");
- printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.32 $");
+ printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.33 $");
printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n");
apr_fprintf
apr_full_read
apr_full_write
+apr_getaddrinfo
apr_get_dir_filename
apr_get_filedata
apr_get_hostname