move server logic into its own class
This commit is contained in:
parent
3c159a5729
commit
cf6fd727a5
3
esgd.py
3
esgd.py
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue