RE: $r->get_handlers bug/oversight? (possible fix)

2000-05-03 Thread Doug MacEachern

On Tue, 2 May 2000, Geoffrey Young wrote:

> ok, for anyone who is interested, I seem to have fixed the problem
> (maybe)...
> 
> here's a patch for Apache.xs from yesterday's cvs (and I didn't see any
> commits since then...)
> 
> --- Apache.xs.old   Tue May  2 14:25:09 2000
> +++ Apache.xs   Tue May  2 14:26:19 2000
> @@ -220,7 +220,7 @@
>  
>  perl_handler_merge_avs(hook, &avcopy);
>  
> -return newRV_noinc((SV*)avcopy);
> +return newRV_inc((SV*)avcopy);
>  }
> 
> 
> now, the implications of this are way over my head, but it seems to work
> with the test case below just fine (and my other code with which I initially
> caught the problem).  anyway...

hmm, that could result in a leak.  i'll look into this soon, thanks for
the details and patch!




RE: $r->get_handlers bug/oversight? (possible fix)

2000-05-02 Thread Geoffrey Young

ok, for anyone who is interested, I seem to have fixed the problem
(maybe)...

here's a patch for Apache.xs from yesterday's cvs (and I didn't see any
commits since then...)

--- Apache.xs.old   Tue May  2 14:25:09 2000
+++ Apache.xs   Tue May  2 14:26:19 2000
@@ -220,7 +220,7 @@
 
 perl_handler_merge_avs(hook, &avcopy);
 
-return newRV_noinc((SV*)avcopy);
+return newRV_inc((SV*)avcopy);
 }


now, the implications of this are way over my head, but it seems to work
with the test case below just fine (and my other code with which I initially
caught the problem).  anyway...

HTH

--Geoff

> -Original Message-
> From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 01, 2000 4:32 PM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: $r->get_handlers bug/oversight?
> 
> 
> hi again...
> 
> 
> I'm having lots of problems with the get_handlers method... 
> the following is
> reproducible for me under 1.22, 1.23 and the latest cvs using 
> 1.3.12...
> 
> ---
> 
> #!/usr/bin/perl
> 
> my $r = shift;
> my $list;
> 
> my @array = qw('test' 'array');
> $r->pnotes(TEST => \@array);
> 
> $r->push_handlers(PerlLogHandler => sub {
>  my $pnotes = $r->pnotes;
>  foreach my $key (sort keys %$pnotes) {
>warn "this is the key $key";
>  };
>});
> 
> #$list = $r->get_handlers('PerlLogHandler');
> 
> $r->send_http_header('text/plain');
> foreach my $key (@$list) {
>   print "$key\n";
> }
> print "done!";
> 
> ---
> 
> running as is prints the pnotes keys.
> 
> uncommenting the get_handlers method gives:
>   Attempt to free unreferenced scalar.
> and no other output, yet a code reference is visible in the browser...
> 
> The other thing is that this only seems to be an issue for 
> code references -
> if I push My::Logger instead of a subroutine, all is fine...
> 
> Am I using push_handlers incorrectly, or is get_handlers 
> mucked up (or can
> nobody reproduce this)?
> 
> --Geoff
> 
> 
> 
> 
> 
> >On Tue, 25 Apr 2000, Geoffrey Young wrote:
> 
> >> Hi all...
> >>   
> >>   I've noticed that get_handlers() will return the 
> enabled handlers
> >> for a PerlPostReadRequestHandler, but not when it is specified as a
> >> PerlInitHandler (either by calling
> >> $r->get_handlers('PerlPostReadRequestHandler') or
> >> $r->get_handlers('PerlInitHandler').  It is the same with
> >> PerlHeaderParserHandler.  An oversight?
> >> 
> >>   Also, I can't get anything for PerlCleanupHandlers, 
> which kinda
> >> makes sense, since Cleanup isn't really a phase, per se (at least
> according
> >> to the book).  Does it make sense to add this to 
> get_handlers() as well?
> >
> >oversight.  neither CleanupHandler nor InitHandlers is in the
> >handler_table in Apache.xs.  probably because those 
> directives were added
> >after get/set handlers was implemented, and the table was 
> never updated.
> >i'll see about fixing that.
> >
> 
> 
>  
>