jellyfin / jellyfin-mpv-shim

MPV Cast Client for Jellyfin
Other
1.65k stars 95 forks source link

Cannot resolve IPv6 address on Windows #398

Open twisteroidambassador opened 5 months ago

twisteroidambassador commented 5 months ago

Describe the bug

On Windows 10, when adding a server using a domain name that only resolves to an IPv6 address, an error pops up saying "Could not add server. Please check your connection information."

Adding servers using domain names that resolves to an IPv4 address, or using bare IPv6 literal (like https://[fe00:0001::1]), does not have the same problem.

In the logs attached below, it can be seen that the connection fails with socket.gaierror: [Errno 11002] getaddrinfo failed. The domain name is resolvable on the same computer when running socket.getaddrinfo manually in a Python shell.

To Reproduce Steps to reproduce the behavior:

  1. Prepare a host name that resolves only to IPv6 addresses
  2. On the "Server Configuration" screen, add this host name as Server. Fill in username and password as necessary.
  3. Click "Add Server".
  4. An error pops up.

Expected behavior Should be able to add such a server.

Desktop (please complete the following information):

Error Messages

2024-06-20 21:19:22,930 [    INFO] JELLYFIN.jellyfin_apiclient_python.api: Sending get request to system/info/public
2024-06-20 21:19:24,416 [    INFO] JELLYFIN.jellyfin_apiclient_python.connection_manager: connect_to_address https://jellyfin.<domain redacted> succeeded
2024-06-20 21:19:24,416 [    INFO] JELLYFIN.jellyfin_apiclient_python.connection_manager: begin connect_to_server
2024-06-20 21:19:24,420 [    INFO] JELLYFIN.jellyfin_apiclient_python.api: Sending get request to system/info/public
2024-06-20 21:19:24,432 [   ERROR] JELLYFIN.jellyfin_apiclient_python.connection_manager: Traceback (most recent call last):
  File "urllib3\connection.py", line 198, in _new_conn
  File "urllib3\util\connection.py", line 60, in create_connection
  File "socket.py", line 954, in getaddrinfo
socket.gaierror: [Errno 11002] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "urllib3\connectionpool.py", line 793, in urlopen
  File "urllib3\connectionpool.py", line 491, in _make_request
  File "urllib3\connectionpool.py", line 467, in _make_request
  File "urllib3\connectionpool.py", line 1099, in _validate_conn
  File "urllib3\connection.py", line 616, in connect
  File "urllib3\connection.py", line 205, in _new_conn
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x00000268B6483040>: Failed to resolve 'jellyfin.<domain redacted>' ([Errno 11002] getaddrinfo failed)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "requests\adapters.py", line 667, in send
  File "urllib3\connectionpool.py", line 847, in urlopen
  File "urllib3\util\retry.py", line 515, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='jellyfin.<domain redacted>', port=443): Max retries exceeded with url: /system/info/public (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000268B6483040>: Failed to resolve 'jellyfin.<domain redacted>' ([Errno 11002] getaddrinfo failed)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "jellyfin_apiclient_python\connection_manager.py", line 176, in connect_to_server
  File "jellyfin_apiclient_python\api.py", line 585, in get_public_info
  File "jellyfin_apiclient_python\api.py", line 544, in send_request
  File "requests\api.py", line 73, in get
  File "requests\api.py", line 59, in request
  File "requests\sessions.py", line 589, in request
  File "requests\sessions.py", line 703, in send
  File "requests\adapters.py", line 700, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='jellyfin.<domain redacted>', port=443): Max retries exceeded with url: /system/info/public (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000268B6483040>: Failed to resolve 'jellyfin.<domain redacted>' ([Errno 11002] getaddrinfo failed)"))

2024-06-20 21:19:24,433 [   ERROR] JELLYFIN.jellyfin_apiclient_python.connection_manager: Failing server connection. ERROR msg: HTTPSConnectionPool(host='jellyfin.<domain redacted>', port=443): Max retries exceeded with url: /system/info/public (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000268B6483040>: Failed to resolve 'jellyfin.<domain redacted>' ([Errno 11002] getaddrinfo failed)"))
2024-06-20 21:19:24,433 [    INFO] JELLYFIN.jellyfin_apiclient_python.api: Trying to login to https://jellyfin.<domain redacted>/Users/AuthenticateByName as ambassador
2024-06-20 21:19:24,433 [    INFO] JELLYFIN.jellyfin_apiclient_python.api: Sending post request to Users/AuthenticateByName
2024-06-20 21:19:24,438 [   ERROR] JELLYFIN.jellyfin_apiclient_python.api: HTTPSConnectionPool(host='jellyfin.<domain redacted>', port=443): Max retries exceeded with url: /Users/AuthenticateByName (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000268B64A3190>: Failed to resolve 'jellyfin.<domain redacted>' ([Errno 11002] getaddrinfo failed)"))
2024-06-20 21:19:24,438 [    INFO] JELLYFIN.jellyfin_apiclient_python.connection_manager: Failed to login as `user`