From 0f81a080a8f1f7f68e06f78ed93049f97ea2fc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sat, 28 Sep 2019 22:31:43 +0200 Subject: [PATCH 1/2] Improve address normalization in connection manager --- .../lib/jellyfin/core/connection_manager.py | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/resources/lib/jellyfin/core/connection_manager.py b/resources/lib/jellyfin/core/connection_manager.py index 9875694c..410f9f80 100644 --- a/resources/lib/jellyfin/core/connection_manager.py +++ b/resources/lib/jellyfin/core/connection_manager.py @@ -4,12 +4,13 @@ import json import logging -import hashlib import socket import time from datetime import datetime from distutils.version import LooseVersion +import urllib3 + from credentials import Credentials from http import HTTP @@ -109,7 +110,7 @@ class ConnectionManager(object): if not server: raise AttributeError("server cannot be empty") - + try: request = { 'type': "POST", @@ -134,6 +135,8 @@ class ConnectionManager(object): if not address: return False + address = self._normalize_address(address) + def _on_fail(): LOG.error("connectToAddress %s failed", address) return self._resolve_failure() @@ -470,13 +473,18 @@ class ConnectionManager(object): def _normalize_address(self, address): # Attempt to correct bad input - address = address.strip() - address = address.lower() + url = urllib3.util.parse_url(address.strip()) - if 'http' not in address: - address = "http://%s" % address + if url.scheme is None: + url = url._replace(scheme='http') - return address + if url.scheme == 'http' and url.port == 80: + url = url._replace(port=None) + + if url.scheme == 'https' and url.port == 443: + url = url._replace(port=None) + + return url.url def _save_user_info_into_credentials(self, server, user): From fce900bd0d22b61b39e23866bf91099f435b0fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sat, 28 Sep 2019 23:46:11 +0200 Subject: [PATCH 2/2] Bump version for 0.3.2 --- addon.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index dcd5bca9..d0d5d8ae 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ @@ -36,9 +36,9 @@ Welcome to Jellyfin for Kodi! A whole new way to manage and view your media library. The Jellyfin addon for Kodi combines the best of Kodi - ultra smooth navigation, beautiful UIs and playback of any file under the sun, and Jellyfin - the most powerful fully open source multi-client media metadata indexer and server. Jellyfin for Kodi is the absolute best way to enjoy the incredible Kodi playback engine combined with the power of Jellyfin's centralized database. Features: * Direct integration with the Kodi library for native Kodi speed * Instant synchronization with the Jellyfin server * Full support for Movie, TV and Music collections * Jellyfin Server direct stream and transcoding support - use Kodi when you are away from home! - v0.3.1 (2019-09-28) - #90 Fix incremental sync never finishing - #89 Make basic auth login case insensitive + v0.3.2 (2019-09-28) + #94 Improve address normalization in connection manager + #93 Remove stray single quote resulting in crash resources/icon.png