[vlc-commits] demux: adaptive: properly process case insensitive headers/values
Francois Cartegnie
git at videolan.org
Tue Apr 10 09:53:52 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 10 09:51:28 2018 +0200| [4f7323b3ee6e4838a78b5e5f8519ffd6d6909ccf] | committer: Francois Cartegnie
demux: adaptive: properly process case insensitive headers/values
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4f7323b3ee6e4838a78b5e5f8519ffd6d6909ccf
---
modules/demux/adaptive/http/HTTPConnection.cpp | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index 0ed1f98e57..fab2924833 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -25,6 +25,7 @@
#include "ConnectionParams.hpp"
#include "AuthStorage.hpp"
#include "Transport.hpp"
+#include "../tools/Helper.h"
#include <cstdio>
#include <sstream>
@@ -370,7 +371,7 @@ void HTTPConnection::setUsed( bool b )
void HTTPConnection::onHeader(const std::string &key,
const std::string &value)
{
- if(key == "Content-Length")
+ if(Helper::icaseEquals(key, "Content-Length"))
{
std::istringstream ss(value);
ss.imbue(std::locale("C"));
@@ -378,19 +379,21 @@ void HTTPConnection::onHeader(const std::string &key,
ss >> length;
contentLength = length;
}
- else if (key == "Connection" && value =="close")
+ else if (Helper::icaseEquals(key, "Connection") &&
+ Helper::icaseEquals(value, "close"))
{
connectionClose = true;
}
- else if (key == "Transfer-Encoding" && value == "chunked")
+ else if (Helper::icaseEquals(key, "Transfer-Encoding") &&
+ Helper::icaseEquals(value, "chunked"))
{
chunked = true;
}
- else if(key == "Content-Type")
+ else if(Helper::icaseEquals(key, "Content-Type"))
{
contentType = value;
}
- else if(key == "Location")
+ else if(Helper::icaseEquals(key, "Location"))
{
locationparams = ConnectionParams();
ConnectionParams loc = ConnectionParams( value );
@@ -401,7 +404,7 @@ void HTTPConnection::onHeader(const std::string &key,
}
else locationparams = loc;
}
- else if(key == "Set-Cookie" && authStorage)
+ else if(Helper::icaseEquals(key, "Set-Cookie") && authStorage)
{
authStorage->addCookie( value, params );
}
More information about the vlc-commits
mailing list