Skip to content

Commit

Permalink
URI is RFC3986 and is escape encoded. Must decode it before using it.
Browse files Browse the repository at this point in the history
Fixes #11307
  • Loading branch information
jyavenard committed Dec 27, 2012
1 parent d408cca commit a99e92c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
Expand Up @@ -56,6 +56,13 @@ enum

/* utility methods */

static QString decoded_URI(QString uri)
{
QByteArray ba = uri.toAscii();
QUrl url = QUrl::fromEncoded(ba);
return url.toString();
}

static QString relative_URI(QString &surl, QString &spath)
{
QUrl url = QUrl(surl);
Expand Down Expand Up @@ -1976,7 +1983,8 @@ int HLSRingBuffer::ParseKey(HLSStream *hls, QString &line)
}

/* Url is between quotes, remove them */
hls->SetKeyPath(uri.remove(QChar(QLatin1Char('"'))));
QString url = decoded_URI(uri.remove(QChar(QLatin1Char('"'))));
hls->SetKeyPath(url);

iv = ParseAttributes(line, "IV");
if (!hls->SetAESIV(iv))
Expand Down Expand Up @@ -2163,7 +2171,8 @@ int HLSRingBuffer::ParseM3U8(const QByteArray *buffer, StreamsList *streams)
}
else
{
HLSStream *hls = ParseStreamInformation(line, uri);
QString url = decoded_URI(uri);
HLSStream *hls = ParseStreamInformation(line, url);
if (hls)
{
/* Download playlist file from server */
Expand Down Expand Up @@ -2259,7 +2268,8 @@ int HLSRingBuffer::ParseM3U8(const QByteArray *buffer, StreamsList *streams)
err = ParseEndList(hls);
else if (!line.startsWith(QLatin1String("#")) && !line.isEmpty())
{
hls->AddSegment(segment_duration, title, line);
QString url = decoded_URI(line);
hls->AddSegment(segment_duration, title, url);
segment_duration = -1; /* reset duration */
title = "";
}
Expand Down

0 comments on commit a99e92c

Please sign in to comment.