]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Per Cederqvist writes:
authorGuido van Rossum <guido@python.org>
Tue, 30 Mar 1999 20:17:31 +0000 (20:17 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 30 Mar 1999 20:17:31 +0000 (20:17 +0000)
If you send something like "PUT / HTTP/1.0" to something derived from
BaseHTTPServer that doesn't define do_PUT, you will get a response
that begins like this:

HTTP/1.0 501 Unsupported method ('do_PUT')
Server: SimpleHTTP/0.3 Python/1.5
Date: Tue, 30 Mar 1999 18:53:53 GMT

The server should complain about 'PUT' instead of 'do_PUT'.  This
patch should fix the problem.

Lib/BaseHTTPServer.py

index 7c8975d3a421858e213d0e122bded5ea50b114d4..4c9645ddeed7e74afe5c8c85b15d18d4acba215f 100644 (file)
@@ -252,7 +252,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
         self.headers = self.MessageClass(self.rfile, 0)
         mname = 'do_' + command
         if not hasattr(self, mname):
-            self.send_error(501, "Unsupported method (%s)" % `mname`)
+            self.send_error(501, "Unsupported method (%s)" % `command`)
             return
         method = getattr(self, mname)
         method()