diff options
author | morpheus65535 <[email protected]> | 2021-11-29 23:07:14 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2021-11-29 23:07:14 -0500 |
commit | c60c7513a5a776b2a15ac3a7b463d0ef9875cf04 (patch) | |
tree | 34a617dc4e93841387601fec4b74c75f07298d0a /libs/engineio/json.py | |
parent | a7a685491a42c2ff8327b9ac4a9328fd61012528 (diff) | |
download | bazarr-c60c7513a5a776b2a15ac3a7b463d0ef9875cf04.tar.gz bazarr-c60c7513a5a776b2a15ac3a7b463d0ef9875cf04.zip |
Upgraded engine.io module to improve socket.io connection stability. Should help to prevent #1613.v1.0.2-beta.0
Diffstat (limited to 'libs/engineio/json.py')
-rw-r--r-- | libs/engineio/json.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/engineio/json.py b/libs/engineio/json.py new file mode 100644 index 000000000..b61255683 --- /dev/null +++ b/libs/engineio/json.py @@ -0,0 +1,16 @@ +"""JSON-compatible module with sane defaults.""" + +from json import * # noqa: F401, F403 +from json import loads as original_loads + + +def _safe_int(s): + if len(s) > 100: + raise ValueError('Integer is too large') + return int(s) + + +def loads(*args, **kwargs): + if 'parse_int' not in kwargs: # pragma: no cover + kwargs['parse_int'] = _safe_int + return original_loads(*args, **kwargs) |