diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c
index 7efb463e..c1935cda 100644
--- a/plugins/python/uwsgi_pymodule.c
+++ b/plugins/python/uwsgi_pymodule.c
@@ -838,17 +838,29 @@ PyObject *py_uwsgi_advanced_sendfile(PyObject * self, PyObject * args) {
return NULL;
}
+
if (PyString_Check(what)) {
filename = PyString_AsString(what);
fd = open(filename, O_RDONLY);
if (fd < 0) {
- uwsgi_error("open");
+ uwsgi_error_open(filename);
goto clear;
}
}
+#ifdef PYTHREE
+ else if (PyUnicode_Check(what)) {
+ filename = PyBytes_AsString(PyUnicode_AsASCIIString(what));
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ uwsgi_error_open(filename);
+ goto clear;
+ }
+ }
+#endif
else {
fd = PyObject_AsFileDescriptor(what);
if (fd < 0)
diff --git a/utils.c b/utils.c
index 02cf0df3..813a2bb8 100644
--- a/utils.c
+++ b/utils.c
@@ -1423,8 +1423,6 @@ int uwsgi_read_whole_body_in_mem(struct wsgi_request *wsgi_req, char *buf) {
post_remains -= len;
}
- uwsgi_log("%.*s\n", wsgi_req->post_cl, buf);
-
return 1;
}
diff --git a/welcome3.py b/welcome3.py
new file mode 100644
index 00000000..5b3608e1
--- /dev/null
+++ b/welcome3.py
@@ -0,0 +1,57 @@
+import uwsgi
+import os
+
+def xsendfile(e, sr):
+ sr('200 OK', [('Content-Type', 'image/png'), ('X-Sendfile', os.path.abspath('logo_uWSGI.png'))])
+ return b''
+
+def serve_logo(e, sr):
+ sr('200 OK', [('Content-Type', 'image/png')])
+ return uwsgi.sendfile('logo_uWSGI.png')
+
+def serve_options(e, sr):
+ sr('200 OK', [('Content-Type', 'text/html')])
+ for opt in range(0,256):
+ body = "{opt} = {optvalue}
".format(opt=opt, optvalue=uwsgi.get_option(opt))
+ yield bytes(body.encode('ascii'))
+
+def serve_config(e, sr):
+ sr('200 OK', [('Content-Type', 'text/html')])
+ for opt in uwsgi.opt.keys():
+ body = "{opt} = {optvalue}
".format(opt=opt, optvalue=uwsgi.opt[opt].decode('ascii'))
+ yield bytes(body.encode('ascii'))
+
+routes = {}
+routes['/xsendfile'] = xsendfile
+routes['/logo'] = serve_logo
+routes['/config'] = serve_config
+routes['/options'] = serve_options
+
+def application(env, start_response):
+
+ if env['PATH_INFO'] in routes:
+ return routes[env['PATH_INFO']](env, start_response)
+
+ start_response('200 OK', [('Content-Type', 'text/html')])
+
+ body = """
+ version {version}
+