Il giorno 03/ago/2011, alle ore 14:51, Peter Smit ha scritto:

> Hello,
> 
> This is my first message to this list, so please let me know if I'm breaking 
> any etiquette.
> 
> If I'm understanding PEP-3333 (http://www.python.org/dev/peps/pep-3333) well, 
> then wsgi.url_scheme (in the environment) should be the native string type of 
> the python interpreter. For Python 3 this would mean a unicode string.
> 
> However, in the current uwsgi implementation, wsgi.url_scheme is a bytestring 
> instead of a normal (unicode) string. I believe this to be a bug.
> 
> If it is indeed a bug, the following patch would fix it:
> 
> diff -r 7d86c5cb5ee5 plugins/python/wsgi_subhandler.c
> --- a/plugins/python/wsgi_subhandler.c        Wed Aug 03 06:54:48 2011 +0200
> +++ b/plugins/python/wsgi_subhandler.c        Wed Aug 03 15:43:42 2011 +0300
> @@ -101,14 +101,14 @@
>       }
>       else if (wsgi_req->https_len > 0) {
>               if (!strncasecmp(wsgi_req->https, "on", 2) || 
> wsgi_req->https[0] == '1') {
> -                     zero = PyString_FromString("https");
> +                     zero = UWSGI_PYFROMSTRING("https");
>               }
>               else {
> -                     zero = PyString_FromString("http");
> +                     zero = UWSGI_PYFROMSTRING("http");
>               }
>       }
>       else {
> -             zero = PyString_FromString("http");
> +             zero = UWSGI_PYFROMSTRING("http");
>       }
>       PyDict_SetItemString(wsgi_req->async_environ, "wsgi.url_scheme", zero);
>       Py_DECREF(zero);
> 
> 
> Could someone confirm that the current behavior for Python 3 is broken? If 
> so, could the patch be applied to the uwsgi code?
> 
> 

You are right, i will apply the patch in a few minutes

Thanks a lot

--
Roberto De Ioris
http://unbit.it
JID: [email protected]

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to