fix(cast): pin http to 1.4.0 so DLNA renderers stop vanishing
rupnp parses a device description's SCPDURL / controlURL / eventSubURL as http::uri::PathAndQuery. http 1.5.0 rewrote scan_path_and_query and now rejects two shapes 1.4.0 accepted: an empty element (ErrorKind::Empty, printed as "empty string") and any relative URL without a leading slash (PathDoesNotStartWithSlash). Both are common in old UPnP firmware, so the transitive bump made rupnp drop those renderers during discovery. Measured in the lockfiles: v2.0.2 resolved http 1.4.0, v2.1.0 resolved 1.5.0, and nothing in qbz-cast changed between them. A KEF LSX gen 1 that worked in 2.0.2 reported "Visible Renderers: 0" in 2.1.0 with "Invalid response: empty string", which is exactly InvalidResponse(InvalidUri(Empty)) reproduced by the new test. qbz-cast takes http as a direct dependency at "=1.4.0" so cargo unifies the workspace on it, and device.rs now uses that crate instead of the rupnp re-export. The new integration test serves two renderer descriptions over loopback, one with empty and one with relative service sub-URLs, and requires both to parse: it is red on 1.5.0 and green on 1.4.0, so it fails loudly if the pin is ever lifted. test-crates and its local mirror gain the named gate. Closes-when-confirmed: #745 cc
This commit is contained in:
6 files changed
+172
-4
No files matched your search
@@ -13,7 +13,10 @@
|
|||||||
# proto3-zero cursor, manual skip/loop/shuffle/autoplay and
|
# proto3-zero cursor, manual skip/loop/shuffle/autoplay and
|
||||||
# consecutive-log repetition regression checks, plus SACD
|
# consecutive-log repetition regression checks, plus SACD
|
||||||
# 2048/2064-sector TOC/frame/seek equivalence and scanner import/
|
# 2048/2064-sector TOC/frame/seek equivalence and scanner import/
|
||||||
# failed-read preservation. ~5 min cold.
|
# failed-read preservation, plus the DLNA device-description
|
||||||
|
# tolerance suite (empty and relative SCPDURL/controlURL must
|
||||||
|
# still parse — the guard on qbz-cast's http =1.4.0 pin, #745).
|
||||||
|
# ~5 min cold.
|
||||||
# qt-gate — the Qt frontend: the five static QML audits, `cargo test -p
|
# qt-gate — the Qt frontend: the five static QML audits, `cargo test -p
|
||||||
# qbz-qt`, the Slint-free dep-graph gate, and an OFFSCREEN BOOT of
|
# qbz-qt`, the Slint-free dep-graph gate, and an OFFSCREEN BOOT of
|
||||||
# debug AND release binaries (including process liveness).
|
# debug AND release binaries (including process liveness).
|
||||||
|
|||||||
Generated
+3
-2
@@ -2115,9 +2115,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "1.5.0"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
|
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -4128,6 +4128,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
|
"http",
|
||||||
"log",
|
"log",
|
||||||
"mdns-sd",
|
"mdns-sd",
|
||||||
"rupnp",
|
"rupnp",
|
||||||
|
|||||||
@@ -18,6 +18,19 @@ tiny_http = "0.12"
|
|||||||
rupnp = { version = "3", features = ["full_device_spec"] }
|
rupnp = { version = "3", features = ["full_device_spec"] }
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
|
|
||||||
|
# PINNED, do not bump without reading this (#745, 2.1.0 regression):
|
||||||
|
# rupnp parses a device description's SCPDURL / controlURL / eventSubURL as
|
||||||
|
# `http::uri::PathAndQuery`. http 1.5.0 rewrote that parser and now REJECTS
|
||||||
|
# two shapes 1.4.0 accepted -- an empty element (ErrorKind::Empty, printed as
|
||||||
|
# "empty string") and any relative URL without a leading slash
|
||||||
|
# (PathDoesNotStartWithSlash). Both are common in old UPnP firmware, so the
|
||||||
|
# bump made rupnp drop those renderers entirely: a KEF LSX gen 1 that worked
|
||||||
|
# in 2.0.2 (http 1.4.0) reported "Visible Renderers: 0" in 2.1.0. The pin is
|
||||||
|
# workspace-wide by unification and is guarded by
|
||||||
|
# tests/dlna_description_tolerance.rs -- if that suite fails, this pin was
|
||||||
|
# lifted. Drop it only once rupnp stops using PathAndQuery for relative URLs.
|
||||||
|
http = "=1.4.0"
|
||||||
|
|
||||||
# Serialization
|
# Serialization
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
@@ -33,3 +46,6 @@ getrandom = "0.4"
|
|||||||
|
|
||||||
# Async runtime (for DLNA)
|
# Async runtime (for DLNA)
|
||||||
tokio = { version = "1", features = ["rt", "sync"] }
|
tokio = { version = "1", features = ["rt", "sync"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
tokio = { version = "1", features = ["rt", "macros"] }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
//! DLNA device connection and playback via AVTransport SOAP
|
//! DLNA device connection and playback via AVTransport SOAP
|
||||||
|
|
||||||
use rupnp::http::Uri;
|
use http::Uri;
|
||||||
use rupnp::{Device, Service};
|
use rupnp::{Device, Service};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
//! Regression gate for #745 — DLNA renderers vanished in 2.1.0.
|
||||||
|
//!
|
||||||
|
//! A KEF LSX (gen 1) answered the SSDP M-SEARCH but was dropped with
|
||||||
|
//! `Invalid response: empty string` while fetching its device description.
|
||||||
|
//! The cause is not the network: `rupnp` parses `SCPDURL` / `controlURL` /
|
||||||
|
//! `eventSubURL` as `http::uri::PathAndQuery`, and `http` 1.5.0 started
|
||||||
|
//! rejecting inputs that 1.4.0 accepted — an empty element, and any relative
|
||||||
|
//! URL without a leading slash. Both shapes are common in old UPnP firmware.
|
||||||
|
//!
|
||||||
|
//! These tests serve a description locally and assert the device still parses.
|
||||||
|
//! They fail with `http` 1.5.0 and pass with 1.4.0.
|
||||||
|
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
use std::thread::JoinHandle;
|
||||||
|
|
||||||
|
/// Renderer description whose services carry EMPTY sub-URLs.
|
||||||
|
const EMPTY_SERVICE_URLS: &str = r#"<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root xmlns="urn:schemas-upnp-org:device-1-0">
|
||||||
|
<specVersion><major>1</major><minor>0</minor></specVersion>
|
||||||
|
<device>
|
||||||
|
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
|
||||||
|
<friendlyName>KEF LSX</friendlyName>
|
||||||
|
<manufacturer>KEF</manufacturer>
|
||||||
|
<modelName>LSX</modelName>
|
||||||
|
<UDN>uuid:00000000-0000-0000-0000-000000000745</UDN>
|
||||||
|
<serviceList>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
|
||||||
|
<SCPDURL></SCPDURL>
|
||||||
|
<controlURL>/AVTransport/control</controlURL>
|
||||||
|
<eventSubURL>/AVTransport/event</eventSubURL>
|
||||||
|
</service>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
|
||||||
|
<SCPDURL></SCPDURL>
|
||||||
|
<controlURL>/RenderingControl/control</controlURL>
|
||||||
|
<eventSubURL>/RenderingControl/event</eventSubURL>
|
||||||
|
</service>
|
||||||
|
</serviceList>
|
||||||
|
</device>
|
||||||
|
</root>
|
||||||
|
"#;
|
||||||
|
|
||||||
|
/// Renderer description whose services carry RELATIVE sub-URLs (no leading
|
||||||
|
/// slash) — the other shape `http` 1.5.0 turned into a hard error.
|
||||||
|
const RELATIVE_SERVICE_URLS: &str = r#"<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root xmlns="urn:schemas-upnp-org:device-1-0">
|
||||||
|
<specVersion><major>1</major><minor>0</minor></specVersion>
|
||||||
|
<device>
|
||||||
|
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
|
||||||
|
<friendlyName>Legacy Renderer</friendlyName>
|
||||||
|
<manufacturer>Acme</manufacturer>
|
||||||
|
<modelName>Streamer</modelName>
|
||||||
|
<UDN>uuid:00000000-0000-0000-0000-000000000733</UDN>
|
||||||
|
<serviceList>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
|
||||||
|
<SCPDURL>MediaRenderer/AVTransport/desc.xml</SCPDURL>
|
||||||
|
<controlURL>MediaRenderer/AVTransport/control</controlURL>
|
||||||
|
<eventSubURL>MediaRenderer/AVTransport/event</eventSubURL>
|
||||||
|
</service>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
|
||||||
|
<SCPDURL>MediaRenderer/RenderingControl/desc.xml</SCPDURL>
|
||||||
|
<controlURL>MediaRenderer/RenderingControl/control</controlURL>
|
||||||
|
<eventSubURL>MediaRenderer/RenderingControl/event</eventSubURL>
|
||||||
|
</service>
|
||||||
|
</serviceList>
|
||||||
|
</device>
|
||||||
|
</root>
|
||||||
|
"#;
|
||||||
|
|
||||||
|
/// Serve `body` once on an ephemeral loopback port, like the renderer would.
|
||||||
|
fn serve_once(body: &'static str) -> (SocketAddr, JoinHandle<()>) {
|
||||||
|
let server = tiny_http::Server::http("127.0.0.1:0").expect("bind loopback");
|
||||||
|
let addr = server
|
||||||
|
.server_addr()
|
||||||
|
.to_ip()
|
||||||
|
.expect("loopback listener has an ip");
|
||||||
|
|
||||||
|
let handle = std::thread::spawn(move || {
|
||||||
|
if let Ok(request) = server.recv() {
|
||||||
|
let response = tiny_http::Response::from_string(body).with_header(
|
||||||
|
tiny_http::Header::from_bytes(&b"Content-Type"[..], &b"text/xml"[..])
|
||||||
|
.expect("static header"),
|
||||||
|
);
|
||||||
|
let _ = request.respond(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(addr, handle)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn parse_description(body: &'static str) -> rupnp::Device {
|
||||||
|
let (addr, handle) = serve_once(body);
|
||||||
|
let url: http::Uri = format!("http://{addr}/description.xml")
|
||||||
|
.parse()
|
||||||
|
.expect("loopback url");
|
||||||
|
|
||||||
|
let device = rupnp::Device::from_url(url)
|
||||||
|
.await
|
||||||
|
.expect("a MediaRenderer description must parse");
|
||||||
|
|
||||||
|
handle.join().expect("description server thread");
|
||||||
|
device
|
||||||
|
}
|
||||||
|
|
||||||
|
fn has_service(device: &rupnp::Device, needle: &str) -> bool {
|
||||||
|
device
|
||||||
|
.services_iter()
|
||||||
|
.any(|service| service.service_type().to_string().contains(needle))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn description_with_empty_service_urls_still_parses() {
|
||||||
|
let device = parse_description(EMPTY_SERVICE_URLS).await;
|
||||||
|
|
||||||
|
assert_eq!(device.friendly_name(), "KEF LSX");
|
||||||
|
assert!(has_service(&device, ":service:AVTransport:"));
|
||||||
|
assert!(has_service(&device, ":service:RenderingControl:"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn description_with_relative_service_urls_still_parses() {
|
||||||
|
let device = parse_description(RELATIVE_SERVICE_URLS).await;
|
||||||
|
|
||||||
|
assert_eq!(device.friendly_name(), "Legacy Renderer");
|
||||||
|
assert!(has_service(&device, ":service:AVTransport:"));
|
||||||
|
assert!(has_service(&device, ":service:RenderingControl:"));
|
||||||
|
}
|
||||||
@@ -15,6 +15,9 @@
|
|||||||
# and pass (schema migration, accumulator: paused/seek/stall deltas add
|
# and pass (schema migration, accumulator: paused/seek/stall deltas add
|
||||||
# nothing, natural/skip/stop/shutdown closes, orphan close on reopen,
|
# nothing, natural/skip/stop/shutdown closes, orphan close on reopen,
|
||||||
# paused writes nothing, clear + VACUUM, is_play/is_skip bounds).
|
# paused writes nothing, clear + VACUUM, is_play/is_skip bounds).
|
||||||
|
# + the DLNA device-description tolerance suite (qbz-cast): a renderer whose
|
||||||
|
# SCPDURL/controlURL/eventSubURL is empty or relative must still parse.
|
||||||
|
# It is the guard on qbz-cast's `http = "=1.4.0"` pin (#745).
|
||||||
# --workspace today = the 42 members of crates/Cargo.toml minus qbz-qt: the
|
# --workspace today = the 42 members of crates/Cargo.toml minus qbz-qt: the
|
||||||
# audio/player/cache/DSD/disc/rip core, qbz-app/core/models/theme/i18n,
|
# audio/player/cache/DSD/disc/rip core, qbz-app/core/models/theme/i18n,
|
||||||
# the Qobuz client and the source seam, Plex/Jellyfin/Subsonic + media
|
# the Qobuz client and the source seam, Plex/Jellyfin/Subsonic + media
|
||||||
@@ -130,6 +133,17 @@ cargo test --manifest-path crates/Cargo.toml -p qconnect-app --lib -- queue_reso
|
|||||||
cargo test --manifest-path crates/Cargo.toml -p qconnect-protocol --lib -- decoder::tests::controller_
|
cargo test --manifest-path crates/Cargo.toml -p qconnect-protocol --lib -- decoder::tests::controller_
|
||||||
cargo test --manifest-path crates/Cargo.toml -p qbz-log --lib -- repeat::tests::
|
cargo test --manifest-path crates/Cargo.toml -p qbz-log --lib -- repeat::tests::
|
||||||
|
|
||||||
|
say "gate: DLNA device-description tolerance present and green (#745)"
|
||||||
|
# rupnp parses SCPDURL/controlURL/eventSubURL as http::uri::PathAndQuery, and
|
||||||
|
# http 1.5.0 started rejecting empty and non-slash-prefixed values that 1.4.0
|
||||||
|
# accepted -- which silently dropped every renderer with that firmware shape
|
||||||
|
# (KEF LSX gen 1, "Visible Renderers: 0" in 2.1.0). qbz-cast pins http to
|
||||||
|
# =1.4.0; this suite is the guard that notices if the pin is ever lifted.
|
||||||
|
n=$(cargo test --manifest-path crates/Cargo.toml -p qbz-cast --test dlna_description_tolerance -- --list 2>/dev/null \
|
||||||
|
| grep -c ': test$' || true)
|
||||||
|
(( n >= 2 )) || { echo "DLNA description tolerance suite has $n tests (expected >= 2)"; exit 1; }
|
||||||
|
cargo test --manifest-path crates/Cargo.toml -p qbz-cast --test dlna_description_tolerance
|
||||||
|
|
||||||
say "gate: qbzd resolves no Slint crate"
|
say "gate: qbzd resolves no Slint crate"
|
||||||
hits=$(cargo tree --manifest-path crates/Cargo.toml -p qbzd -e normal \
|
hits=$(cargo tree --manifest-path crates/Cargo.toml -p qbzd -e normal \
|
||||||
| grep -E '\b(slint|qbz-ui|qbz-slint-common|qbz-dac-wizard) v' || true)
|
| grep -E '\b(slint|qbz-ui|qbz-slint-common|qbz-dac-wizard) v' || true)
|
||||||
|
|||||||
Reference in new issue
Block a user