httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <dr...@jetnet.co.uk>
Subject APR'ize code...
Date Fri, 10 Nov 2000 18:48:36 GMT
This code needs to be changed to use apr functions.  It's quite apache
specific so I'm not sure it belongs in APR, but I don't think we have the
functions in APR to let us apr'ize it at the moment...

Basically I'm looking at removing the sockaddr's from the conn_rec as they
shouldn't be there in a multi-protocol system and they are duplicates of
what is in the socket structure anyway.  This function will be one of the
stumbling blocks...

Any ideas?

david

/* Code from Harald Hanche-Olsen <hanche@imf.unit.no> */
static apr_inline void do_double_reverse (conn_rec *conn)
{
    struct hostent *hptr;

    if (conn->double_reverse) {
	/* already done */
	return;
    }
    if (conn->remote_host == NULL || conn->remote_host[0] == '\0') {
	/* single reverse failed, so don't bother */
	conn->double_reverse = -1;
	return;
    }
    hptr = gethostbyname(conn->remote_host);
    if (hptr)

	char **haddr;

	for (haddr = hptr->h_addr_list; *haddr; haddr++) {
	    if (((struct in_addr *)(*haddr))->s_addr
		== conn->remote_addr.sin_addr.s_addr) {
		conn->double_reverse = 1;
		return;
	    }
	}
    }
    conn->double_reverse = -1;
}



Mime
View raw message