Swallow traces when client aborts transmission

This commit is contained in:
Sebastian Lohff 2015-03-18 00:22:21 +01:00
parent 46757ff89b
commit 42949c1403
1 changed files with 4 additions and 6 deletions

View File

@ -154,11 +154,7 @@ class FileBaseHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.end_headers()
block = self.getChunk(myfile, fromto)
while block:
try:
self.wfile.write(block)
except socket.error as e:
print("%s ABORTED transmission (Reason %s: %s)" % (self.client_address[0], e[0], e[1]))
return False
self.wfile.write(block)
block = self.getChunk(myfile, fromto)
myfile.close()
print("%s finished downloading %s" % (self.client_address[0], filePath))
@ -626,7 +622,9 @@ class FilePutter(BaseHTTPServer.BaseHTTPRequestHandler):
# never reached
class ThreadedHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
pass
def handle_error(self, request, client_address):
print("%s ABORTED transmission (Reason: %s)" % (client_address[0], sys.exc_value))
def catchSSLErrors(BaseSSLClass):
""" Class decorator which catches SSL errors and prints them. """