diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index 7b39bf7c..a6da23ac 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -663,7 +663,24 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) { // async plagued could be defined in other areas... if (wsgi_req->async_plagued) { + int i; + uwsgi_log("*** psgix.harakiri.commit requested ***\n"); + + // clear the env, make sure any DESTROY attached to it will + // run. + SvREFCNT_dec(wsgi_req->async_environ); + + // We must free our perl context(s) so any DESTROY hooks + // etc. will run. + for(i=0;i{'psgix.harakiri'}; + + $env->{'psgix.harakiri.tester'} = bless {} => 'psgix::harakiri::tester'; + my $harakiri = $env->{QUERY_STRING}; + $env->{'psgix.harakiri.commit'} = $harakiri ? 1 : 0; + + return [200, [], [ $harakiri ? "We are about to destroy ourselves\n" : "We will live for another request\n" ]]; +}