mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-16 13:05:59 +08:00
@@ -34,7 +34,7 @@ public:
|
||||
for (auto &pr : *this) {
|
||||
ret.append(pr.first);
|
||||
ret.append("=");
|
||||
ret.append(strCoding::UrlEncode(pr.second));
|
||||
ret.append(strCoding::UrlEncodeComponent(pr.second));
|
||||
ret.append("&");
|
||||
}
|
||||
if (ret.size()) {
|
||||
|
||||
@@ -228,7 +228,7 @@ static bool makeFolderMenu(const string &httpPath, const string &strFullPath, st
|
||||
multimap<string/*url name*/, std::pair<string/*note name*/, string/*file path*/> > file_map;
|
||||
File::scanDir(strPathPrefix, [&](const std::string &path, bool isDir) {
|
||||
auto name = fileName(strPathPrefix, path);
|
||||
file_map.emplace(strCoding::UrlEncode(name), std::make_pair(name, path));
|
||||
file_map.emplace(strCoding::UrlEncodePath(name), std::make_pair(name, path));
|
||||
return true;
|
||||
});
|
||||
//如果是root目录,添加虚拟目录
|
||||
|
||||
@@ -695,10 +695,34 @@ string HttpSession::urlDecode(const string &str) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
string HttpSession::urlDecodePath(const string &str) {
|
||||
auto ret = strCoding::UrlDecodePath(str);
|
||||
#ifdef _WIN32
|
||||
GET_CONFIG(string, charSet, Http::kCharSet);
|
||||
bool isGb2312 = !strcasecmp(charSet.data(), "gb2312");
|
||||
if (isGb2312) {
|
||||
ret = strCoding::UTF8ToGB2312(ret);
|
||||
}
|
||||
#endif // _WIN32
|
||||
return ret;
|
||||
}
|
||||
|
||||
string HttpSession::urlDecodeComponent(const string &str) {
|
||||
auto ret = strCoding::UrlDecodeComponent(str);
|
||||
#ifdef _WIN32
|
||||
GET_CONFIG(string, charSet, Http::kCharSet);
|
||||
bool isGb2312 = !strcasecmp(charSet.data(), "gb2312");
|
||||
if (isGb2312) {
|
||||
ret = strCoding::UTF8ToGB2312(ret);
|
||||
}
|
||||
#endif // _WIN32
|
||||
return ret;
|
||||
}
|
||||
|
||||
void HttpSession::urlDecode(Parser &parser) {
|
||||
parser.setUrl(urlDecode(parser.url()));
|
||||
parser.setUrl(urlDecodePath(parser.url()));
|
||||
for (auto &pr : _parser.getUrlArgs()) {
|
||||
const_cast<string &>(pr.second) = urlDecode(pr.second);
|
||||
const_cast<string &>(pr.second) = urlDecodeComponent(pr.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,9 @@ public:
|
||||
void onRecv(const toolkit::Buffer::Ptr &) override;
|
||||
void onError(const toolkit::SockException &err) override;
|
||||
void onManager() override;
|
||||
static std::string urlDecode(const std::string &str);
|
||||
[[deprecated]] static std::string urlDecode(const std::string &str);
|
||||
static std::string urlDecodePath(const std::string &str);
|
||||
static std::string urlDecodeComponent(const std::string &str);
|
||||
void setTimeoutSec(size_t second);
|
||||
void setMaxReqSize(size_t max_req_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user