From 0f01a5a11a7c69b9dd69eb0020d54c60409d7045 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 17 Aug 2019 16:16:27 +0100 Subject: [PATCH] post path no longer /inbox --- daemon.py | 10 ++++++++-- epicyon.py | 2 +- posts.py | 3 +-- tests.py | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/daemon.py b/daemon.py index c01e6854d..1d6a12afc 100644 --- a/daemon.py +++ b/daemon.py @@ -2799,6 +2799,9 @@ class PubServer(BaseHTTPRequestHandler): self.end_headers() self.server.POSTbusy=False +class PubServerUnitTest(PubServer): + protocol_version = 'HTTP/1.0' + def runDaemon(projectVersion, \ instanceId,clientToServer: bool, \ baseDir: str,domain: str, \ @@ -2807,7 +2810,7 @@ def runDaemon(projectVersion, \ noannounce=False,cw=False,ocapAlways=False, \ useTor=False,maxReplies=64, \ domainMaxPostsPerDay=8640,accountMaxPostsPerDay=8640, \ - allowDeletion=False,debug=False) -> None: + allowDeletion=False,debug=False,unitTest=False) -> None: if len(domain)==0: domain='localhost' if '.' not in domain: @@ -2816,7 +2819,10 @@ def runDaemon(projectVersion, \ return serverAddress = ('', proxyPort) - httpd = ThreadingHTTPServer(serverAddress, PubServer) + if unitTest: + httpd = ThreadingHTTPServer(serverAddress, PubServerUnitTest) + else: + httpd = ThreadingHTTPServer(serverAddress, PubServer) # max POST size of 10M httpd.projectVersion=projectVersion httpd.maxPostLength=1024*1024*10 diff --git a/epicyon.py b/epicyon.py index 48fc5f05c..f98fc0afd 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1269,4 +1269,4 @@ runDaemon(__version__, \ args.noannounce,args.cw,ocapAlways, \ useTor,args.maxReplies, \ args.domainMaxPostsPerDay,args.accountMaxPostsPerDay, \ - args.allowdeletion,debug) + args.allowdeletion,debug,False) diff --git a/posts.py b/posts.py index fd02df4e4..030f44cd3 100644 --- a/posts.py +++ b/posts.py @@ -981,7 +981,6 @@ def sendPost(projectVersion: str, \ if toDomain not in inboxUrl: return 7 - #postPath='/'+inboxUrl.split('/')[-1] postPath=inboxUrl.split(toDomain)[1] # convert json to string so that there are no @@ -1215,7 +1214,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ if debug: print('DEBUG: '+toDomain+' is not in '+inboxUrl) return 7 - postPath='/'+inboxUrl.split('/')[-1] + postPath=inboxUrl.split(toDomain)[1] # convert json to string so that there are no # subsequent conversions after creating message body digest diff --git a/tests.py b/tests.py index 26161a3de..99ffe5569 100644 --- a/tests.py +++ b/tests.py @@ -215,7 +215,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ - allowDeletion,True) + allowDeletion,True,True) def createServerBob(path: str,domain: str,port: int,federationList: [], \ hasFollows: bool,hasPosts :bool,ocapAlways :bool): @@ -268,7 +268,7 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ useTor,maxReplies, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \ - allowDeletion,True) + allowDeletion,True,True) def createServerEve(path: str,domain: str,port: int,federationList: [], \ hasFollows: bool,hasPosts :bool,ocapAlways :bool): @@ -299,7 +299,7 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \ runDaemon(__version__,"instanceId",False,path,domain,port,port, \ httpPrefix,federationList, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \ - useTor,maxReplies,allowDeletion,True) + useTor,maxReplies,allowDeletion,True,True) def testPostMessageBetweenServers(): print('Testing sending message from one server to the inbox of another')