Repository navigation
Fix request handling robustness issues - #1554
Merged
Merged
Conversation
- Look up the API servers with query_dns(); query() is deprecated in aiodns 4. A failed lookup, or one without SRV records, now raises a RadioBrowserConnectionError (and is retried) instead of leaking a raw DNSError. - Escape filter_term and the station UUID in the request path. Terms like "#original" or "AC/DC" used to change the URL, returning unrelated stations or a 404. - Read the response body within the request timeout. - Raise a RadioBrowserError on 4xx responses without retrying; only 5xx responses are retried. - Turn empty comma separated fields into empty lists instead of [""]. - Fix a few docstring typos and the countries() return description. aiodns now needs to be at least 4.0, and pycares is a direct dependency.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Mostly bugfixes, but a few behaviors change:
aiodnsnow needs to be at least 4.0 (forquery_dns()), andpycares5.0 or newer is a direct dependency. Home Assistant already shipsaiodns==4.0.4.RadioBrowserErrorright away. It used to raise aRadioBrowserConnectionErrorafter five retries. Code that catchesRadioBrowserError(like Home Assistant does) is not affected.RadioBrowserConnectionErrorinstead of a rawaiodns.error.DNSError.tags,language,language_codes) are now[]instead of[""].Proposed change
A set of robustness fixes in the request handling, each with tests.
DNS lookup. The API servers are found through DNS SRV records. That lookup used
query(), which is deprecated in aiodns 4, and its errors were not caught at all: aDNSErrorleaked straight to the caller (Home Assistant catches it separately for that reason) and was never retried. The lookup now usesquery_dns(), lives in its own_resolve_host(), raises aRadioBrowserConnectionErroron failure or when no SRV records come back, and ignores records that are not SRV.Escaping.
filter_termwas joined into the path as is. Checked against the live API:Home Assistant browses stations by tag through exactly this path. The filter term and the station UUID are now escaped.
Timeout. The response body was read outside of the
asyncio.timeoutblock, so a server that sent headers and then stalled could hang a request forever.Retries.
raise_for_statusturned every HTTP error into a connection error, so a 404 was retried five times and made the client forget its server. A 4xx now raises aRadioBrowserErrorright away; a 5xx is still retried, since another server may do better.Models. An empty comma separated field became
[""]. It is now an empty list.Plus a few docstring typos, and
countries()no longer claims to return a Stats object.Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).