webfinger host-meta

master
Bob Mottram 2019-08-16 21:52:55 +01:00
parent 707cbd7d56
commit 9aa6527913
2 changed files with 14 additions and 6 deletions

View File

@ -186,7 +186,7 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.debug:
print('DEBUG: WEBFINGER host-meta')
if self.path.startswith('/.well-known/host-meta'):
wfResult=webfingerMeta()
wfResult=webfingerMeta(self.server.httpPrefix,self.server.domainFull)
if wfResult:
msg=wfResult.encode('utf-8')
self._set_headers('application/xrd+xml',len(msg),None)

View File

@ -140,17 +140,25 @@ def createWebfingerEndpoint(nickname: str,domain: str,port: int, \
}
return account
def webfingerMeta() -> str:
def webfingerMeta(httpPrefix: str,domainFull: str) -> str:
"""Return /.well-known/host-meta
"""
"""
return "<?xml version=1.0' encoding=UTF-8'?>" \
return \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
"<XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\">" \
"<Link rel=\"lrdd\" type=\"application/xrd+xml\" template=\""+httpPrefix+"://"+domainFull+"/.well-known/webfinger?resource={uri}\"/>" \
"</XRD>"
"<?xml version=1.0' encoding=UTF-8'?>" \
"<XRD xmlns=http://docs.oasis-open.org/ns/xri/xrd-1.0'" \
" xmlns:hm=http://host-meta.net/xrd/1.0'>" \
"" \
"<hm:Host>example.com</hm:Host>" \
"<hm:Host>"+domainFull+"</hm:Host>" \
"" \
"<Link rel=lrdd" \
" template=http://example.com/describe?uri={uri}'>" \
" template="+httpPrefix+"://"+domainFull+"/describe?uri={uri}'>" \
" <Title>Resource Descriptor</Title>" \
" </Link>" \
"</XRD>"