Skip to content

Commit

Permalink
mod_proxy: Follow up to r1918412: Find if one of the conn->addr[->nex…
Browse files Browse the repository at this point in the history
…t] is alive.

ap_proxy_connect_backend() will use the first conn->addr[->next] that works, so
the current address alive can be any of them.

* modules/proxy/proxy_util.c(ap_proxy_determine_address):
  Loop for all conn->addr[->next] to determine if addr_alive.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918429 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ylavic committed Jun 19, 2024
1 parent 9b8546a commit f625b68
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/proxy/proxy_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3022,8 +3022,18 @@ PROXY_DECLARE(apr_status_t) ap_proxy_determine_address(const char *proxy_functio
proxy_addrs_equal(conn->addr, address->addr));
if (conn_alive) {
apr_sockaddr_t *remote_addr = NULL;
/* apr_socket_connect() in ap_proxy_connect_backend() will
* do a simple pointer copy of its given conn->addr[->next]
* so the current conn->addr is alive iif sock->remote_addr
* is one of the conn->addr[->next].
*/
apr_socket_addr_get(&remote_addr, APR_REMOTE, conn->sock);
addr_alive = (conn->addr == remote_addr);
for (addr = conn->addr; addr; addr = addr->next) {
if (addr == remote_addr) {
addr_alive = 1;
break;
}
}
}
else if (conn->sock && (r ? APLOGrdebug(r) : APLOGdebug(s))) {
apr_sockaddr_t *local_addr = NULL;
Expand Down

0 comments on commit f625b68

Please sign in to comment.