httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@organic.com>
Subject Re: deny user-agents
Date Sun, 22 Sep 1996 23:33:52 GMT

I don't know if this has been committed yet or not, but I have a complaint from
a keep-the-config-file-manageable perspective:  why can't we keep all
browser-string-matching stuff tied to the BrowserMatch directive?  What other
request conditions tests will be added to "deny from"?

Here's a thought.  Right now our config file syntax has two types of lines;
directives, and containers.  The containers are meant to be groups of
directives that apply given a particular condition - be it the www host
requested (<VirtualHost>), the directory desired (<Directory>), even the URL
path (<Location>).  What about <Browser>?  At a higher level, should we be
trying to delineate in config files between "statement directives", like the
Listen directive, and "conditions"?  Hmm.  Needs more thought, feels like 2.0
stuff maybe, but back to the point, I'd like to see if there's a way we can
answer this with today's directives rather than implementing new ones (and a
pseudo-directive keyword at that!).  

	Catching up, Brian

On Tue, 17 Sep 1996, Rob Hartill wrote:
> 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)
> 
> 

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS


Mime
View raw message