forked from indymedia/epicyon
More http signature reworking
parent
977160eecf
commit
8dca9dc9cc
19
daemon.py
19
daemon.py
|
@ -134,7 +134,7 @@ def readFollowList(filename: str):
|
||||||
return followlist
|
return followlist
|
||||||
|
|
||||||
class PubServer(BaseHTTPRequestHandler):
|
class PubServer(BaseHTTPRequestHandler):
|
||||||
protocol_version = 'HTTP/1.1'
|
protocol_version = 'HTTP/1.0'
|
||||||
|
|
||||||
def _login_headers(self,fileFormat: str,length: int) -> None:
|
def _login_headers(self,fileFormat: str,length: int) -> None:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
|
@ -390,8 +390,19 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if len(self.server.inboxQueue)>=self.server.maxQueueLength:
|
if len(self.server.inboxQueue)>=self.server.maxQueueLength:
|
||||||
print('Inbox queue is full')
|
print('Inbox queue is full')
|
||||||
return 1
|
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 = \
|
queueFilename = \
|
||||||
savePostToInboxQueue(self.server.baseDir, \
|
savePostToInboxQueue(self.server.baseDir, \
|
||||||
self.server.httpPrefix, \
|
self.server.httpPrefix, \
|
||||||
|
@ -400,7 +411,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
messageJson,
|
messageJson,
|
||||||
self.headers['host'],
|
self.headers['host'],
|
||||||
self.headers['signature'],
|
self.headers['signature'],
|
||||||
self.headers,
|
headersDict,
|
||||||
'/'+self.path.split('/')[-1],
|
'/'+self.path.split('/')[-1],
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
if queueFilename:
|
if queueFilename:
|
||||||
|
|
5
inbox.py
5
inbox.py
|
@ -164,7 +164,7 @@ def validPublishedDate(published) -> bool:
|
||||||
return False
|
return False
|
||||||
return True
|
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
|
"""Saves the give json to the inbox queue for the person
|
||||||
keyId specifies the actor sending the post
|
keyId specifies the actor sending the post
|
||||||
"""
|
"""
|
||||||
|
@ -1140,7 +1140,8 @@ def runInboxQueue(projectVersion: str, \
|
||||||
print('DEBUG: checking http headers')
|
print('DEBUG: checking http headers')
|
||||||
pprint(queueJson['headers'])
|
pprint(queueJson['headers'])
|
||||||
if not verifyPostHeaders(httpPrefix, \
|
if not verifyPostHeaders(httpPrefix, \
|
||||||
pubKey,queueJson['headers'], \
|
pubKey, \
|
||||||
|
queueJson['httpHeaders'], \
|
||||||
queueJson['path'],False, \
|
queueJson['path'],False, \
|
||||||
json.dumps(queueJson['post'])):
|
json.dumps(queueJson['post'])):
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in New Issue