diff --git a/hello_world.py b/hello_world.py
index e5328f3e..8b2301a2 100644
--- a/hello_world.py
+++ b/hello_world.py
@@ -2,4 +2,5 @@ import uwsgi
#uwsgi.cache_set('/', "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\nHello World from cache")
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
- return "
Hello World
"
+ yield str(env['wsgi.input'].fileno())
+ yield "Hello World
"
diff --git a/plugins/python/wsgi_handlers.c b/plugins/python/wsgi_handlers.c
index ce3fbbbf..7af28c4b 100644
--- a/plugins/python/wsgi_handlers.c
+++ b/plugins/python/wsgi_handlers.c
@@ -211,12 +211,18 @@ static PyObject *uwsgi_Input_close(uwsgi_Input *self, PyObject *args) {
return Py_None;
}
+static PyObject *uwsgi_Input_fileno(uwsgi_Input *self, PyObject *args) {
+
+ return PyInt_FromLong(self->wsgi_req->poll.fd);
+}
+
static PyMethodDef uwsgi_Input_methods[] = {
{ "read", (PyCFunction)uwsgi_Input_read, METH_VARARGS, 0 },
{ "readline", (PyCFunction)uwsgi_Input_readline, METH_VARARGS, 0 },
{ "readlines", (PyCFunction)uwsgi_Input_readlines, METH_VARARGS, 0 },
// add close to allow mod_wsgi compatibility
{ "close", (PyCFunction)uwsgi_Input_close, METH_VARARGS, 0 },
+ { "fileno", (PyCFunction)uwsgi_Input_fileno, METH_VARARGS, 0 },
{ NULL, NULL}
};