From 590dcb27f64847a15e2822f028d2d7d2bede902e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Dec 2009 22:12:18 +0100 Subject: [PATCH] Slim/Web/HTTP: return the proper stream Content-Type The stream URI is always "/stream.mp3", which makes the generateHTTPResponse() method assume that the Content-Type must be "audio/mpeg" (according to typeFromSuffix()). The method does not check which kind of file is really being served, breaking strict music players (such as the Music Player Daemon). This patch checks the song URL, and re-checks it with typeFromSuffix(), overriding the previous uninformed guess. --- server/Slim/Web/HTTP.pm | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/server/Slim/Web/HTTP.pm b/server/Slim/Web/HTTP.pm index 74c4976..b8f1f06 100644 --- a/server/Slim/Web/HTTP.pm +++ b/server/Slim/Web/HTTP.pm @@ -1116,6 +1116,12 @@ sub generateHTTPResponse { main::PERFMON && $startTime && Slim::Utils::PerfMon->check('web', AnyEvent->time - $startTime, "Page: $path"); } elsif ($path =~ /^(?:stream\.mp3|stream)$/o) { + if (my $sc = $client->controller()->songStreamController()) { + if (my $song = $sc->song()) { + my $type = Slim::Music::Info::typeFromSuffix($song->streamUrl(), 'mp3'); + $response->content_type($Slim::Music::Info::types{$type}); + } + } # short circuit here if it's a slim/squeezebox if ($sendMetaData{$httpClient}) { -- 1.6.5.7