From 3034f19a66efdda589e3c4ad0ac243d52a668201 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Wed, 15 Sep 2021 15:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84http=E7=9B=B4=E6=92=ADurl?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 95c90725..260a023e 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -187,16 +187,19 @@ bool HttpSession::checkLiveStream(const string &schema, const string &url_suffi return false; } - //这是个符合后缀的直播的流 - _mediaInfo.parse(schema + "://" + _parser["Host"] + _parser.FullUrl()); - if (_mediaInfo._app.empty() || _mediaInfo._streamid.size() < url_suffix.size() + 1) { + //url去除特殊后缀 + auto url = _parser.Url().substr(0, _parser.Url().size() - url_suffix.size()); + //带参数的url + url = _parser.Params().empty() ? url : (url + "?" + _parser.Params()); + //解析带上协议+参数完整的url + _mediaInfo.parse(schema + "://" + _parser["Host"] + url); + + if (_mediaInfo._app.empty() || _mediaInfo._streamid.empty()) { //url不合法 return false; } - //去除后缀 + bool close_flag = !strcasecmp(_parser["Connection"].data(), "close"); - //流id去除后缀 - _mediaInfo._streamid.erase(_mediaInfo._streamid.size() - url_suffix.size()); weak_ptr weak_self = dynamic_pointer_cast(shared_from_this()); //鉴权结果回调