diff --git a/plugins/cgi/cgi_plugin.c b/plugins/cgi/cgi_plugin.c index 70d21b93..48807ac5 100644 --- a/plugins/cgi/cgi_plugin.c +++ b/plugins/cgi/cgi_plugin.c @@ -101,7 +101,7 @@ int uwsgi_cgi_request(struct wsgi_request *wsgi_req) { uwsgi_log("STARTBUF %.*s\n", 8, startbuf); if (!memcmp(startbuf, "Status: ", 8)) { - wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.1 " + // wsgi_req->socket->proto_write(wsgi_req, "HTTP/1.1 " } // now wait for fd diff --git a/plugins/psgi/psgi_response.c b/plugins/psgi/psgi_response.c index 020f99a4..9b9b4ab4 100644 --- a/plugins/psgi/psgi_response.c +++ b/plugins/psgi/psgi_response.c @@ -147,6 +147,7 @@ int psgi_response(struct wsgi_request *wsgi_req, AV *response) { wsgi_req->sendfile_fd = SvIV(fn); SvREFCNT_dec(fn); wsgi_req->response_size += uwsgi_sendfile(wsgi_req); + // no need to close here as perl GC will do the close() return UWSGI_OK; } diff --git a/plugins/python/uwsgi_python.h b/plugins/python/uwsgi_python.h index 203d27ee..f1e9ae48 100644 --- a/plugins/python/uwsgi_python.h +++ b/plugins/python/uwsgi_python.h @@ -212,8 +212,6 @@ PyObject *python_call(PyObject *, PyObject *, int, struct wsgi_request *); #ifdef UWSGI_SENDFILE PyObject *py_uwsgi_sendfile(PyObject *, PyObject *); -ssize_t uwsgi_sendfile(struct wsgi_request *); -ssize_t uwsgi_do_sendfile(int, int, size_t, size_t, off_t*, int); #endif PyObject *py_uwsgi_write(PyObject *, PyObject *); diff --git a/plugins/rack/rack_plugin.c b/plugins/rack/rack_plugin.c index 3d042b02..9df083fd 100644 --- a/plugins/rack/rack_plugin.c +++ b/plugins/rack/rack_plugin.c @@ -616,6 +616,8 @@ int uwsgi_rack_request(struct wsgi_request *wsgi_req) { wsgi_req->response_size += uwsgi_sendfile(wsgi_req); } } + // we need to close it... + close(wsgi_req->sendfile_fd); } } else if (rb_respond_to( body, rb_intern("each") )) { diff --git a/protocol.c b/protocol.c index bddf0328..717d10a8 100644 --- a/protocol.c +++ b/protocol.c @@ -1610,6 +1610,8 @@ int uwsgi_file_serve(struct wsgi_request *wsgi_req, char *document_root, uint16_ wsgi_req->header_cnt += 2; wsgi_req->sendfile_fd = open(real_filename, O_RDONLY); wsgi_req->response_size += uwsgi_sendfile(wsgi_req); + // here we need to close the sendfile fd (no-GC involved) + close(wsgi_req->sendfile_fd); }