httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/t params.c
Date Sun, 18 Jul 2004 20:41:51 GMT
joes        2004/07/18 13:41:51

  Modified:    src      apreq.c
               t        params.c
  Log:
  Not all tokens are alnums, so we check the token list from rfc2616 section 2.2 instead.
  
  Revision  Changes    Path
  1.46      +17 -6     httpd-apreq-2/src/apreq.c
  
  Index: apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- apreq.c	18 Jul 2004 19:45:21 -0000	1.45
  +++ apreq.c	18 Jul 2004 20:41:51 -0000	1.46
  @@ -828,14 +828,25 @@
           }
   
    finish:
  -        if (strncasecmp(key, name, nlen) == 0 
  -            && (key == hdr || !apr_isalnum(key[-1])))
  -        {
  +        if (strncasecmp(key, name, nlen) == 0) {
               *vlen = v - *val;
  -            return APR_SUCCESS;
  +            if (key > hdr) {
  +                /* ensure preceding character isn't a token, per rfc2616, s2.2 */
  +                switch (key[-1]) {
  +                case '(': case ')': case '<': case '>': case '@':
  +                case ',': case ';': case ':': case '\\': case '"':
  +                case '/': case '[': case ']': case '?': case '=':
  +                case '{': case '}': case ' ': case '\t':
  +                    return APR_SUCCESS;
  +                default:
  +                    if (apr_iscntrl(key[-1]))
  +                        return APR_SUCCESS;
  +                }
  +            }
  +            else
  +                return APR_SUCCESS;
           }
  -        else
  -            hdr = v;
  +        hdr = v;
       }
   
       return APR_NOTFOUND;
  
  
  
  1.20      +3 -0      httpd-apreq-2/t/params.c
  
  Index: params.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/t/params.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- params.c	18 Jul 2004 19:45:21 -0000	1.19
  +++ params.c	18 Jul 2004 20:41:51 -0000	1.20
  @@ -119,6 +119,9 @@
       CuAssertIntEquals(tc, 2, vlen);
       CuAssertStrNEquals(tc, "20", val, 2);
   
  +    s = apreq_header_attribute(hdr, "age", 3, &val, &vlen);
  +    CuAssertIntEquals(tc, APR_EGENERAL, s);
  +
       s = apreq_header_attribute(hdr, "no-quote", 8, &val, &vlen);
       CuAssertIntEquals(tc, APR_EGENERAL, s);
   
  
  
  

Mime
View raw message