perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve...@apache.org
Subject svn commit: r1539414 - /perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c
Date Wed, 06 Nov 2013 18:12:07 GMT
Author: stevehay
Date: Wed Nov  6 18:12:07 2013
New Revision: 1539414

URL: http://svn.apache.org/r1539414
Log:
Save the test suite from crashing httpd.exe on start-up:
- Use the correct pool in MP_dINTERP_POOLa.
- Delay the use of MP_dINTERP_POOLa until it's really needed. We don't seem to have an interpreter
available at this time, but it so happens that the test suite doesn't exercise going this
far through perl_parse_require_line() anyway, so this bypasses the crash for now.
- Add an early return with trace diagnostic when MP_dINTERP_POOLa returns NULL to continue
bypassing the crash if the test suite is enhanced to exercise more of perl_parse_require_line().
The trace diagnostic will help alert us to the fact that the order of creating an interpreter
vs. handling Require parsing is still unresolved.

Many thanks to Jeff Trawick++ for invaluable assistance in getting this far.

Modified:
    perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c

Modified: perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c
URL: http://svn.apache.org/viewvc/perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c?rev=1539414&r1=1539413&r2=1539414&view=diff
==============================================================================
--- perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c (original)
+++ perl/modperl/branches/httpd24threading/src/modules/perl/modperl_util.c Wed Nov  6 18:12:07
2013
@@ -984,52 +984,61 @@ static const char *perl_parse_require_li
                                            const char *require_line,
                                            const void **parsed_require_line)
 {
-    SV *ret_sv;
     char *ret = NULL;
-    int count;
     void *key;
     auth_callback *ab;
-    MP_dINTERP_POOLa(cmd->server->process->pool, cmd->server);
 
-    if (global_authz_providers == NULL) {
-        MP_INTERP_PUTBACK(interp, aTHX);
-        return ret;
+    if (global_authz_providers == NULL ||
+        apr_hash_count(global_authz_providers) == 0)
+    {
+        return NULL;
     }
 
     apr_pool_userdata_get(&key, AUTHZ_PROVIDER_NAME_NOTE, cmd->temp_pool);
     ab = apr_hash_get(global_authz_providers, (char *) key, APR_HASH_KEY_STRING);
     if (ab == NULL || ab->cb2 == NULL) {
-        MP_INTERP_PUTBACK(interp, aTHX);
-        return ret;
+        return NULL;
     }
 
     {
-        dSP;
-        ENTER;
-        SAVETMPS;
-        PUSHMARK(SP);
-        XPUSHs(sv_2mortal(modperl_ptr2obj(aTHX_ "Apache2::CmdParms", cmd)));
-        XPUSHs(sv_2mortal(newSVpv(require_line, 0)));
-        PUTBACK;
-        count = call_sv(ab->cb2, G_SCALAR);
-        SPAGAIN;
-
-        if (count == 1) {
-            ret_sv = POPs;
-            if (SvOK(ret_sv)) {
-                char *tmp = SvPV_nolen(ret_sv);
-                if (*tmp != '\0') {
-                    ret = apr_pstrdup(cmd->pool, tmp);
+        MP_dINTERP_POOLa(cmd->pool, cmd->server);
+        if (!interp) {
+            MP_TRACE_d(MP_FUNC, "require handler is not currently supported "
+                                "in this context");
+	    return NULL;
+	}
+
+        {
+            SV *ret_sv;
+            int count;
+            dSP;
+
+            ENTER;
+            SAVETMPS;
+            PUSHMARK(SP);
+            XPUSHs(sv_2mortal(modperl_ptr2obj(aTHX_ "Apache2::CmdParms", cmd)));
+            XPUSHs(sv_2mortal(newSVpv(require_line, 0)));
+            PUTBACK;
+            count = call_sv(ab->cb2, G_SCALAR);
+            SPAGAIN;
+
+            if (count == 1) {
+                ret_sv = POPs;
+                if (SvOK(ret_sv)) {
+                    char *tmp = SvPV_nolen(ret_sv);
+                    if (*tmp != '\0') {
+                        ret = apr_pstrdup(cmd->pool, tmp);
+                    }
                 }
             }
+
+            PUTBACK;
+            FREETMPS;
+            LEAVE;
         }
 
-        PUTBACK;
-        FREETMPS;
-        LEAVE;
+        MP_INTERP_PUTBACK(interp, aTHX);
     }
-
-    MP_INTERP_PUTBACK(interp, aTHX);
     return ret;
 }
 



Mime
View raw message