[vlc-commits] demux: adaptive: properly process case insensitive headers/values
Francois Cartegnie
git at videolan.org
Fri Apr 13 11:04:08 CEST 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 10 09:51:28 2018 +0200| [bb6b1dcedc2bcd1e2a5bc68dfe5c6740bd99d3e0] | committer: Francois Cartegnie
demux: adaptive: properly process case insensitive headers/values
(cherry picked from commit 4f7323b3ee6e4838a78b5e5f8519ffd6d6909ccf)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=bb6b1dcedc2bcd1e2a5bc68dfe5c6740bd99d3e0
---
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