Skip to content

Commit 18b9ca1

Browse files
authored
Merge pull request #1687 from CastagnaIT/common_headers
[KodiProps] add common_headers property
2 parents 4794c89 + 60b581b commit 18b9ca1

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

inputstream.adaptive/addon.xml.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
name="adaptive"
1111
extension=""
1212
tags="true"
13-
listitemprops="drm|drm_legacy|license_type|license_key|license_url|license_url_append|license_data|license_flags|server_certificate|manifest_upd_params|manifest_params|manifest_headers|stream_params|stream_headers|original_audio_language|play_timeshift_buffer|pre_init_data|stream_selection_type|chooser_bandwidth_max|chooser_resolution_max|chooser_resolution_secure_max|live_delay|config|manifest_config"
13+
listitemprops="drm|drm_legacy|license_type|license_key|license_url|license_url_append|license_data|license_flags|server_certificate|common_headers|manifest_upd_params|manifest_params|manifest_headers|stream_params|stream_headers|original_audio_language|play_timeshift_buffer|pre_init_data|stream_selection_type|chooser_bandwidth_max|chooser_resolution_max|chooser_resolution_secure_max|live_delay|config|manifest_config"
1414
library_@PLATFORM@="@LIBRARY_FILENAME@"/>
1515
<extension point="xbmc.addon.metadata">
1616
<platform>@PLATFORM@</platform>

src/CompKodiProps.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ constexpr std::string_view PROP_LICENSE_DATA = "inputstream.adaptive.license_dat
3939
constexpr std::string_view PROP_LICENSE_FLAGS = "inputstream.adaptive.license_flags"; //! @todo: to be deprecated
4040
constexpr std::string_view PROP_SERVER_CERT = "inputstream.adaptive.server_certificate"; //! @todo: to be deprecated
4141

42+
constexpr std::string_view PROP_COMMON_HEADERS = "inputstream.adaptive.common_headers";
43+
4244
constexpr std::string_view PROP_MANIFEST_PARAMS = "inputstream.adaptive.manifest_params";
4345
constexpr std::string_view PROP_MANIFEST_HEADERS = "inputstream.adaptive.manifest_headers";
4446
constexpr std::string_view PROP_MANIFEST_UPD_PARAMS = "inputstream.adaptive.manifest_upd_params";
@@ -143,6 +145,11 @@ void ADP::KODI_PROPS::CCompKodiProps::Init(const std::map<std::string, std::stri
143145
"Kodi v22. Please use the appropriate properties to set the DRM configuration.");
144146
licenseUrl += prop.second;
145147
}
148+
else if (prop.first == PROP_COMMON_HEADERS)
149+
{
150+
LogProp(prop.first, prop.second);
151+
ParseHeaderString(m_commonHeaders, prop.second);
152+
}
146153
else if (prop.first == PROP_MANIFEST_UPD_PARAMS)
147154
{
148155
LogProp(prop.first, prop.second);

src/CompKodiProps.h

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class ATTR_DLL_LOCAL CCompKodiProps
122122

123123
void Init(const std::map<std::string, std::string>& props);
124124

125+
// \brief HTTP headers used for any HTTP request
126+
const std::map<std::string, std::string>& GetCommonHeaders() const { return m_commonHeaders; }
127+
125128
// \brief HTTP parameters used to download manifest updates
126129
std::string GetManifestUpdParams() const { return m_manifestUpdParams; }
127130
// \brief HTTP parameters used to download manifests
@@ -175,6 +178,7 @@ class ATTR_DLL_LOCAL CCompKodiProps
175178

176179
std::string m_manifestUpdParams;
177180
std::string m_manifestParams;
181+
std::map<std::string, std::string> m_commonHeaders;
178182
std::map<std::string, std::string> m_manifestHeaders;
179183
std::string m_streamParams;
180184
std::map<std::string, std::string> m_streamHeaders;

src/utils/CurlUtils.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ UTILS::CURL::CUrl::CUrl(std::string_view url)
194194
if (!kodiProps.GetConfig().curlSSLVerifyPeer)
195195
m_file.CURLAddOption(ADDON_CURL_OPTION_PROTOCOL, "verifypeer", "false");
196196

197+
AddHeaders(kodiProps.GetCommonHeaders());
198+
197199
// Add session cookies
198200
// NOTE: if kodi property inputstream.adaptive.stream_headers is set with "cookie" header
199201
// the cookies set by the property will replace these

0 commit comments

Comments
 (0)