I wrote a small WSGI App:
def foo(environ, start_response):
bar = 'Your request is %s' % environ['PATH_INFO']
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(bar)))]
start_response(status, response_headers)
return [bar]
if __name__ == '__main__':
from wsgiref.simple_server import make_server
server = make_server('localhost', 8000, foo)
print "Running..."
server.serve_forever()
And another script to test:
import urllib2
checkURL = 'http://localhost:8000/foo bar'
print urllib2.urlopen(checkURL).read()
I run script 1 (WSGI App). When run script 2, I has a problem here. WSGI doesn't retrieve request from script 2 (checkURL has a space between foo and bar) and all other request to my WSGI not responding. Now, how do I correct this problem when url request has spaces?