Support draft/sts
as well as sts
This commit is contained in:
parent
5b2c979649
commit
edbacce1fc
1 changed files with 9 additions and 7 deletions
|
@ -26,12 +26,14 @@ class Module(ModuleManager.BaseModule):
|
||||||
port = int(info["port"])
|
port = int(info["port"])
|
||||||
self._set_policy(server, port, duration, False)
|
self._set_policy(server, port, duration, False)
|
||||||
|
|
||||||
|
def _get_sts(self, capabilities):
|
||||||
|
return capabilities.get("sts", capabilities.get("draft/sts", None))
|
||||||
|
|
||||||
@utils.hook("received.cap.ls")
|
@utils.hook("received.cap.ls")
|
||||||
def on_cap_ls(self, event):
|
def on_cap_ls(self, event):
|
||||||
has_sts = "sts" in event["capabilities"]
|
sts = self._get_sts(event["capabilities"])
|
||||||
if "sts" in event["capabilities"]:
|
if sts:
|
||||||
info = utils.parse.keyvalue(event["capabilities"]["sts"],
|
info = utils.parse.keyvalue(sts, delimiter=",")
|
||||||
delimiter=",")
|
|
||||||
if not event["server"].tls:
|
if not event["server"].tls:
|
||||||
self._set_policy(event["server"], int(info["port"]),
|
self._set_policy(event["server"], int(info["port"]),
|
||||||
None, True)
|
None, True)
|
||||||
|
@ -41,9 +43,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
@utils.hook("received.cap.new")
|
@utils.hook("received.cap.new")
|
||||||
def on_cap_new(self, event):
|
def on_cap_new(self, event):
|
||||||
if "sts" in event["capabilities"] and event["server"].tls:
|
sts = self._get_sts(event["capabilities"])
|
||||||
info = utils.parse.keyvalue(event["capabilities"]["sts"],
|
if sts and event["server"].tls:
|
||||||
delimiter=",")
|
info = utils.parse.keyvalue(sts, delimiter=",")
|
||||||
if event["server"].tls:
|
if event["server"].tls:
|
||||||
self._change_duration(event["server"], info)
|
self._change_duration(event["server"], info)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue