You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2010/09/16 08:39:19 UTC

Re: svn commit: r997553 - /httpd/httpd/trunk/modules/mappers/mod_rewrite.c


On 09/16/2010 02:54 AM, wrowe@apache.org wrote:
> Author: wrowe
> Date: Thu Sep 16 00:54:58 2010
> New Revision: 997553
> 
> URL: http://svn.apache.org/viewvc?rev=997553&view=rev
> Log:
> *) Accept modern bash test conventions of -h or -L for testing symlinks
>    (for another patch against -l yet-to-come)
> 
> *) Introduce >= and <= syntax for greater-or-equal, or less-or-equal
>    string comparisons
> 
> *) Respect [NC] conventions for >[=]/<[=] string comparison, which is
>    horribly sensitive to the current charset.
> 
> Modified:
>     httpd/httpd/trunk/modules/mappers/mod_rewrite.c
> 
> Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=997553&r1=997552&r2=997553&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu Sep 16 00:54:58 2010
> @@ -260,9 +260,11 @@ typedef enum {
>      CONDPAT_FILE_XBIT,
>      CONDPAT_LU_URL,
>      CONDPAT_LU_FILE,
> -    CONDPAT_STR_GT,
>      CONDPAT_STR_LT,
> -    CONDPAT_STR_EQ
> +    CONDPAT_STR_LE,
> +    CONDPAT_STR_EQ,
> +    CONDPAT_STR_GT,
> +    CONDPAT_STR_GE
>  } pattern_type;
>  
>  typedef struct {
> @@ -3173,17 +3175,28 @@ static const char *cmd_rewritecond(cmd_p
>              switch (a2[1]) {
>              case 'f': newcond->ptype = CONDPAT_FILE_EXISTS; break;
>              case 's': newcond->ptype = CONDPAT_FILE_SIZE;   break;
> -            case 'l': newcond->ptype = CONDPAT_FILE_LINK;   break;
>              case 'd': newcond->ptype = CONDPAT_FILE_DIR;    break;
> +            case 'l': newcond->ptype = CONDPAT_FILE_LINK;   break;
>              case 'x': newcond->ptype = CONDPAT_FILE_XBIT;   break;
> +            case 'h': newcond->ptype = CONDPAT_FILE_LINK;   break;
> +            case 'L': newcond->ptype = CONDPAT_FILE_LINK;   break;
>              case 'U': newcond->ptype = CONDPAT_LU_URL;      break;
>              case 'F': newcond->ptype = CONDPAT_LU_FILE;     break;
>              }
>          }
>          else {
>              switch (*a2) {
> -            case '>': newcond->ptype = CONDPAT_STR_GT; break;
> -            case '<': newcond->ptype = CONDPAT_STR_LT; break;
> +            case '>': if (a2[1] == '=')
> +                          ++a2, newcond->ptype = CONDPAT_STR_GE;
> +                      else
> +                          ++a2, newcond->ptype = CONDPAT_STR_GT;

Why ++a2 here? The operator '>' is only one char.

> +                      break;
> +            case '<': newcond->ptype = CONDPAT_STR_LT;
> +                      if (a2[1] == '=')
> +                          ++a2, newcond->ptype = CONDPAT_STR_LE;
> +                      else
> +                          ++a2, newcond->ptype = CONDPAT_STR_LT;

Why ++a2 here? The operator '>' is only one char.


> +                      break;
>              case '=': newcond->ptype = CONDPAT_STR_EQ;
>                  /* "" represents an empty string */
>                  if (*++a2 == '"' && a2[1] == '"' && !a2[2]) {


Regards

RĂ¼diger