From 14537bfbc7ffa64c4fd9fa5df1b56924bf147135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BE=E9=B8=A3?= <94030128+ixingqiao@users.noreply.github.com> Date: Wed, 31 May 2023 23:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3ws-flv=E5=92=8Chttp-flv?= =?UTF-8?q?=E7=9A=84=E7=B4=AF=E7=A7=AF=E6=97=B6=E5=BB=B6=E9=97=AE=E9=A2=98?= =?UTF-8?q?(#2509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 9f2ce375..42c8cb1d 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -147,9 +147,15 @@ bool HttpSession::checkWebSocket(){ _live_over_websocket = true; sendResponse(101, false, nullptr, headerOut, nullptr, true); }; + + auto res_cb_flv = [this, header = std::move(headerOut)]() mutable { + _live_over_websocket = true; + header.emplace("Cache-Control", "no-store"); + sendResponse(101, false, nullptr, header, nullptr, true); + }; //判断是否为websocket-flv - if (checkLiveStreamFlv(res_cb)) { + if (checkLiveStreamFlv(res_cb_flv)) { //这里是websocket-flv直播请求 return true; } @@ -349,7 +355,9 @@ bool HttpSession::checkLiveStreamFlv(const function &cb){ assert(rtmp_src); if (!cb) { //找到源,发送http头,负载后续发送 - sendResponse(200, false, HttpFileManager::getContentType(".flv").data(), KeyValue(), nullptr, true); + KeyValue headerOut; + headerOut["Cache-Control"] = "no-store"; + sendResponse(200, false, HttpFileManager::getContentType(".flv").data(), headerOut, nullptr, true); } else { //自定义发送http头 cb();