better implementation of start_response()

This commit is contained in:
roberto@precise64
2012-05-02 09:30:37 +02:00
parent 5ccf2254eb
commit c39cf848de
6 changed files with 96 additions and 36 deletions

View File

@@ -166,6 +166,11 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
if (PyString_Check((PyObject *)wsgi_req->async_result)) {
char *content = PyString_AsString(wsgi_req->async_result);
size_t content_len = PyString_Size(wsgi_req->async_result);
if (content_len > 0 && !wsgi_req->headers_sent) {
if (uwsgi_python_do_send_headers(wsgi_req)) {
goto clear;
}
}
UWSGI_RELEASE_GIL
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
UWSGI_GET_GIL
@@ -252,6 +257,11 @@ int uwsgi_response_subhandler_wsgi(struct wsgi_request *wsgi_req) {
if (PyString_Check(pychunk)) {
char *content = PyString_AsString(pychunk);
size_t content_len = PyString_Size(pychunk);
if (content_len > 0 && !wsgi_req->headers_sent) {
if (uwsgi_python_do_send_headers(wsgi_req)) {
goto clear;
}
}
UWSGI_RELEASE_GIL
wsgi_req->response_size += wsgi_req->socket->proto_write(wsgi_req, content, content_len);
UWSGI_GET_GIL