[multiple] use sock_addr_get_family in more places

personal/stbuehler/tests-path
Glenn Strauss 2020-09-29 14:32:53 -04:00
parent 86e5f09062
commit 8b382a81c7
5 changed files with 6 additions and 6 deletions

View File

@ -137,7 +137,7 @@ static void connection_read_for_eos_plain(connection * const con) {
* it will make the client not see all our output.
*/
ssize_t len;
const int type = con->dst_addr.plain.sa_family;
const int type = sock_addr_get_family(&con->dst_addr);
char buf[16384];
do {
len = fdevent_socket_read_discard(con->fd, buf, sizeof(buf),

View File

@ -1685,7 +1685,7 @@ int http_cgi_headers (request_st * const r, http_cgi_opts * const opts, http_cgi
rc |= cb(vdata, CONST_STR_LEN("SERVER_PORT"),
buf, li_utostrn(buf,sizeof(buf),sock_addr_get_port(addr)));
switch (addr->plain.sa_family) {
switch (sock_addr_get_family(addr)) {
case AF_INET:
case AF_INET6:
if (sock_addr_is_addr_wildcard(addr)) {

View File

@ -1719,8 +1719,8 @@ static int mod_extforward_network_read (connection *con,
union hap_PROXY_hdr hdr;
log_error_st *errh;
int rc = hap_PROXY_recv(con->fd, &hdr,
con->dst_addr.plain.sa_family, SOCK_STREAM);
const int family = sock_addr_get_family(&con->dst_addr);
int rc = hap_PROXY_recv(con->fd, &hdr, family, SOCK_STREAM);
switch (rc) {
case 2: rc = mod_extforward_hap_PROXY_v2(con, &hdr); break;
case 1: rc = mod_extforward_hap_PROXY_v1(con, &hdr); break;

View File

@ -512,7 +512,7 @@ static buffer *magnet_env_get_buffer_by_id(request_st * const r, int id) {
const server_socket * const srv_socket = r->con->srv_socket;
dest = r->tmp_buf;
buffer_clear(dest);
switch (srv_socket->addr.plain.sa_family) {
switch (sock_addr_get_family(&srv_socket->addr)) {
case AF_INET:
case AF_INET6:
if (sock_addr_is_addr_wildcard(&srv_socket->addr)) {

View File

@ -423,7 +423,7 @@ REQUEST_FUNC(mod_maxminddb_request_env_handler)
{
connection * const con = r->con;
const sock_addr * const dst_addr = &con->dst_addr;
const int sa_family = dst_addr->plain.sa_family;
const int sa_family = sock_addr_get_family(dst_addr);
if (sa_family != AF_INET && sa_family != AF_INET6) return HANDLER_GO_ON;
plugin_config pconf;