summaryrefslogtreecommitdiffstats
path: root/Lib/BaseHTTPServer.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-04-04 22:55:58 (GMT)
commitbc0e9108261693b6278687f4fb4709ff76c2e543 (patch)
treeafef5d4734034ed0268950cf06321aefd4154ff3 /Lib/BaseHTTPServer.py
parent2f486b7fa6451b790b154e6e4751239d69d46952 (diff)
downloadcpython-bc0e9108261693b6278687f4fb4709ff76c2e543.zip
cpython-bc0e9108261693b6278687f4fb4709ff76c2e543.tar.gz
cpython-bc0e9108261693b6278687f4fb4709ff76c2e543.tar.bz2
Convert a pile of obvious "yes/no" functions to return bool.
Diffstat (limited to 'Lib/BaseHTTPServer.py')
-rw-r--r--Lib/BaseHTTPServer.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 3177cb6..35baf2f 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -222,7 +222,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
are in self.command, self.path, self.request_version and
self.headers.
- Return value is 1 for success, 0 for failure; on failure, an
+ Return True for success, False for failure; on failure, an
error is sent back.
"""
@@ -239,30 +239,30 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
[command, path, version] = words
if version[:5] != 'HTTP/':
self.send_error(400, "Bad request version (%s)" % `version`)
- return 0
+ return False
try:
version_number = float(version.split('/', 1)[1])
except ValueError:
self.send_error(400, "Bad request version (%s)" % `version`)
- return 0
+ return False
if version_number >= 1.1 and self.protocol_version >= "HTTP/1.1":
self.close_connection = 0
if version_number >= 2.0:
self.send_error(505,
"Invalid HTTP Version (%f)" % version_number)
- return 0
+ return False
elif len(words) == 2:
[command, path] = words
self.close_connection = 1
if command != 'GET':
self.send_error(400,
"Bad HTTP/0.9 request type (%s)" % `command`)
- return 0
+ return False
elif not words:
- return 0
+ return False
else:
self.send_error(400, "Bad request syntax (%s)" % `requestline`)
- return 0
+ return False
self.command, self.path, self.request_version = command, path, version
# Deal with pipelining
@@ -283,7 +283,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
elif (conntype.lower() == 'keep-alive' and
self.protocol_version >= "HTTP/1.1"):
self.close_connection = 0
- return 1
+ return True
def handle_one_request(self):
"""Handle a single HTTP request.