aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2016-09-13 22:36:06 +0200
committerGitHub <noreply@github.com>2016-09-13 22:36:06 +0200
commit8d4a5bba55638dfd0bdc5e7de34f3e5293f99933 (patch)
treebea5198ac19b324a5a0e0049ee2e8788a0807bbe
parentabf1aa5d055de9d167134e0caca47fde4e403e86 (diff)
parentb6f50c4881ede8f244d94ffa9422b1629c2772a2 (diff)
Merge pull request #10458 from FernetMenta/headers
VideoPlayer: fix some remaining http header issues
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp27
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp11
2 files changed, 25 insertions, 13 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 23bcb080fa..8460e27865 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -646,7 +646,8 @@ AVDictionary *CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput()
bool hasCookies = false;
for(std::map<std::string, std::string>::const_iterator it = protocolOptions.begin(); it != protocolOptions.end(); ++it)
{
- std::string name = it->first; StringUtils::ToLower(name);
+ std::string name = it->first;
+ StringUtils::ToLower(name);
const std::string &value = it->second;
if (name == "seekable")
@@ -660,24 +661,30 @@ AVDictionary *CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput()
}
else if (name == "cookie")
{
- av_dict_set(&options, "cookies", value.c_str(), 0);
CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding ffmpeg option 'cookies: %s'", value.c_str());
+ headers.append(it->first).append(": ").append(value).append("\r\n");
hasCookies = true;
}
// other standard headers (see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields) are appended as actual headers
else if (name == "accept" || name == "accept-language" || name == "accept-datetime" ||
- name == "authorization" || name == "cache-control" || name == "connection" || name == "content-md5" ||
- name == "date" || name == "expect" || name == "forwarded" || name == "from" || name == "if-match" ||
- name == "if-modified-since" || name == "if-none-match" || name == "if-range" || name == "if-unmodified-since" || name == "max-forwards" ||
- name == "origin" || name == "pragma" || name == "range" || name == "referer" || name == "te" || name == "upgrade" ||
- name == "via" || name == "warning" || name == "x-requested-with" || name == "dnt" || name == "x-forwarded-for" || name == "x-forwarded-host" ||
- name == "x-forwarded-proto" || name == "front-end-https" || name == "x-http-method-override" || name == "x-att-deviceid" ||
- name == "x-wap-profile" || name == "x-uidh" || name == "x-csrf-token" || name == "x-request-id" || name == "x-correlation-id")
+ name == "authorization" || name == "cache-control" || name == "connection" || name == "content-md5" ||
+ name == "date" || name == "expect" || name == "forwarded" || name == "from" || name == "if-match" ||
+ name == "if-modified-since" || name == "if-none-match" || name == "if-range" || name == "if-unmodified-since" ||
+ name == "max-forwards" || name == "origin" || name == "pragma" || name == "range" || name == "referer" ||
+ name == "te" || name == "upgrade" || name == "via" || name == "warning" || name == "x-requested-with" ||
+ name == "dnt" || name == "x-forwarded-for" || name == "x-forwarded-host" || name == "x-forwarded-proto" ||
+ name == "front-end-https" || name == "x-http-method-override" || name == "x-att-deviceid" ||
+ name == "x-wap-profile" || name == "x-uidh" || name == "x-csrf-token" || name == "x-request-id" ||
+ name == "x-correlation-id")
{
if (name == "authorization")
+ {
CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding custom header option '%s: ***********'", it->first.c_str());
+ }
else
+ {
CLog::Log(LOGDEBUG, "CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding custom header option '%s: %s'", it->first.c_str(), value.c_str());
+ }
headers.append(it->first).append(": ").append(value).append("\r\n");
}
// we don't add blindly all options to headers anymore
@@ -689,8 +696,10 @@ AVDictionary *CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput()
}
}
if (!hasUserAgent)
+ {
// set default xbmc user-agent.
av_dict_set(&options, "user-agent", g_advancedSettings.m_userAgent.c_str(), 0);
+ }
if (!headers.empty())
av_dict_set(&options, "headers", headers.c_str(), 0);
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index 276a65fd7b..ba1bc8fcd0 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -145,15 +145,18 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IVideoPlayer* pPlayer
{
if (finalFileitem.ContentLookup())
{
- XFILE::CCurlFile url;
+ CURL origUrl(finalFileitem.GetURL());
+ XFILE::CCurlFile curlFile;
// try opening the url to resolve all redirects if any
try
{
- if (url.Open(finalFileitem.GetURL()))
+ if (curlFile.Open(finalFileitem.GetURL()))
{
- finalFileitem.SetPath(url.GetURL());
+ CURL finalUrl(curlFile.GetURL());
+ finalUrl.SetProtocolOptions(origUrl.GetProtocolOptions());
+ finalFileitem.SetPath(finalUrl.Get());
}
- url.Close();
+ curlFile.Close();
}
catch (XFILE::CRedirectException *pRedirectEx)
{