mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
限制rtsp/rtmp推流url合法性
This commit is contained in:
parent
5ae887a279
commit
68d910e229
@ -158,6 +158,12 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
|
||||
setSocketFlags();
|
||||
};
|
||||
|
||||
if(_mediaInfo._app.empty() || _mediaInfo._streamid.empty()){
|
||||
//不允许莫名其妙的推流url
|
||||
onRes("rtmp推流url非法", false, false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
Broadcast::PublishAuthInvoker invoker = [weakSelf,onRes,pToken](const string &err,bool enableRtxp,bool enableHls,bool enableMP4){
|
||||
auto strongSelf = weakSelf.lock();
|
||||
if(!strongSelf){
|
||||
|
@ -240,6 +240,12 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
|
||||
_mediaInfo.parse(full_url);
|
||||
}
|
||||
|
||||
if(_mediaInfo._app.empty() || _mediaInfo._streamid.empty()){
|
||||
//推流rtsp url必须最少两级(rtsp://host/app/stream_id),不允许莫名其妙的推流url
|
||||
sendRtspResponse("403 Forbidden", {"Content-Type", "text/plain"}, "rtsp推流url非法,最少确保两级rtsp url");
|
||||
throw SockException(Err_shutdown,StrPrinter << "rtsp推流url非法:" << full_url);
|
||||
}
|
||||
|
||||
SdpParser sdpParser(parser.Content());
|
||||
_strSession = makeRandStr(12);
|
||||
_aTrackInfo = sdpParser.getAvailableTrack();
|
||||
|
Loading…
Reference in New Issue
Block a user