mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复http虚拟目录相关bug
This commit is contained in:
parent
3137b95406
commit
a3a563ed41
@ -584,12 +584,13 @@ static string getFilePath(const Parser &parser,const MediaInfo &media_info, Sess
|
|||||||
return Parser::parseArgs(str, ";", ",");
|
return Parser::parseArgs(str, ";", ",");
|
||||||
});
|
});
|
||||||
|
|
||||||
string url, path;
|
string url, path, virtual_app;
|
||||||
auto it = virtualPathMap.find(media_info.app);
|
auto it = virtualPathMap.find(media_info.app);
|
||||||
if (it != virtualPathMap.end()) {
|
if (it != virtualPathMap.end()) {
|
||||||
//访问的是virtualPath
|
//访问的是virtualPath
|
||||||
path = it->second;
|
path = it->second;
|
||||||
url = parser.url().substr(1 + media_info.app.size());
|
url = parser.url().substr(1 + media_info.app.size());
|
||||||
|
virtual_app = media_info.app + "/";
|
||||||
} else {
|
} else {
|
||||||
//访问的是rootPath
|
//访问的是rootPath
|
||||||
path = rootPath;
|
path = rootPath;
|
||||||
@ -608,7 +609,7 @@ static string getFilePath(const Parser &parser,const MediaInfo &media_info, Sess
|
|||||||
throw std::runtime_error("Attempting to access files outside of the http root directory");
|
throw std::runtime_error("Attempting to access files outside of the http root directory");
|
||||||
}
|
}
|
||||||
// 替换url,防止返回的目录索引网页被注入非法内容
|
// 替换url,防止返回的目录索引网页被注入非法内容
|
||||||
const_cast<Parser&>(parser).setUrl("/" + ret.substr(http_root.size()));
|
const_cast<Parser&>(parser).setUrl("/" + virtual_app + ret.substr(http_root.size()));
|
||||||
NOTICE_EMIT(BroadcastHttpBeforeAccessArgs, Broadcast::kBroadcastHttpBeforeAccess, parser, ret, sender);
|
NOTICE_EMIT(BroadcastHttpBeforeAccessArgs, Broadcast::kBroadcastHttpBeforeAccess, parser, ret, sender);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user