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/src apreq_cookie.c
Date Sun, 13 Jul 2003 17:54:59 GMT
joes        2003/07/13 10:54:59

  Modified:    glue/perl/t/apreq cookie.t
               glue/perl/t/response/TestApReq cookie.pm
               glue/perl/xsbuilder/Apache/Cookie Cookie_pm
               glue/perl/xsbuilder/maps apreq_functions.map
               src      apreq_cookie.c
  Log:
  Fix some parsing bugs in apreq_cookie_attr, fix segfault in apreq_xs_cookie_bake, and add
some bake(2) tests to perl glue.
  
  Revision  Changes    Path
  1.5       +21 -2     httpd-apreq-2/glue/perl/t/apreq/cookie.t
  
  Index: cookie.t
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/apreq/cookie.t,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- cookie.t	13 Jul 2003 05:03:49 -0000	1.4
  +++ cookie.t	13 Jul 2003 17:54:59 -0000	1.5
  @@ -4,10 +4,10 @@
   use Apache::Test;
   
   use Apache::TestUtil;
  -use Apache::TestRequest qw(GET_BODY);
  +use Apache::TestRequest qw(GET_BODY GET_HEAD);
   use HTTP::Cookies;
   
  -plan tests => 3;
  +plan tests => 5;
   
   my $location = "/TestApReq__cookie";
   
  @@ -38,4 +38,23 @@
       ok t_cmp($value,
                GET_BODY("$location?test=$test&key=$key", Cookie => $cookie),
                $test);
  +}
  +{
  +    my $test  = 'bake';
  +    my $key   = 'apache';
  +    my $value = 'ok';
  +    my $cookie = "$key=$value";
  +    my ($header) = GET_HEAD("$location?test=$test&key=$key", 
  +                            Cookie => $cookie) =~ /^#Set-Cookie:\s+(.+)/m;
  +
  +    ok t_cmp($cookie, $header, $test);
  +}
  +{
  +    my $test  = 'bake2';
  +    my $key   = 'apache';
  +    my $value = 'ok';
  +    my $cookie = qq{\$Version="1"; $key="$value"; \$Path="$location"};
  +    my ($header) = GET_HEAD("$location?test=$test&key=$key", 
  +                            Cookie => $cookie) =~ /^#Set-Cookie2:\s+(.+)/m;
  +    ok t_cmp(qq{$key="$value"; Version=1; path="$location"}, $header, $test);
   }
  
  
  
  1.5       +7 -0      httpd-apreq-2/glue/perl/t/response/TestApReq/cookie.pm
  
  Index: cookie.pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/response/TestApReq/cookie.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- cookie.pm	13 Jul 2003 05:03:49 -0000	1.4
  +++ cookie.pm	13 Jul 2003 17:54:59 -0000	1.5
  @@ -21,7 +21,14 @@
       my $test = $apr->param('test');
       my $key  = $apr->param('key');
   
  +
       if ($cookies{$key}) {
  +        if ($test eq "bake") {
  +            $cookies{$key}->bake;
  +        }
  +        elsif ($test eq "bake2") {
  +            $cookies{$key}->bake2;
  +        }
           $r->print($cookies{$key}->value);
       }
   
  
  
  
  1.9       +4 -2      httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm
  
  Index: Cookie_pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Cookie_pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Cookie_pm	13 Jul 2003 05:03:49 -0000	1.8
  +++ Cookie_pm	13 Jul 2003 17:54:59 -0000	1.9
  @@ -21,8 +21,10 @@
   
   sub new {
       my ($class, $env, %attrs) = @_;
  -    my $name  = delete $attrs{name}  || delete $attrs{-name};
  -    my $value = delete $attrs{value} || delete $attrs{-value};
  +    my $name  = delete $attrs{name};
  +    my $value = delete $attrs{value};
  +    $name     = delete $attrs{-name}  unless defined $name;
  +    $value    = delete $attrs{-value} unless defined $value;
       return unless defined $name and defined $value;
   
       my $cookie = $class->make($env, $name, $class->freeze($value));
  
  
  
  1.14      +2 -2      httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map
  
  Index: apreq_functions.map
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/maps/apreq_functions.map,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- apreq_functions.map	13 Jul 2003 05:03:49 -0000	1.13
  +++ apreq_functions.map	13 Jul 2003 17:54:59 -0000	1.14
  @@ -47,8 +47,8 @@
    DEFINE_decode     | apreq_xs_decode |
    const char *:DEFINE_name | apreq_cookie_name(c)  | apreq_cookie_t *:c
    const char *:DEFINE_raw_value| apreq_cookie_value(c) | apreq_cookie_t *:c
  - apr_status_t:DEFINE_bake | apreq_cookie_bake (apreq_xs_sv2cookie(c), apreq_xs_sv2env(c))
| SV *:c
  - apr_status_t:DEFINE_bake2| apreq_cookie_bake2(apreq_xs_sv2cookie(c), apreq_xs_sv2env(c))
| SV *:c
  + apr_status_t:DEFINE_bake | apreq_cookie_bake (apreq_xs_sv2cookie(c), apreq_xs_sv2env(SvRV(c)))
| SV *:c
  + apr_status_t:DEFINE_bake2| apreq_cookie_bake2(apreq_xs_sv2cookie(c), apreq_xs_sv2env(SvRV(c)))
| SV *:c
   
   MODULE=Apache::Cookie PACKAGE=Apache::Cookie::Jar PREFIX=Apache__Cookie__Jar_
    DEFINE_new        | apreq_xs_jar     |
  
  
  
  1.19      +7 -7      httpd-apreq-2/src/apreq_cookie.c
  
  Index: apreq_cookie.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_cookie.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- apreq_cookie.c	28 Jun 2003 17:51:38 -0000	1.18
  +++ apreq_cookie.c	13 Jul 2003 17:54:59 -0000	1.19
  @@ -158,29 +158,29 @@
       case 'p':
           if (alen != 4)
               break;
  -        if (!strcasecmp("port", attr)) {
  +        if (!strncasecmp("port", attr, 4)) {
               c->port = apr_pstrmemdup(p,val,vlen);
               return APR_SUCCESS;
           }
  -        else if (!strcasecmp("path", attr)) {
  +        else if (!strncasecmp("path", attr, 4)) {
               c->path = apr_pstrmemdup(p,val,vlen);
               return APR_SUCCESS;
           }
           break;
   
       case 'c':
  -        if (alen == 7 && !strcasecmp("comment", attr)) {
  -            c->comment = apr_pstrmemdup(p,val,vlen);
  +        if (!strncasecmp("commentURL", attr, 10)) {
  +            c->commentURL = apr_pstrmemdup(p,val,vlen);
               return APR_SUCCESS;
           } 
  -        else if (alen == 10 && !strcasecmp("commentURL", attr)) {
  -            c->commentURL = apr_pstrmemdup(p,val,vlen);
  +        else if (!strncasecmp("comment", attr, 7)) {
  +            c->comment = apr_pstrmemdup(p,val,vlen);
               return APR_SUCCESS;
           }
           break;
   
       case 's':
  -        c->secure = (alen == 2 && !strcasecmp(val,"on"));
  +        c->secure = (!strncasecmp("on",val,vlen));
           return APR_SUCCESS;
   
       };
  
  
  

Mime
View raw message