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 Changes Path 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.c 7 Oct 2003 19:16:13 -0000 1.61 +++ modperl_callback.c 9 Oct 2003 19:41:41 -0000 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; } }