You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@hotwired.com> on 1996/10/22 10:13:35 UTC
get_remote_name performance tweak
Below is a patch (against 1.1.1) that adds another type to get_remote_name --
REMOTE_NOLOOKUP. This skips the lookup and returns the name/ip that is
known already. This is then used in update_child_status so that no
DNS lookups are forced for the status page.
On its own, this patch really doesn't do anything :)
So why am I submitting it? It allows the creative hacker to
set up their server to do reverse dns on some hits but not others.
I imagine something like this would do the trick in 1.2:
HostnameLookups On
<Files \.(gif|jpeg)$>
HostnameLookups Off
</Files>
Dean
P.S. differences are against hotwired's cvs repository, not apache's.
Index: http_core.c
===================================================================
RCS file: /hot/repository/apache/src/http_core.c,v
retrieving revision 1.3
diff -u -r1.3 http_core.c
--- http_core.c 1996/07/25 05:14:26 1.3
+++ http_core.c 1996/10/22 07:29:16
@@ -271,7 +271,7 @@
/* If we haven't checked the host name, and we want to */
dir_conf = (core_dir_config *)get_module_config(dir_config, &core_module);
- if (conn->remote_host == NULL && dir_conf->hostname_lookups)
+ if (type != REMOTE_NOLOOKUP && conn->remote_host == NULL && dir_conf->hostname_lookups)
{
#ifdef STATUS
int old_stat = update_child_status(conn->child_num,
Index: http_core.h
===================================================================
RCS file: /hot/repository/apache/src/http_core.h,v
retrieving revision 1.2
diff -u -r1.2 http_core.h
--- http_core.h 1996/07/06 00:14:45 1.2
+++ http_core.h 1996/10/22 07:28:24
@@ -78,6 +78,7 @@
/* options for get_remote_host() */
#define REMOTE_HOST (0)
#define REMOTE_NAME (1)
+#define REMOTE_NOLOOKUP (2)
int allow_options (request_rec *);
int allow_overrides (request_rec *);
Index: http_main.c
===================================================================
RCS file: /hot/repository/apache/src/http_main.c,v
retrieving revision 1.21
diff -u -r1.21 http_main.c
--- http_main.c 1996/09/18 20:34:24 1.21
+++ http_main.c 1996/10/22 07:29:59
@@ -703,7 +703,7 @@
conn_rec *c = r->connection;
slot_size = sizeof(new_score_rec.client) - 1;
strncpy(new_score_rec.client, get_remote_host(c, r->per_dir_config,
- REMOTE_NAME), slot_size);
+ REMOTE_NOLOOKUP), slot_size);
new_score_rec.client[slot_size] = '\0';
slot_size = sizeof(new_score_rec.request) - 1;
strncpy(new_score_rec.request, (r->the_request ? r->the_request :
Re: get_remote_name performance tweak
Posted by Brian Behlendorf <br...@organic.com>.
On Tue, 22 Oct 1996, James H. Cloos Jr. wrote:
> Brian> This got 3 +1 votes and has been committed. Is there anything
> Brian> else that needs to be done to facilitate the above
> Brian> functionality in the config files?
>
> In this vein, would it now be reasonable to make HostnameLookups
> something other than ACCESS_CONF|RSRC_CONF, such as perhaps
> OR_OPTIONS?
>
> The general idea being that it would be useful to be able to allow
> clueful users to get lookups for their CGIs w/o requiring lookups on
> every hit.
+1.
Brian
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com www.apache.org hyperreal.com http://www.organic.com/JOBS
Re: get_remote_name performance tweak
Posted by "James H. Cloos Jr." <cl...@jhcloos.com>.
Brian> This got 3 +1 votes and has been committed. Is there anything
Brian> else that needs to be done to facilitate the above
Brian> functionality in the config files?
In this vein, would it now be reasonable to make HostnameLookups
something other than ACCESS_CONF|RSRC_CONF, such as perhaps
OR_OPTIONS?
The general idea being that it would be useful to be able to allow
clueful users to get lookups for their CGIs w/o requiring lookups on
every hit.
-JimC
--
James H. Cloos, Jr. <URL:http://www.jhcloos.com/~cloos/>
cloos@jhcloos.com Work: cloos@io.com
LPF,Usenix,SAGE,ISOC,ACLU FB C2 B3 7A 50 44 AE 2D C7 4C 1E C1 EF 7A FB 30
Re: get_remote_name performance tweak
Posted by Brian Behlendorf <br...@organic.com>.
On Tue, 22 Oct 1996, Dean Gaudet wrote:
> Below is a patch (against 1.1.1) that adds another type to get_remote_name --
> REMOTE_NOLOOKUP. This skips the lookup and returns the name/ip that is
> known already. This is then used in update_child_status so that no
> DNS lookups are forced for the status page.
>
> On its own, this patch really doesn't do anything :)
> So why am I submitting it? It allows the creative hacker to
> set up their server to do reverse dns on some hits but not others.
>
> I imagine something like this would do the trick in 1.2:
>
> HostnameLookups On
> <Files \.(gif|jpeg)$>
> HostnameLookups Off
> </Files>
>
> Dean
This got 3 +1 votes and has been committed. Is there anything else that needs
to be done to facilitate the above functionality in the config files?
Brian
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com www.apache.org hyperreal.com http://www.organic.com/JOBS
Re: get_remote_name performance tweak
Posted by Mark J Cox <ma...@ukweb.com>.
On Tue, 22 Oct 1996, Dean Gaudet wrote:
> REMOTE_NOLOOKUP. This skips the lookup and returns the name/ip that is
> known already. This is then used in update_child_status so that no
> DNS lookups are forced for the status page.
+1 on this; also useful when you have one virt host that has lookups and
one that doesn't.
I've also got a patch (wrote it a long time ago) to the status module
which shows which vhost is being served (something that is missing and
fairly essential). I'll apply it later.
Mark