move server logic into its own class

This commit is contained in:
randomuser 2021-07-20 02:40:48 -05:00
parent 3c159a5729
commit cf6fd727a5

View File

@ -51,7 +51,7 @@ class GopherLine:
self.port self.port
) )
class gopherHandler(socketserver.BaseRequestHandler): class GopherServerLogic:
def recieveRequest(self): def recieveRequest(self):
data = b"" data = b""
while data[-2:] != b"\r\n": while data[-2:] != b"\r\n":
@ -140,6 +140,7 @@ class gopherHandler(socketserver.BaseRequestHandler):
if gph: fa = self.gopherRenderer(fa) if gph: fa = self.gopherRenderer(fa)
self.sendFileArray(fa) self.sendFileArray(fa)
class gopherHandler(socketserver.BaseRequestHandler, GopherServerLogic):
def handle(self): def handle(self):
decoded = self.recieveRequest() decoded = self.recieveRequest()
try: try: