Fixed websockets in IE11. Bleep you, MS. -_-
This commit is contained in:
parent
d6ad8f9811
commit
128f30bfb6
3 changed files with 16 additions and 6 deletions
|
@ -11,15 +11,19 @@ namespace HTTP{
|
|||
|
||||
Websocket::Websocket(Socket::Connection &c, HTTP::Parser &h) : C(c), H(h){
|
||||
frameType = 0;
|
||||
if (H.GetHeader("Connection").find("Upgrade") == std::string::npos){
|
||||
std::string connHeader = H.GetHeader("Connection");
|
||||
Util::stringToLower(connHeader);
|
||||
if (connHeader.find("upgrade") == std::string::npos){
|
||||
FAIL_MSG("Could not negotiate websocket, connection header incorrect (%s).",
|
||||
H.GetHeader("Connection").c_str());
|
||||
connHeader.c_str());
|
||||
C.close();
|
||||
return;
|
||||
}
|
||||
if (H.GetHeader("Upgrade") != "websocket"){
|
||||
std::string upgradeHeader = H.GetHeader("Upgrade");
|
||||
Util::stringToLower(upgradeHeader);
|
||||
if (upgradeHeader != "websocket"){
|
||||
FAIL_MSG("Could not negotiate websocket, upgrade header incorrect (%s).",
|
||||
H.GetHeader("Upgrade").c_str());
|
||||
upgradeHeader.c_str());
|
||||
C.close();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,8 @@ namespace Mist {
|
|||
myConn.close();
|
||||
return;
|
||||
}
|
||||
std::string connHeader = H.GetHeader("Connection");
|
||||
Util::stringToLower(connHeader);
|
||||
if (handler != capa["name"].asStringRef() || H.GetVar("stream") != streamName){
|
||||
MEDIUM_MSG("Switching from %s (%s) to %s (%s)", capa["name"].asStringRef().c_str(), streamName.c_str(), handler.c_str(), H.GetVar("stream").c_str());
|
||||
streamName = H.GetVar("stream");
|
||||
|
@ -238,7 +240,9 @@ namespace Mist {
|
|||
if (H.GetVar("video") != ""){targetParams["video"] = H.GetVar("video");}
|
||||
if (H.GetVar("subtitle") != ""){targetParams["subtitle"] = H.GetVar("subtitle");}
|
||||
//Handle upgrade to websocket if the output supports it
|
||||
if (doesWebsockets() && H.GetHeader("Upgrade") == "websocket"){
|
||||
std::string upgradeHeader = H.GetHeader("Upgrade");
|
||||
Util::stringToLower(upgradeHeader);
|
||||
if (doesWebsockets() && upgradeHeader == "websocket"){
|
||||
INFO_MSG("Switching to Websocket mode");
|
||||
setBlocking(false);
|
||||
preWebsocketConnect();
|
||||
|
|
|
@ -783,7 +783,9 @@ namespace Mist {
|
|||
if (!useragent.size()){
|
||||
useragent = H.GetHeader("User-Agent");
|
||||
}
|
||||
if (H.GetHeader("Upgrade") != "websocket"){return false;}
|
||||
std::string upgradeHeader = H.GetHeader("Upgrade");
|
||||
Util::stringToLower(upgradeHeader);
|
||||
if (upgradeHeader != "websocket"){return false;}
|
||||
HTTP::Websocket ws(myConn, H);
|
||||
if (!ws){return false;}
|
||||
setBlocking(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue