Hello!
After some experimentation, it appears as if there is a problem with
WSGI when using SSL with a POST request: The client hangs waiting for
data from the server, and the server waits for data from the client (the
message body). Does this work for anyone else, or is that unique to my
install? For what it's worth, I'm on Ubuntu 7.10, Python 2.5.1, OpenSSL
0.7.
Test case:
==========
Consider this little example server:
from paste import httpserver
import OpenSSL
def application(environ, start_response):
print "Received request: ", environ
message_body = environ['wsgi.input'].read()
response_headers = [('Content-type', 'text/html'),]
start_response('200 OK', response_headers)
return ["Hello!"]
httpserver.serve(application, host="127.0.0.1", port="8000",
ssl_pem="*")
Run this program. Now open a Python shell and try this:
>>> import urllib
>>> d = urllib.urlopen("https://127.0.0.1:8000", "This is a test!")
This request will now hang. If you CTL-C it in the Python shell, you can
see that the client sits here:
File "/usr/lib/python2.5/httplib.py", line 1000, in _read
buf = self._ssl.read(self._bufsize)
Meanwhile, the server will have printed "Received request: " with all
the usual information, but it will hang while it attempts to read the
message body. Considering where the client hangs, though, it seems that
the client doesn't believe the SSL related exchange of information is
completed, so it hasn't sent the message body yet.
Note that this seems to be independent (!) from the client. When I sent
a POST request from my browser (Firefox) it hang in the same manner,
which leads me to believe that the problem is on the Paste/OpenSSL side
of things, not in any particular client library.
Note further that if I am not using SSL, everything works fine. To try,
just remove the 'ssl_pem="*"' from the call to serve() and change your
client to connect to "http://..." rather than "https://...". It will
work then.
However, when you look at the output of environ[] by the server, you can
see just one difference: In the case of SSL, the wsgi.input object will
be printed like this:
'wsgi.input': <socket._fileobject object at 0xb79a9b54>
But if you run without SSL, it will be:
'wsgi.input': <socket._fileobject object at 0x82edd84 length=22>
So, as we can see, there seems to be more known about the input in the
case of not running with SSL, which apparently means that the client
actually got around to sending the message body.
Anyway, I just want to know if anyone else is experiencing this, and if
so, if there is a fix or workaround for it?
Thank you very much...
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users