Changeset 312

Show
Ignore:
Timestamp:
04/28/2005 01:04:42 PM (3 years ago)
Author:
jan
Message:

allow numbers in the header names

Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/mod_cgi.c

    r295 r312  
    943943                                 
    944944                                for (j = 0; j < ds->key->used - 1; j++) { 
    945                                         p->tmp_buf->ptr[p->tmp_buf->used++] =  
    946                                                 isalpha((unsigned char)ds->key->ptr[j]) ?  
    947                                                 toupper((unsigned char)ds->key->ptr[j]) : '_'; 
     945                                        char cr = '_'; 
     946                                        if (light_isalpha(ds->key->ptr[j])) { 
     947                                                /* upper-case */ 
     948                                                cr = ds->key->ptr[j] & ~32; 
     949                                        } else if (light_isdigit(ds->key->ptr[j])) { 
     950                                                /* copy */ 
     951                                                cr = ds->key->ptr[j]; 
     952                                        } 
     953                                        p->tmp_buf->ptr[p->tmp_buf->used++] = cr; 
    948954                                } 
    949955                                p->tmp_buf->ptr[p->tmp_buf->used++] = '\0'; 
  • trunk/src/mod_fastcgi.c

    r310 r312  
    15321532                        buffer_prepare_append(srv->tmp_buf, ds->key->used + 2); 
    15331533                        for (j = 0; j < ds->key->used - 1; j++) { 
    1534                                 srv->tmp_buf->ptr[srv->tmp_buf->used++] =  
    1535                                         light_isalpha(ds->key->ptr[j]) ?  
    1536                                         ds->key->ptr[j] & ~32 : '_'; 
     1534                                char c = '_'; 
     1535                                if (light_isalpha(ds->key->ptr[j])) { 
     1536                                        /* upper-case */ 
     1537                                        c = ds->key->ptr[j] & ~32; 
     1538                                } else if (light_isdigit(ds->key->ptr[j])) { 
     1539                                        /* copy */ 
     1540                                        c = ds->key->ptr[j]; 
     1541                                } 
     1542                                srv->tmp_buf->ptr[srv->tmp_buf->used++] = c; 
    15371543                        } 
    15381544                        srv->tmp_buf->ptr[srv->tmp_buf->used++] = '\0'; 
  • trunk/src/mod_ssi.c

    r295 r312  
    174174                        buffer_prepare_append(srv->tmp_buf, ds->key->used + 2); 
    175175                        for (j = 0; j < ds->key->used - 1; j++) { 
    176                                 srv->tmp_buf->ptr[srv->tmp_buf->used++] =  
    177                                         isalpha((unsigned char)ds->key->ptr[j]) ?  
    178                                         toupper((unsigned char)ds->key->ptr[j]) : '_'; 
     176                                char c = '_'; 
     177                                if (light_isalpha(ds->key->ptr[j])) { 
     178                                        /* upper-case */ 
     179                                        c = ds->key->ptr[j] & ~32; 
     180                                } else if (light_isdigit(ds->key->ptr[j])) { 
     181                                        /* copy */ 
     182                                        c = ds->key->ptr[j]; 
     183                                } 
     184                                srv->tmp_buf->ptr[srv->tmp_buf->used++] = c; 
    179185                        } 
    180186                        srv->tmp_buf->ptr[srv->tmp_buf->used] = '\0'; 
  • trunk/tests/mod-cgi.t

    r111 r312  
    33use strict; 
    44use IO::Socket; 
    5 use Test::More tests => 9; 
     5use Test::More tests => 10; 
    66 
    77my $basedir = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'} : '..'); 
     
    234234 
    235235@request  = ( <<EOF 
     236GET /get-header.pl?HTTP_XX_YY123 HTTP/1.0 
     237xx-yy123: foo 
     238EOF 
     239 ); 
     240@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ); 
     241ok(handle_http == 0, 'cgi-env: quoting headers with numbers'); 
     242 
     243@request  = ( <<EOF 
    236244GET /get-header.pl?HTTP_HOST HTTP/1.0 
    237245Host: www.example.org