| ... |
... |
@@ -21,6 +21,7 @@ sub- stanzas) handling routines |
|
21
|
21
|
import time
|
|
22
|
22
|
import hashlib
|
|
23
|
23
|
import socket
|
|
|
24
|
+import functools
|
|
24
|
25
|
from base64 import b64encode
|
|
25
|
26
|
|
|
26
|
27
|
from precis_i18n import get_profile
|
| ... |
... |
@@ -707,31 +708,32 @@ class DiscoInfoMalformed(Exception): |
|
707
|
708
|
pass
|
|
708
|
709
|
|
|
709
|
710
|
stream_exceptions = {'bad-format': BadFormat,
|
|
710
|
|
- 'bad-namespace-prefix': BadNamespacePrefix,
|
|
711
|
|
- 'conflict': Conflict,
|
|
712
|
|
- 'connection-timeout': ConnectionTimeout,
|
|
713
|
|
- 'host-gone': HostGone,
|
|
714
|
|
- 'host-unknown': HostUnknown,
|
|
715
|
|
- 'improper-addressing': ImproperAddressing,
|
|
716
|
|
- 'internal-server-error': InternalServerError,
|
|
717
|
|
- 'invalid-from': InvalidFrom,
|
|
718
|
|
- 'invalid-id': InvalidID,
|
|
719
|
|
- 'invalid-namespace': InvalidNamespace,
|
|
720
|
|
- 'invalid-xml': InvalidXML,
|
|
721
|
|
- 'not-authorized': NotAuthorized,
|
|
722
|
|
- 'policy-violation': PolicyViolation,
|
|
723
|
|
- 'remote-connection-failed': RemoteConnectionFailed,
|
|
724
|
|
- 'resource-constraint': ResourceConstraint,
|
|
725
|
|
- 'restricted-xml': RestrictedXML,
|
|
726
|
|
- 'see-other-host': SeeOtherHost,
|
|
727
|
|
- 'system-shutdown': SystemShutdown,
|
|
728
|
|
- 'undefined-condition': UndefinedCondition,
|
|
729
|
|
- 'unsupported-encoding': UnsupportedEncoding,
|
|
730
|
|
- 'unsupported-stanza-type': UnsupportedStanzaType,
|
|
731
|
|
- 'unsupported-version': UnsupportedVersion,
|
|
732
|
|
- 'xml-not-well-formed': XMLNotWellFormed}
|
|
733
|
|
-
|
|
734
|
|
-
|
|
|
711
|
+ 'bad-namespace-prefix': BadNamespacePrefix,
|
|
|
712
|
+ 'conflict': Conflict,
|
|
|
713
|
+ 'connection-timeout': ConnectionTimeout,
|
|
|
714
|
+ 'host-gone': HostGone,
|
|
|
715
|
+ 'host-unknown': HostUnknown,
|
|
|
716
|
+ 'improper-addressing': ImproperAddressing,
|
|
|
717
|
+ 'internal-server-error': InternalServerError,
|
|
|
718
|
+ 'invalid-from': InvalidFrom,
|
|
|
719
|
+ 'invalid-id': InvalidID,
|
|
|
720
|
+ 'invalid-namespace': InvalidNamespace,
|
|
|
721
|
+ 'invalid-xml': InvalidXML,
|
|
|
722
|
+ 'not-authorized': NotAuthorized,
|
|
|
723
|
+ 'policy-violation': PolicyViolation,
|
|
|
724
|
+ 'remote-connection-failed': RemoteConnectionFailed,
|
|
|
725
|
+ 'resource-constraint': ResourceConstraint,
|
|
|
726
|
+ 'restricted-xml': RestrictedXML,
|
|
|
727
|
+ 'see-other-host': SeeOtherHost,
|
|
|
728
|
+ 'system-shutdown': SystemShutdown,
|
|
|
729
|
+ 'undefined-condition': UndefinedCondition,
|
|
|
730
|
+ 'unsupported-encoding': UnsupportedEncoding,
|
|
|
731
|
+ 'unsupported-stanza-type': UnsupportedStanzaType,
|
|
|
732
|
+ 'unsupported-version': UnsupportedVersion,
|
|
|
733
|
+ 'xml-not-well-formed': XMLNotWellFormed}
|
|
|
734
|
+
|
|
|
735
|
+
|
|
|
736
|
+@functools.lru_cache(maxsize=None)
|
|
735
|
737
|
def parse_jid(jid):
|
|
736
|
738
|
# https://tools.ietf.org/html/rfc7622#section-3.2
|
|
737
|
739
|
|