Issue #916 resolved

python3 return [b'hello world']

Anonymous created an issue

paste the following code at the bottom of the wsgi server

{{{ def index(environ, response): response('200 OK', [('Content-type', 'text/plain')]) return [b'Hello world!']

apps = WSGIPathInfoDispatcher({'/': index}) server = CherryPyWSGIServer(('', 80), apps)

if name == 'main': try: server.start() except KeyboardInterrupt: server.stop() }}}

When you execute the server and go to http://localhost/ the browser receives the correct headers but no response body at all

OS = Vista Browser = Firefox 3.5

Reported by

Comments (6)

  1. Anonymous

    Changing that line to:

                buf = [bytes(hex(len(chunk))[2:], "utf8"), b"\r\n", chunk, b"\r\n"]

    Seems to fix it.

  2. Anonymous

    But I'm not sure if that will always be true. In other words, I'm not sure if the string will always have that encoding.

  3. Log in to comment