You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1996/09/10 14:02:41 UTC

deny from user-agents

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;