on_play/on_publish hook 新增protocol字段 (#4133 #4143)

对于webhook  涉及到media info的相关信息,增加protocol 的字段,表明是基于什么协议传输的
This commit is contained in:
xiongguangjie
2025-02-13 15:18:47 +08:00
committed by GitHub
parent 8a4d548427
commit 2a85dffdf9
7 changed files with 19 additions and 0 deletions

View File

@@ -213,6 +213,7 @@ bool HttpSession::checkWebSocket() {
if (Sec_WebSocket_Key.empty()) {
return false;
}
_is_websocket = true;
auto Sec_WebSocket_Accept = encodeBase64(SHA1::encode_bin(Sec_WebSocket_Key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"));
KeyValue headerOut;
@@ -305,6 +306,12 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffix
return false;
}
if (_is_websocket) {
_media_info.protocol = overSsl() ? "wss" : "ws";
} else {
_media_info.protocol = overSsl() ? "https" : "http";
}
bool close_flag = !strcasecmp(_parser["Connection"].data(), "close");
weak_ptr<HttpSession> weak_self = static_pointer_cast<HttpSession>(shared_from_this());

View File

@@ -158,6 +158,7 @@ protected:
private:
bool _is_live_stream = false;
bool _live_over_websocket = false;
bool _is_websocket = false;
// 超时时间 [AUTO-TRANSLATED:f15e2672]
// Timeout
size_t _keep_alive_sec = 0;