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.
This commit is contained in:
Max Kellermann 2018-01-11 14:55:29 +01:00
parent a8df5e109b
commit 70c4b621cf

View File

@ -183,6 +183,7 @@ CurlInputStream::OnHeaders(unsigned status,
{ {
assert(GetEventLoop().IsInside()); assert(GetEventLoop().IsInside());
assert(!postponed_exception); assert(!postponed_exception);
assert(!icy || !icy->IsDefined());
if (status < 200 || status >= 300) if (status < 200 || status >= 300)
throw FormatRuntimeError("got HTTP status %ld", status); throw FormatRuntimeError("got HTTP status %ld", status);
@ -195,9 +196,7 @@ CurlInputStream::OnHeaders(unsigned status,
return; return;
} }
if (!icy->IsDefined() && if (headers.find("accept-ranges") != headers.end())
headers.find("accept-ranges") != headers.end())
/* a stream with icy-metadata is not seekable */
seekable = true; seekable = true;
auto i = headers.find("content-length"); auto i = headers.find("content-length");
@ -222,7 +221,7 @@ CurlInputStream::OnHeaders(unsigned status,
SetTag(tag_builder.CommitNew()); SetTag(tag_builder.CommitNew());
} }
if (!icy->IsDefined()) { if (icy) {
i = headers.find("icy-metaint"); i = headers.find("icy-metaint");
if (i != headers.end()) { if (i != headers.end()) {
@ -429,6 +428,7 @@ void
CurlInputStream::DoSeek(offset_type new_offset) CurlInputStream::DoSeek(offset_type new_offset)
{ {
assert(IsReady()); assert(IsReady());
assert(seekable);
const ScopeUnlock unlock(mutex); const ScopeUnlock unlock(mutex);