From fadefff30d902d23ff2d84211f660218aca3ff51 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 29 Sep 2019 14:39:19 +0100 Subject: [PATCH] Copy headers --- daemon.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index 456ebfb02..e54edacd1 100644 --- a/daemon.py +++ b/daemon.py @@ -2370,7 +2370,7 @@ class PubServer(BaseHTTPRequestHandler): def do_HEAD(self): self._set_headers('application/json',0,None) - def _receiveNewPostThread(self,authorized: bool,postType: str,path: str,headers: []) -> int: + def _receiveNewPostThread(self,authorized: bool,postType: str,path: str,headers: {}) -> int: # 0 = this is not a new post # 1 = new post success # -1 = new post failed @@ -2658,10 +2658,16 @@ class PubServer(BaseHTTPRequestHandler): if waitCtr>=8: self.server.newPostThread[newPostThreadName].kill() + # make a copy of self.headers + headers={} + for dictEntryName,headerLine in self.headers.items(): + headers[dictEntryName]=headerLine + print('Creating new post thread') self.server.newPostThread[newPostThreadName]= \ threadWithTrace(target=self._receiveNewPostThread, \ - args=(authorized,postType,path,self.headers.copy()),daemon=True) + args=(authorized,postType,path,headers),daemon=True) + print('Starting new post thread') self.server.newPostThread[newPostThreadName].start() return True