Fix another port number bug

merge-requests/30/head
Bob Mottram 2020-12-16 11:38:40 +00:00
parent 7084a2059f
commit d853ba1978
2 changed files with 5 additions and 13 deletions

View File

@ -22,6 +22,7 @@ except ImportError:
import base64 import base64
from time import gmtime, strftime from time import gmtime, strftime
import datetime import datetime
from utils import getFullDomain
def messageContentDigest(messageBodyJsonStr: str) -> str: def messageContentDigest(messageBodyJsonStr: str) -> str:
@ -40,15 +41,9 @@ def signPostHeaders(dateStr: str, privateKeyPem: str,
"""Returns a raw signature string that can be plugged into a header and """Returns a raw signature string that can be plugged into a header and
used to verify the authenticity of an HTTP transmission. used to verify the authenticity of an HTTP transmission.
""" """
if port: domain = getFullDomain(domain, port)
if port != 80 and port != 443:
if ':' not in domain:
domain = domain + ':' + str(port)
if toPort: toDomain = getFullDomain(toDomain, toPort)
if toPort != 80 and toPort != 443:
if ':' not in toDomain:
toDomain = toDomain + ':' + str(port)
if not dateStr: if not dateStr:
dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime()) dateStr = strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())

View File

@ -10,6 +10,7 @@ from session import createSession
from webfinger import webfingerHandle from webfinger import webfingerHandle
from posts import getPersonBox from posts import getPersonBox
from posts import getPostDomains from posts import getPostDomains
from utils import getFullDomain
def instancesGraph(baseDir: str, handles: str, def instancesGraph(baseDir: str, handles: str,
@ -46,11 +47,7 @@ def instancesGraph(baseDir: str, handles: str,
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
domain = handle.split('@')[1] domain = handle.split('@')[1]
domainFull = domain domainFull = getFullDomain(domain, port)
if port:
if port != 80 and port != 443:
if ':' not in domain:
domainFull = domain + ':' + str(port)
handle = httpPrefix + "://" + domainFull + "/@" + nickname handle = httpPrefix + "://" + domainFull + "/@" + nickname
wfRequest = \ wfRequest = \
webfingerHandle(session, handle, httpPrefix, webfingerHandle(session, handle, httpPrefix,