post path no longer /inbox

master
Bob Mottram 2019-08-17 16:16:27 +01:00
parent 0bd6eff877
commit 0f01a5a11a
4 changed files with 13 additions and 8 deletions

View File

@ -2799,6 +2799,9 @@ class PubServer(BaseHTTPRequestHandler):
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
class PubServerUnitTest(PubServer):
protocol_version = 'HTTP/1.0'
def runDaemon(projectVersion, \ def runDaemon(projectVersion, \
instanceId,clientToServer: bool, \ instanceId,clientToServer: bool, \
baseDir: str,domain: str, \ baseDir: str,domain: str, \
@ -2807,7 +2810,7 @@ def runDaemon(projectVersion, \
noannounce=False,cw=False,ocapAlways=False, \ noannounce=False,cw=False,ocapAlways=False, \
useTor=False,maxReplies=64, \ useTor=False,maxReplies=64, \
domainMaxPostsPerDay=8640,accountMaxPostsPerDay=8640, \ domainMaxPostsPerDay=8640,accountMaxPostsPerDay=8640, \
allowDeletion=False,debug=False) -> None: allowDeletion=False,debug=False,unitTest=False) -> None:
if len(domain)==0: if len(domain)==0:
domain='localhost' domain='localhost'
if '.' not in domain: if '.' not in domain:
@ -2816,7 +2819,10 @@ def runDaemon(projectVersion, \
return return
serverAddress = ('', proxyPort) serverAddress = ('', proxyPort)
httpd = ThreadingHTTPServer(serverAddress, PubServer) if unitTest:
httpd = ThreadingHTTPServer(serverAddress, PubServerUnitTest)
else:
httpd = ThreadingHTTPServer(serverAddress, PubServer)
# max POST size of 10M # max POST size of 10M
httpd.projectVersion=projectVersion httpd.projectVersion=projectVersion
httpd.maxPostLength=1024*1024*10 httpd.maxPostLength=1024*1024*10

View File

@ -1269,4 +1269,4 @@ runDaemon(__version__, \
args.noannounce,args.cw,ocapAlways, \ args.noannounce,args.cw,ocapAlways, \
useTor,args.maxReplies, \ useTor,args.maxReplies, \
args.domainMaxPostsPerDay,args.accountMaxPostsPerDay, \ args.domainMaxPostsPerDay,args.accountMaxPostsPerDay, \
args.allowdeletion,debug) args.allowdeletion,debug,False)

View File

@ -981,7 +981,6 @@ def sendPost(projectVersion: str, \
if toDomain not in inboxUrl: if toDomain not in inboxUrl:
return 7 return 7
#postPath='/'+inboxUrl.split('/')[-1]
postPath=inboxUrl.split(toDomain)[1] postPath=inboxUrl.split(toDomain)[1]
# convert json to string so that there are no # convert json to string so that there are no
@ -1215,7 +1214,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
if debug: if debug:
print('DEBUG: '+toDomain+' is not in '+inboxUrl) print('DEBUG: '+toDomain+' is not in '+inboxUrl)
return 7 return 7
postPath='/'+inboxUrl.split('/')[-1] postPath=inboxUrl.split(toDomain)[1]
# convert json to string so that there are no # convert json to string so that there are no
# subsequent conversions after creating message body digest # subsequent conversions after creating message body digest

View File

@ -215,7 +215,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \
noreply,nolike,nopics,noannounce,cw,ocapAlways, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies, \ useTor,maxReplies, \
domainMaxPostsPerDay,accountMaxPostsPerDay, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \
allowDeletion,True) allowDeletion,True,True)
def createServerBob(path: str,domain: str,port: int,federationList: [], \ def createServerBob(path: str,domain: str,port: int,federationList: [], \
hasFollows: bool,hasPosts :bool,ocapAlways :bool): 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, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies, \ useTor,maxReplies, \
domainMaxPostsPerDay,accountMaxPostsPerDay, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \
allowDeletion,True) allowDeletion,True,True)
def createServerEve(path: str,domain: str,port: int,federationList: [], \ def createServerEve(path: str,domain: str,port: int,federationList: [], \
hasFollows: bool,hasPosts :bool,ocapAlways :bool): 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, \ runDaemon(__version__,"instanceId",False,path,domain,port,port, \
httpPrefix,federationList, \ httpPrefix,federationList, \
noreply,nolike,nopics,noannounce,cw,ocapAlways, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies,allowDeletion,True) useTor,maxReplies,allowDeletion,True,True)
def testPostMessageBetweenServers(): def testPostMessageBetweenServers():
print('Testing sending message from one server to the inbox of another') print('Testing sending message from one server to the inbox of another')