As recommended by Jeroen Vermeulen in the referenced LJ article.
if url is None: # fall back to the request URI
url = env.get('REQUEST_URI', None)
data = urlparse.parse_qs(env.get('QUERY_STRING', ''))
- output.write('Status: 200 OK\n')
- output.write('Content-type: text/plain; charset=UTF-8\n')
- output.write('\n')
+ output.write('Status: 200 OK\r\n')
+ output.write('Content-type: text/plain; charset=UTF-8\r\n')
+ output.write('\r\n')
output.write('URI: {}\n'.format(url))
output.write('data: {}\n'.format(data))