aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarlson2k <k2k@narod.ru>2014-01-11 01:12:20 +0400
committerKarlson2k <k2k@narod.ru>2014-05-05 01:11:13 +0400
commitbd45013a1628a7e1e42ea98e0cc276a8aa123e5d (patch)
treeef4d8091f2d4c649fd75d32b662eda44d0d3f591
parenta691198916ed0fa1af8c43f28336ecd9f6c1113b (diff)
HttpHeader::AddParam: fix trying to add empty value or name
-rw-r--r--xbmc/utils/HttpHeader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/xbmc/utils/HttpHeader.cpp b/xbmc/utils/HttpHeader.cpp
index 0a3c332af7..9ca0bc2fd3 100644
--- a/xbmc/utils/HttpHeader.cpp
+++ b/xbmc/utils/HttpHeader.cpp
@@ -106,12 +106,11 @@ bool CHttpHeader::ParseLine(const std::string& headerLine)
void CHttpHeader::AddParam(const std::string& param, const std::string& value, const bool overwrite /*= false*/)
{
- if (param.empty() || value.empty())
- return;
-
std::string paramLower(param);
StringUtils::ToLower(paramLower);
StringUtils::Trim(paramLower, m_whitespaceChars);
+ if (paramLower.empty())
+ return;
if (overwrite)
{ // delete ALL parameters with the same name
@@ -128,6 +127,8 @@ void CHttpHeader::AddParam(const std::string& param, const std::string& value, c
std::string valueTrim(value);
StringUtils::Trim(valueTrim, m_whitespaceChars);
+ if (valueTrim.empty())
+ return;
m_params.push_back(HeaderParams::value_type(paramLower, valueTrim));
}