Browse Source

[multiple] use sock_addr_get_family in more places

master
Glenn Strauss 9 months ago
parent
commit
8b382a81c7
  1. 2
      src/connections.c
  2. 2
      src/http-header-glue.c
  3. 4
      src/mod_extforward.c
  4. 2
      src/mod_magnet.c
  5. 2
      src/mod_maxminddb.c

2
src/connections.c

@ -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),

2
src/http-header-glue.c

@ -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)) {

4
src/mod_extforward.c

@ -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;

2
src/mod_magnet.c

@ -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)) {

2
src/mod_maxminddb.c

@ -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;

Loading…
Cancel
Save