@ -506,9 +506,12 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
self . send_response ( 403 )
self . send_response ( 403 )
# Send headers
# Send headers
self . end_headers ( )
self . end_headers ( )
except BrokenPipeError as e :
lL = gSettingsDict [ " Logger " ]
if lL : lL . warning ( f " Сервер (do_GET): Возникла ошибка сети - BrokenPipeError: [Errno 32] Broken pipe. Сервер продолжает работу " )
except Exception as e :
except Exception as e :
lL = gSettingsDict [ " Logger " ]
lL = gSettingsDict [ " Logger " ]
if lL : lL . exception ( f " Server.do_GET: Global error handler - look traceback below. " )
if lL : lL . exception ( f " Сервер (do_GET): Неопознанная ошибка сети - см. текст ошибки. Сервер продолжает работу " )
# POST
# POST
def do_POST ( self ) :
def do_POST ( self ) :
try :
try :
@ -608,20 +611,34 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
# Send headers
# Send headers
self . end_headers ( )
self . end_headers ( )
return
return
except BrokenPipeError as e :
lL = gSettingsDict [ " Logger " ]
if lL : lL . warning ( f " Сервер (do_POST): Возникла ошибка сети - BrokenPipeError: [Errno 32] Broken pipe. Сервер продолжает работу " )
except Exception as e :
except Exception as e :
lL = gSettingsDict [ " Logger " ]
lL = gSettingsDict [ " Logger " ]
if lL : lL . exception ( f " Server.do_POST: Global error handler - look traceback below. " )
if lL : lL . exception ( f " Сервер (do_POST): Неопознанная ошибка сети - см. текст ошибки. Сервер продолжает работу " )
#Logging
#Logging
#!Turn it on to stop print in console
#!Turn it on to stop print in console
#def log_message(self, format, *args):
#def log_message(self, format, *args):
# return
# return
class ThreadedHTTPServer ( ThreadingMixIn , HTTPServer ) :
class ThreadedHTTPServer ( ThreadingMixIn , HTTPServer ) :
daemon_threads = True
daemon_threads = True
""" Handle requests in a separate thread. """
""" Handle requests in a separate thread. """
def finish_request ( self , request , client_address ) :
def finish_request ( self , request , client_address ) :
request . settimeout ( gSettingsDict [ " ServerDict " ] [ " RequestTimeoutSecFloat " ] )
try :
# "super" can not be used because BaseServer is not created from object
request . settimeout ( gSettingsDict [ " ServerDict " ] [ " RequestTimeoutSecFloat " ] )
HTTPServer . finish_request ( self , request , client_address )
# "super" can not be used because BaseServer is not created from object
HTTPServer . finish_request ( self , request , client_address )
except ConnectionResetError as e :
lL = gSettingsDict [ " Logger " ]
if lL : lL . warning ( f " Сервер (finish_request): Возникла ошибка сети - ConnectionResetError: [Errno 104] Connection reset by peer. Сервер продолжает работу " )
except Exception as e :
lL = gSettingsDict [ " Logger " ]
if lL : lL . exception ( f " Сервер (finish_request): Неопознанная ошибка сети - см. текст ошибки. Сервер продолжает работу " )
#inGlobalDict
#inGlobalDict
# "JSONConfigurationDict":<JSON>
# "JSONConfigurationDict":<JSON>
import ssl
import ssl