From 70c4b621cf20bb5b90b3fb6aa54d5adf20d34faf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 11 Jan 2018 14:55:29 +0100 Subject: [PATCH] input/curl: remove impossible "icy" checks The IcyMetaDataParser cannot be initialized already in OnHeaders(), because it will be initialized late in that method; and there will not be another OnHeaders() call, because streams with Icy metadata are not seekable, thus there will not be another HTTP request. --- src/input/plugins/CurlInputPlugin.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index b53faed07..63c6e7eb1 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -183,6 +183,7 @@ CurlInputStream::OnHeaders(unsigned status, { assert(GetEventLoop().IsInside()); assert(!postponed_exception); + assert(!icy || !icy->IsDefined()); if (status < 200 || status >= 300) throw FormatRuntimeError("got HTTP status %ld", status); @@ -195,9 +196,7 @@ CurlInputStream::OnHeaders(unsigned status, return; } - if (!icy->IsDefined() && - headers.find("accept-ranges") != headers.end()) - /* a stream with icy-metadata is not seekable */ + if (headers.find("accept-ranges") != headers.end()) seekable = true; auto i = headers.find("content-length"); @@ -222,7 +221,7 @@ CurlInputStream::OnHeaders(unsigned status, SetTag(tag_builder.CommitNew()); } - if (!icy->IsDefined()) { + if (icy) { i = headers.find("icy-metaint"); if (i != headers.end()) { @@ -429,6 +428,7 @@ void CurlInputStream::DoSeek(offset_type new_offset) { assert(IsReady()); + assert(seekable); const ScopeUnlock unlock(mutex);