clean up the code
This commit is contained in:
parent
c194b01731
commit
08588b967f
8
esgd.py
8
esgd.py
|
@ -42,6 +42,7 @@ class GopherLine:
|
||||||
try: self.port = split[3]
|
try: self.port = split[3]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if location == True: self.port = str(port)
|
if location == True: self.port = str(port)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
return "{}{}\t{}\t{}\t{}".format(
|
return "{}{}\t{}\t{}\t{}".format(
|
||||||
self.item,
|
self.item,
|
||||||
|
@ -97,10 +98,10 @@ class GopherServerLogic:
|
||||||
fd.close()
|
fd.close()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def sendFileArray(self, arr):
|
def sendFileArray(self, fileArray):
|
||||||
[self.request.sendall(
|
[self.request.sendall(
|
||||||
(i.rstrip() + "\r\n").encode("utf-8")
|
(i.rstrip() + "\r\n").encode("utf-8")
|
||||||
) for i in arr]
|
) for i in fileArray]
|
||||||
self.request.sendall(b".\r\n")
|
self.request.sendall(b".\r\n")
|
||||||
|
|
||||||
def cgi(self, file, query):
|
def cgi(self, file, query):
|
||||||
|
@ -143,8 +144,7 @@ class GopherServerLogic:
|
||||||
class GopherHandler(socketserver.BaseRequestHandler, GopherServerLogic):
|
class GopherHandler(socketserver.BaseRequestHandler, GopherServerLogic):
|
||||||
def handle(self):
|
def handle(self):
|
||||||
decoded = self.recieveRequest()
|
decoded = self.recieveRequest()
|
||||||
try:
|
try: parsed = self.requestParser(decoded)
|
||||||
parsed = self.requestParser(decoded)
|
|
||||||
except RequestError:
|
except RequestError:
|
||||||
self.invalid()
|
self.invalid()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue