This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jleedev
Recipients durin42, jleedev
Date 2014-08-07.15:06:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407423993.73.0.218384565957.issue22165@psf.upfronthosting.co.za>
In-reply-to
Content
While SimpleHTTPServer from Python2 would happily spit out whatever bytes were in the directory listing, Python3's http.server logs an error and closes the connection without responding to the HTTP request.

$ mkdir $'\xff'
$ ls
\377/
$ python3 -m http.server 
Serving HTTP on 0.0.0.0 port 8000 ...
----------------------------------------
Exception happened during processing of request from ('74.125.59.145', 19648)
Traceback (most recent call last):
  File "/home/josh/local/lib/python3.5/socketserver.py", line 321, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/josh/local/lib/python3.5/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/home/josh/local/lib/python3.5/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/josh/local/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/home/josh/local/lib/python3.5/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/home/josh/local/lib/python3.5/http/server.py", line 386, in handle_one_request
    method()
  File "/home/josh/local/lib/python3.5/http/server.py", line 677, in do_GET
    f = self.send_head()
  File "/home/josh/local/lib/python3.5/http/server.py", line 716, in send_head
    return self.list_directory(path)
  File "/home/josh/local/lib/python3.5/http/server.py", line 772, in list_directory
    % (urllib.parse.quote(linkname), html.escape(displayname)))
  File "/home/josh/local/lib/python3.5/urllib/parse.py", line 688, in quote
    string = string.encode(encoding, errors)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
----------------------------------------
History
Date User Action Args
2014-08-07 15:06:33jleedevsetrecipients: + jleedev, durin42
2014-08-07 15:06:33jleedevsetmessageid: <1407423993.73.0.218384565957.issue22165@psf.upfronthosting.co.za>
2014-08-07 15:06:33jleedevlinkissue22165 messages
2014-08-07 15:06:33jleedevcreate