httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject Re: deny user-agents
Date Tue, 17 Sep 1996 19:51:49 GMT

I asked:
> Can someone say nice things about my "user-agents" patch of a few
> days back so that it can be committed. 

I've seen two other +1s, so with my +1 that's enough to get it
added.

Comment: using "user-agents" in a access.conf or .htaccess "deny" directive
         line makes the remainder of the line be treated as a list of USER
	 AGENTS that are to be denied.
         e.g.  deny from foo.bar.com user-agents BadRobot/2.2 WorseBrowser/0.4


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


*** mod_access.c.orig	Tue Sep 10 12:11:48 1996
--- mod_access.c	Tue Sep 10 13:11:34 1996
***************
*** 178,183 ****
--- 178,194 ----
      for (i = 0; i < a->nelts; ++i) {
          if (!(mmask & ap[i].limited))
  	    continue;
+         if (ap[i].from && !strcmp(ap[i].from, "user-agents")) {
+            char * this_agent = table_get(r->headers_in, "User-Agent");
+ 	   int j;
+ 
+            if (!this_agent) return 0;
+ 
+            for (j = i+1; j < a->nelts; ++j) {
+               if (strstr(this_agent, ap[j].from)) return 1;
+            }
+            return 0;
+         }
  	if (!strcmp (ap[i].from, "all"))
  	    return 1;
  	if (!gothost)

Mime
View raw message