cvs commit: modperl-2.0 Changes

2003-10-09 Thread stas
stas2003/10/09 15:46:12

  Modified:lib/Apache Build.pm
   .Changes
  Log:
  in the MP_MAINTAINER mode add the -Werror compilation flag when perl
  v5.6.2 or higher is used, so that we don't miss compilation
  warnings.
  
  Revision  ChangesPath
  1.148 +5 -1  modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -u -r1.147 -r1.148
  --- Build.pm  18 Sep 2003 18:24:24 -  1.147
  +++ Build.pm  9 Oct 2003 22:46:12 -   1.148
  @@ -252,8 +252,12 @@
   $ldopts;
   }
   
  -my $Wall = 
  +my $Wall =
 "-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations";
  +
  +# perl v5.6.1 and earlier produces lots of warnings, so we can't use
  +# -Werror with those versions.
  +$Wall .= " -Werror" if $] >= 5.006002;
   
   sub ap_ccopts {
   my($self) = @_;
  
  
  
  1.232 +4 -0  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.231
  retrieving revision 1.232
  diff -u -u -r1.231 -r1.232
  --- Changes   8 Oct 2003 13:29:17 -   1.231
  +++ Changes   9 Oct 2003 22:46:12 -   1.232
  @@ -12,6 +12,10 @@
   
   =item 1.99_11-dev - 
   
  +in the MP_MAINTAINER mode add the -Werror compilation flag when perl
  +v5.6.2 or higher is used, so that we don't miss compilation
  +warnings. [Stas]
  +
   fix the Makefile.PL option parser to support overriding of certain
   build options, in addition to appending to them (.e.g. now MP_LIBNAME
   is overridable) [Andrew Wyllie <[EMAIL PROTECTED]>]
  
  
  


cvs commit: modperl-2.0 Changes

2003-10-09 Thread stas
stas2003/10/09 15:48:58

  Modified:.Changes
  Log:
  handlers returning status numbers as strings (e.g. "0") are working again
  
  Revision  ChangesPath
  1.233 +5 -1  modperl-2.0/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.232
  retrieving revision 1.233
  diff -u -u -r1.232 -r1.233
  --- Changes   9 Oct 2003 22:46:12 -   1.232
  +++ Changes   9 Oct 2003 22:48:58 -   1.233
  @@ -16,11 +16,15 @@
   v5.6.2 or higher is used, so that we don't miss compilation
   warnings. [Stas]
   
  +handlers returning status numbers as strings (e.g. "0") are working
  +again (as they did before 1.99_10). [Geoffrey Young]
  +
   fix the Makefile.PL option parser to support overriding of certain
   build options, in addition to appending to them (.e.g. now MP_LIBNAME
   is overridable) [Andrew Wyllie <[EMAIL PROTECTED]>]
   
  -make sure that connection filters won't be inserted as request filters [Stas]
  +make sure that connection filters won't be inserted as request filters
  +[Stas]
   
   Prevent the 'Use of uninitialized value.' warning when
   ModPerl::Util::exit is used. [Stas]
  
  
  


cvs commit: modperl-2.0/src/modules/perl modperl_util.c

2003-10-09 Thread stas
stas2003/10/09 16:56:52

  Modified:src/modules/perl modperl_util.c
  Log:
  s/Apache::exit/ModPerl::Util::exit/
  
  Revision  ChangesPath
  1.55  +1 -1  modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -u -r1.54 -r1.55
  --- modperl_util.c22 Sep 2003 23:46:19 -  1.54
  +++ modperl_util.c9 Oct 2003 23:56:52 -   1.55
  @@ -263,7 +263,7 @@
   if (SvMAGICAL(sv) && (SvCUR(sv) > 4) &&
   strnEQ(SvPVX(sv), " at ", 4))
   {
  -/* Apache::exit was called */
  +/* ModPerl::Util::exit was called */
   return DECLINED;
   }
   #if 0
  
  
  


cvs commit: modperl-2.0/t/modperl status.t

2003-10-09 Thread geoff
geoff   2003/10/09 11:40:31

  Added:   t/response/TestModperl status.pm
   t/modperl status.t
  Log:
  add tests for handler return status logic
  
  Revision  ChangesPath
  1.1  modperl-2.0/t/response/TestModperl/status.pm
  
  Index: status.pm
  ===
  package TestModperl::status;
  
  use strict;
  use warnings;
  
  use Apache::RequestRec;
  use Apache::Const -compile => qw(DECLINED);
  
  use ModPerl::Util;
  use Apache::TestUtil qw(t_server_log_error_is_expected);
  
  sub handler {
  
  my $rc = shift->args;
  
  if ($rc eq 'die' ||
  $rc eq Apache::DECLINED) {
  t_server_log_error_is_expected();
  }
 
  ModPerl::Util::exit if $rc eq 'exit';
  
  die if $rc eq 'die';
  
  return $rc;
  }
  
  1;
  __END__
  
  
  
  1.1  modperl-2.0/t/modperl/status.t
  
  Index: status.t
  ===
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil qw(t_cmp t_server_log_error_is_expected);
  
  use Apache2;
  use Apache::Const -compile => qw(OK DECLINED
   NOT_FOUND SERVER_ERROR FORBIDDEN
   HTTP_OK);
  
  plan tests => 13;
  
  my $base = "/TestModperl__status";
  
  # valid Apache return codes
  {
  my $uri = join '?', $base, Apache::OK;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, Apache::DECLINED;
  my $code = GET_RC $uri;
  
  # no Alias to map us to DocumentRoot
  ok t_cmp(Apache::NOT_FOUND, 
   $code,
   $uri);
  }
  
  # standard HTTP status codes
  {
  my $uri = join '?', $base, Apache::NOT_FOUND;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::NOT_FOUND, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, Apache::FORBIDDEN;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::FORBIDDEN, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, Apache::SERVER_ERROR;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::SERVER_ERROR, 
   $code,
   $uri);
  }
  
  # the return code guessing game
  {
  my $uri = join '?', $base, Apache::HTTP_OK;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, 601;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, 1;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  # apache translates non-HTTP codes into 500
  # see ap_index_of_response
  {
  my $uri = join '?', $base, 313;
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::SERVER_ERROR, 
   $code,
   $uri);
  }
  
  # mod_perl-specific implementation tests
  {
  # ModPerl::Util::exit - voids return OK
  my $uri = join '?', $base, 'exit';
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  {
  # die gets trapped
  my $uri = join '?', $base, 'die';
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::SERVER_ERROR, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, 'foobar';
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  {
  my $uri = join '?', $base, 'foo9bar';
  my $code = GET_RC $uri;
  
  ok t_cmp(Apache::HTTP_OK, 
   $code,
   $uri);
  }
  
  
  
  


cvs commit: modperl-2.0/src/modules/perl modperl_callback.c

2003-10-09 Thread geoff
geoff   2003/10/09 12:41:41

  Modified:src/modules/perl modperl_callback.c
  Log:
  fix pv -> iv handler return bug in modperl_callback()
  restore HTTP-code logic removed in last version - will revisit later
  Reviewed by:  stas
  
  Revision  ChangesPath
  1.62  +15 -7 modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- modperl_callback.c7 Oct 2003 19:16:13 -   1.61
  +++ modperl_callback.c9 Oct 2003 19:41:41 -   1.62
  @@ -4,6 +4,7 @@
request_rec *r, server_rec *s, AV *args)
   {
   CV *cv=Nullcv;
  +SV *status_sv;
   I32 flags = G_EVAL|G_SCALAR;
   dSP;
   int count, status = OK;
  @@ -71,19 +72,26 @@
   SPAGAIN;
   
   if (count != 1) {
  +/* XXX can this really happen with G_EVAL|G_SCALAR? */
   status = OK;
   }
   else {
  -SV* status_sv = POPs;
  -if (SvIOK(status_sv)) {
  -status = (IV)SvIVx(status_sv);
  +status_sv = POPs;
  +
  +if (status_sv == &PL_sv_undef) {
  +/* ModPerl::Util::exit(), die(), or other croaks
  + * Perl_croak sets count to 1 but the stack to undef with 
G_EVAL|G_SCALAR
  + * if it was an error, it will be caught with ERRSV below */
  +status = OK; 
   }
   else {
  -/* ModPerl::Util::exit doesn't return an integer value */
  -status = OK; 
  +/* get the integer return code (or a string coerced into an int) */
  +status = SvIV(status_sv);
   }
  -/* assume OK for 200 (HTTP_OK) */
  -if ((status == 200)) {
  +
  +/* assume OK for non-http status codes and for 200 (HTTP_OK) */
  +if (((status > 0) && (status < 100)) ||
  +(status == 200) || (status > 600)) {
   status = OK;
   }
   }
  
  
  


cvs commit: modperl-2.0/ModPerl-Registry/t/conf extra.conf.in

2003-10-09 Thread stas
stas2003/10/09 13:03:31

  Modified:t/conf   extra.conf.in
   ModPerl-Registry/t/conf extra.conf.in
  Log:
  enabled the warnings globally so that we catch problems outside the scope
  of the handlers.
  
  Revision  ChangesPath
  1.8   +2 -2  modperl-2.0/t/conf/extra.conf.in
  
  Index: extra.conf.in
  ===
  RCS file: /home/cvs/modperl-2.0/t/conf/extra.conf.in,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- extra.conf.in 2 Oct 2003 06:29:46 -   1.7
  +++ extra.conf.in 9 Oct 2003 20:03:31 -   1.8
  @@ -1,5 +1,5 @@
  -# make sure that we test under Taint mode
  -PerlSwitches -T
  +# make sure that we test under Taint and warnings mode enabled
  +PerlSwitches -wT
   
   PerlChildExitHandler ModPerl::Test::exit_handler
   
  
  
  
  1.13  +2 -2  modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in
  
  Index: extra.conf.in
  ===
  RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/conf/extra.conf.in,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- extra.conf.in 2 Oct 2003 08:57:09 -   1.12
  +++ extra.conf.in 9 Oct 2003 20:03:31 -   1.13
  @@ -1,7 +1,7 @@
   #this file will be Include-d by @ServerRoot@/httpd.conf
   
  -# make sure that we test under Taint mode
  -PerlSwitches -T
  +# make sure that we test under Taint and warnings mode enabled
  +PerlSwitches -wT
   
   PerlModule Apache2