mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-25 22:55:15 +00:00
PICARD-1359: improve builtin server reliability and debugging output
This commit is contained in:
@@ -65,11 +65,18 @@ class BrowserIntegration(QtNetwork.QTcpServer):
|
||||
|
||||
def _process_request(self):
|
||||
conn = self.sender()
|
||||
line = bytes(conn.readLine()).decode()
|
||||
conn.write(b"HTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\n\r\nNothing to see here.")
|
||||
conn.disconnectFromHost()
|
||||
rawline = conn.readLine().data()
|
||||
log.debug("Browser integration request: %r", rawline)
|
||||
try:
|
||||
line = rawline.decode()
|
||||
except UnicodeDecodeError as e:
|
||||
log.error(e)
|
||||
return
|
||||
finally:
|
||||
conn.disconnectFromHost()
|
||||
|
||||
line = line.split()
|
||||
log.debug("Browser integration request: %r", line)
|
||||
if line[0] == "GET" and "?" in line[1]:
|
||||
action, args = line[1].split("?")
|
||||
args = [a.split("=", 1) for a in args.split("&")]
|
||||
|
||||
Reference in New Issue
Block a user