diff --git a/daemon.py b/daemon.py index 44137ad60..11caa1249 100644 --- a/daemon.py +++ b/daemon.py @@ -134,7 +134,7 @@ def readFollowList(filename: str): return followlist class PubServer(BaseHTTPRequestHandler): - protocol_version = 'HTTP/1.1' + protocol_version = 'HTTP/1.0' def _login_headers(self,fileFormat: str,length: int) -> None: self.send_response(200) @@ -390,8 +390,19 @@ class PubServer(BaseHTTPRequestHandler): if len(self.server.inboxQueue)>=self.server.maxQueueLength: print('Inbox queue is full') return 1 - - # save the json for later queue processing + + #TODO convert headers to dict + headersDict={} + headersDict['host']=self.headers['host'] + headersDict['signature']=self.headers['signature'] + if self.headers.get('Date'): + headersDict['Date']=self.headers['Date'] + if self.headers.get('digest'): + headersDict['digest']=self.headers['digest'] + if self.headers.get('Content-type'): + headersDict['Content-type']=self.headers['Content-type'] + + # save the json for later queue processing queueFilename = \ savePostToInboxQueue(self.server.baseDir, \ self.server.httpPrefix, \ @@ -400,7 +411,7 @@ class PubServer(BaseHTTPRequestHandler): messageJson, self.headers['host'], self.headers['signature'], - self.headers, + headersDict, '/'+self.path.split('/')[-1], self.server.debug) if queueFilename: diff --git a/inbox.py b/inbox.py index ca48f6f2e..ffc5115b6 100644 --- a/inbox.py +++ b/inbox.py @@ -164,7 +164,7 @@ def validPublishedDate(published) -> bool: return False return True -def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str,postJsonObject: {},host: str,headers: str,httpHeaders: str,postPath: str,debug: bool) -> str: +def savePostToInboxQueue(baseDir: str,httpPrefix: str,nickname: str, domain: str,postJsonObject: {},host: str,headers: str,httpHeaders: {},postPath: str,debug: bool) -> str: """Saves the give json to the inbox queue for the person keyId specifies the actor sending the post """ @@ -1140,7 +1140,8 @@ def runInboxQueue(projectVersion: str, \ print('DEBUG: checking http headers') pprint(queueJson['headers']) if not verifyPostHeaders(httpPrefix, \ - pubKey,queueJson['headers'], \ + pubKey, \ + queueJson['httpHeaders'], \ queueJson['path'],False, \ json.dumps(queueJson['post'])): if debug: