httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject deny from user-agents
Date Tue, 10 Sep 1996 12:02:41 GMT

For want of something better, I offer this patch to keep out junk
clients.

usage example:

  order allow,deny
  allow from all
  deny from user-agents MS-Catapult/0.9 dumb-robot/1.2


-=-=-=-=-=-=-=-=-


*** mod_access.c.orig	Tue Sep 10 12:31:48 1996
--- mod_access.c	Tue Sep 10 13:00:13 1996
***************
*** 175,180 ****
--- 175,190 ----
      int i, gothost=0;
      const char *remotehost=NULL;
  
+     if (ap[0].from && !strcmp(ap[0].from, "user-agents")) {
+        char * this_agent = table_get(r->headers_in, "User-Agent");
+        if (!this_agent) return 0;
+ 
+        for (i = 1; i < a->nelts; ++i) {
+          if (strstr(this_agent, ap[i].from)) return 1;
+        }
+        return 0;
+     }
+ 
      for (i = 0; i < a->nelts; ++i) {
          if (!(mmask & ap[i].limited))
  	    continue;

Mime
View raw message