mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-04 12:41:38 +00:00
attempt to fix #833
This commit is contained in:
@@ -637,6 +637,19 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) {
|
||||
// before the environ is set up.
|
||||
if (!wsgi_req->async_environ) return;
|
||||
|
||||
// we need to restore the context in case of multiple interpreters
|
||||
struct uwsgi_app *wi = &uwsgi_apps[wsgi_req->app_id];
|
||||
if (uwsgi.threads < 2) {
|
||||
if (((PerlInterpreter **)wi->interpreter)[0] != uperl.main[0]) {
|
||||
PERL_SET_CONTEXT(((PerlInterpreter **)wi->interpreter)[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (((PerlInterpreter **)wi->interpreter)[wsgi_req->async_id] != uperl.main[wsgi_req->async_id]) {
|
||||
PERL_SET_CONTEXT(((PerlInterpreter **)wi->interpreter)[wsgi_req->async_id]);
|
||||
}
|
||||
}
|
||||
|
||||
// dereference %env
|
||||
SV *env = SvRV((SV *) wsgi_req->async_environ);
|
||||
|
||||
@@ -684,6 +697,19 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) {
|
||||
}
|
||||
}
|
||||
|
||||
// restore main interpreter if needed
|
||||
if (uwsgi.threads > 1) {
|
||||
if (((PerlInterpreter **)wi->interpreter)[wsgi_req->async_id] != uperl.main[wsgi_req->async_id]) {
|
||||
PERL_SET_CONTEXT(uperl.main[wsgi_req->async_id]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (((PerlInterpreter **)wi->interpreter)[0] != uperl.main[0]) {
|
||||
PERL_SET_CONTEXT(uperl.main[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
int uwsgi_perl_magic(char *mountpoint, char *lazy) {
|
||||
|
||||
Reference in New Issue
Block a user