Esempio n. 1
0
int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {

	if (wsgi_req->is_raw) return uwsgi_request_python_raw(wsgi_req);

	struct uwsgi_app *wi;

	if (wsgi_req->async_force_again) {
		wi = &uwsgi_apps[wsgi_req->app_id];
		wsgi_req->async_force_again = 0;
		UWSGI_GET_GIL
		// get rid of timeout
		if (wsgi_req->async_timed_out) {
			PyDict_SetItemString(wsgi_req->async_environ, "x-wsgiorg.fdevent.timeout", Py_True);
			wsgi_req->async_timed_out = 0;
		}
		else {
			PyDict_SetItemString(wsgi_req->async_environ, "x-wsgiorg.fdevent.timeout", Py_None);
		}

		if (wsgi_req->async_ready_fd) {
			PyDict_SetItemString(wsgi_req->async_environ, "uwsgi.ready_fd", PyInt_FromLong(wsgi_req->async_last_ready_fd));
			wsgi_req->async_ready_fd = 0;
		}
		else {
			PyDict_SetItemString(wsgi_req->async_environ, "uwsgi.ready_fd", Py_None);
		}
		int ret = manage_python_response(wsgi_req);
		if (ret == UWSGI_OK) goto end;
		UWSGI_RELEASE_GIL
		if (ret == UWSGI_AGAIN) {
			wsgi_req->async_force_again = 1;
		}
		return ret;
	}
Esempio n. 2
0
/* uwsgi FASTFUNC|26 */
int uwsgi_request_fastfunc(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req) {

	PyObject *ffunc;

#ifdef UWSGI_ASYNC
        if (wsgi_req->async_status == UWSGI_AGAIN) {
                return manage_python_response(uwsgi, wsgi_req);
        }
#endif

	ffunc = PyList_GetItem(uwsgi->fastfuncslist, wsgi_req->uh.modifier2);
	if (ffunc) {
		fprintf(stderr, "managing fastfunc %d\n", wsgi_req->uh.modifier2);
		return uwsgi_python_call(uwsgi, wsgi_req, ffunc, NULL);
	}

	return UWSGI_OK;
}