From 6226a05fe3aac7bacc4ffc2f14cc3e133b6157eb Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 6 Sep 2018 13:36:54 +0200 Subject: [PATCH 1/2] Fix incorrect sending of HTTP error response through Websocket connections. --- src/output/output_http.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/output/output_http.cpp b/src/output/output_http.cpp index a4e35978..709c864b 100644 --- a/src/output/output_http.cpp +++ b/src/output/output_http.cpp @@ -43,9 +43,11 @@ namespace Mist { } void HTTPOutput::onFail(){ - H.Clean(); //make sure no parts of old requests are left in any buffers - H.SetBody("Stream not found. Sorry, we tried."); - H.SendResponse("404", "Stream not found", myConn); + if (!webSock){ + H.Clean(); //make sure no parts of old requests are left in any buffers + H.SetBody("Stream not found. Sorry, we tried."); + H.SendResponse("404", "Stream not found", myConn); + } Output::onFail(); } From c17064c305b91b07ecbc852d05d49b1d51dab9ef Mon Sep 17 00:00:00 2001 From: Thulinma Date: Sat, 8 Sep 2018 16:15:47 +0200 Subject: [PATCH 2/2] Re-order userClient init for stream-type inputs. --- src/input/input.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/input/input.cpp b/src/input/input.cpp index d6093bde..c44f22d8 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -393,6 +393,12 @@ namespace Mist { } return; } + + char userPageName[NAME_BUFFER_SIZE]; + snprintf(userPageName, NAME_BUFFER_SIZE, SHM_USERS, streamName.c_str()); + nProxy.userClient = IPC::sharedClient(userPageName, PLAY_EX_SIZE, true); + nProxy.userClient.countAsViewer = false; + parseStreamHeader(); if (myMeta.tracks.size() == 0){ @@ -407,11 +413,6 @@ namespace Mist { return; } - char userPageName[NAME_BUFFER_SIZE]; - snprintf(userPageName, NAME_BUFFER_SIZE, SHM_USERS, streamName.c_str()); - nProxy.userClient = IPC::sharedClient(userPageName, PLAY_EX_SIZE, true); - nProxy.userClient.countAsViewer = false; - for (std::map::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++){ it->second.firstms = 0; it->second.lastms = 0;