Permalink
Browse files

Merge pull request #2307 from ulion/fix_redirected_shoutcast_ticket_1…

…2729

Fix redirected shoutcast ticket 12729
  • Loading branch information...
2 parents a0e6bac + 452452b commit 593e07dcd8b36d4d0f4cfddccebfe00ae98af8fd @ulion ulion committed Feb 27, 2013
Showing with 8 additions and 0 deletions.
  1. +7 −0 xbmc/filesystem/CurlFile.cpp
  2. +1 −0 xbmc/filesystem/ShoutcastFile.cpp
@@ -575,6 +575,13 @@ void CCurlFile::SetCommonOptions(CReadState* state)
// Set the lowspeed time very low as it seems Curl takes much longer to detect a lowspeed condition
g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_TIME, m_lowspeedtime);
+
+ if (m_skipshout)
+ // For shoutcast file, content-length should not be set, and in libcurl there is a bug, if the
+ // cast file was 302 redirected then getinfo of CURLINFO_CONTENT_LENGTH_DOWNLOAD will return
+ // the 302 response's body length, which cause the next read request failed, so we ignore
+ // content-length for shoutcast file to workaround this.
+ g_curlInterface.easy_setopt(h, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
}
void CCurlFile::SetRequestHeaders(CReadState* state)
@@ -134,6 +134,7 @@ void CShoutcastFile::Close()
{
StopThread();
delete[] m_buffer;
+ m_buffer = NULL;
m_file.Close();
}

0 comments on commit 593e07d

Please sign in to comment.