httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: Too soon for 1.2 commits ??
Date Wed, 10 Jul 1996 08:38:22 GMT
Michael Douglass wrote:
> 
> On Tue, 9 Jul 1996, Rob Hartill wrote:
> 
> > if anyone has spare apache time, could they look at making
> > RefererIgnore case insensitive.
> > 
> > You won't believe how many people type in URLs mIxInG.tHe.CaSe
> 
> here's a simple one:
> 
> --- mod_log_referer.c	1996/07/09 21:47:52	1.1
> +++ mod_log_referer.c	1996/07/09 21:51:50
> @@ -162,6 +162,22 @@
>      for (; s; s = s->next) open_referer_log (s, p);
>  }
>  
> +char *strcasestr( pool *p, char *str1, char *str2 )
> +{
> +    char *s1, *s2, *ptr;
> +
> +    s1 = pstrdup( p, str1 );
> +    s2 = pstrdup( p, str2 );
> +
> +    for( ptr = s1; *ptr; ptr++ )
> +      *ptr = tolower( *ptr );
> +
> +    for( ptr = s2; *ptr; ptr++ )
> +      *ptr = tolower( *ptr );
> +
> +    return ( strstr( s1, s2 ) );
> +}
> +
>  int referer_log_transaction(request_rec *orig)
>  {
>      char **ptrptr, **ptrptr2;
> @@ -200,7 +216,7 @@
>  	      ptrptr < ptrptr2;
>  	      ptrptr = (char **)((char *)ptrptr + cls->referer_ignore_list->elt_size))

>  	    {
> -		if(strstr(referer, *ptrptr))
> +		if(strcasestr(orig->pool, referer, *ptrptr))
>  		  return OK;
>  	    }
>  	  

Ugg. That's horribly inefficient.

Cheers,

Ben.

> 
> Michael Douglass
> Texas Networking, Inc.
> 
>   "To be a saint is to be an exception; to be a true man is the rule.
>    Err, fail, sin if you must, but be upright.  To sin as little as
>    possible is the law for men; to sin not at all is a dream for angels."
> 
>               - Victor Hugo, "Les Miserables"
> 

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message