Michele Orrù <maker...@gmail.com> added the comment:
These tests shows how SimpleHTTPRequestHandler behaves: if the class
contains a do_FOO method, it is called, otherwise error501 is raised.
That's what Karl said with «Or to modify the library code that for any
resources not yet defined.».
Since SimpleHTTPRequestHandler.do_HEAD exists, and this is reflected
in the correspondent unittest, I belive that this is not a bug.
Patch attached. No problem if it's not committed now. I hope that
someone in the noisy list will make a little cleanup one day :)
>
> ----------
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue13294>
> _______________________________________
>
----------
Added file: http://bugs.python.org/file23723/issue13294.patch
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13294>
_______________________________________
diff -r a00bb30cf775 Lib/http/server.py
--- a/Lib/http/server.py Tue Nov 15 16:12:49 2011 +0100
+++ b/Lib/http/server.py Wed Nov 16 11:15:45 2011 +0100
@@ -271,14 +271,11 @@
self.request_version = version = self.default_request_version
self.close_connection = 1
requestline = str(self.raw_requestline, 'iso-8859-1')
- if requestline[-2:] == '\r\n':
- requestline = requestline[:-2]
- elif requestline[-1:] == '\n':
- requestline = requestline[:-1]
+ requestline = requestline.rstrip('\r\n')
self.requestline = requestline
words = requestline.split()
if len(words) == 3:
- [command, path, version] = words
+ command, path, version = words
if version[:5] != 'HTTP/':
self.send_error(400, "Bad request version (%r)" % version)
return False
@@ -304,7 +301,7 @@
"Invalid HTTP Version (%s)" % base_version_number)
return False
elif len(words) == 2:
- [command, path] = words
+ command, path = words
self.close_connection = 1
if command != 'GET':
self.send_error(400,
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com