httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Thu, 24 Jul 2003 23:10:29 GMT
nd          2003/07/24 16:10:29

  Modified:    modules/mappers mod_rewrite.c
  Log:
  remove more unnecessary strlen() operations
  
  Revision  Changes    Path
  1.176     +10 -16    httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.175
  retrieving revision 1.176
  diff -u -r1.175 -r1.176
  --- mod_rewrite.c	24 Jul 2003 22:48:17 -0000	1.175
  +++ mod_rewrite.c	24 Jul 2003 23:10:29 -0000	1.176
  @@ -1179,9 +1179,9 @@
   
       if (rulestatus) {
           unsigned skip;
  +        apr_size_t flen = strlen(r->filename);
   
  -        if (strlen(r->filename) > 6 &&
  -            strncmp(r->filename, "proxy:", 6) == 0) {
  +        if (flen > 6 && strncmp(r->filename, "proxy:", 6) == 0) {
               /* it should be go on as an internal proxy request */
   
               /* check if the proxy module is enabled, so
  @@ -1249,18 +1249,15 @@
               rewritelog(r, 1, "redirect to %s [REDIRECT/%d]", r->filename, n);
               return n;
           }
  -        else if (strlen(r->filename) > 10 &&
  -                 strncmp(r->filename, "forbidden:", 10) == 0) {
  +        else if (flen > 10 && strncmp(r->filename, "forbidden:", 10) == 0)
{
               /* This URLs is forced to be forbidden for the requester */
               return HTTP_FORBIDDEN;
           }
  -        else if (strlen(r->filename) > 5 &&
  -                 strncmp(r->filename, "gone:", 5) == 0) {
  +        else if (flen > 5 && strncmp(r->filename, "gone:", 5) == 0) {
               /* This URLs is forced to be gone */
               return HTTP_GONE;
           }
  -        else if (strlen(r->filename) > 12 &&
  -                 strncmp(r->filename, "passthrough:", 12) == 0) {
  +        else if (flen > 12 && strncmp(r->filename, "passthrough:", 12) ==
0) {
               /*
                * Hack because of underpowered API: passing the current
                * rewritten filename through to other URL-to-filename handlers
  @@ -1451,9 +1448,9 @@
       rulestatus = apply_rewrite_list(r, dconf->rewriterules, dconf->directory);
       if (rulestatus) {
           unsigned skip;
  +        l = strlen(r->filename);
   
  -        if (strlen(r->filename) > 6 &&
  -            strncmp(r->filename, "proxy:", 6) == 0) {
  +        if (l > 6 && strncmp(r->filename, "proxy:", 6) == 0) {
               /* it should go on as an internal proxy request */
   
               /* make sure the QUERY_STRING and
  @@ -1557,13 +1554,11 @@
                          dconf->directory, r->filename, n);
               return n;
           }
  -        else if (strlen(r->filename) > 10 &&
  -                 strncmp(r->filename, "forbidden:", 10) == 0) {
  +        else if (l > 10 && strncmp(r->filename, "forbidden:", 10) == 0) {
               /* This URL is forced to be forbidden for the requester */
               return HTTP_FORBIDDEN;
           }
  -        else if (strlen(r->filename) > 5 &&
  -                 strncmp(r->filename, "gone:", 5) == 0) {
  +        else if (l > 5 && strncmp(r->filename, "gone:", 5) == 0) {
               /* This URL is forced to be gone */
               return HTTP_GONE;
           }
  @@ -1574,8 +1569,7 @@
                * context we just ignore it. It is only useful
                * in per-server context
                */
  -            if (strlen(r->filename) > 12 &&
  -                strncmp(r->filename, "passthrough:", 12) == 0) {
  +            if (l > 12 && strncmp(r->filename, "passthrough:", 12) == 0)
{
                   r->filename = apr_pstrdup(r->pool, r->filename+12);
               }
   
  
  
  

Mime
View raw message