avoid WSGI status_line to be decref'ed

This commit is contained in:
roberto@precise64
2012-05-08 18:47:49 +02:00
parent 6e473a75bd
commit d258c1b417
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -114,6 +114,10 @@ PyObject *py_uwsgi_spit(PyObject * self, PyObject * args) {
wsgi_req->hvec[2].iov_len = NL_SIZE;
}
// incref status line
wsgi_req->status_header = head;
Py_INCREF((PyObject *)wsgi_req->status_header);
headers = PyTuple_GetItem(args, 1);
if (!headers) {
return PyErr_Format(PyExc_TypeError, "start_response() takes at least 2 arguments");
@@ -258,6 +262,8 @@ int uwsgi_python_do_send_headers(struct wsgi_request *wsgi_req) {
wsgi_req->headers_sent = 1;
Py_DECREF((PyObject *)wsgi_req->status_header);
if (wsgi_req->write_errors > uwsgi.write_errors_tolerance && !uwsgi.disable_write_exception) {
uwsgi_py_write_set_exception(wsgi_req);
return -1;