index 9427c8fc72383c9c752497e772d24d7c3f6d56be..2ebd56ea3c79e3bb26f8b3ea0df00d0bd573eb6a 100644 (file)
def readline(self, *args):
""" SSL.Connection can return WantRead """
- line = None
- while not line:
+ while True:
try:
- line = self.__fileobj.readline(*args)
+ return self.__fileobj.readline(*args)
except SSL.WantReadError:
sleep (.1)
- line = None
- return line
def read(self, *args):
""" SSL.Connection can return WantRead """
if self["SSL"]:
base_server = SecureHTTPServer
else:
+ # time out after a minute if we can
+ # This sets the socket to non-blocking. SSL needs a blocking
+ # socket, so we do this only for non-SSL connections.
+ if hasattr(socket, 'setdefaulttimeout'):
+ socket.setdefaulttimeout(60)
base_server = BaseHTTPServer.HTTPServer
# obtain request server class
def run(port=undefined, success_message=None):
''' Script entry point - handle args and figure out what to to.
'''
- # time out after a minute if we can
- if hasattr(socket, 'setdefaulttimeout'):
- socket.setdefaulttimeout(60)
-
config = ServerConfig()
# additional options
short_options = "hvS"