mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 20:15:58 +08:00
Charset default to UTF-8 on Windows
This commit is contained in:
@@ -683,34 +683,10 @@ void HttpSession::sendResponse(int code,
|
||||
AsyncSender::onSocketFlushed(data);
|
||||
}
|
||||
|
||||
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(urlDecodePath(parser.url()));
|
||||
parser.setUrl(strCoding::UrlDecodePath(parser.url()));
|
||||
for (auto &pr : _parser.getUrlArgs()) {
|
||||
const_cast<string &>(pr.second) = urlDecodeComponent(pr.second);
|
||||
const_cast<string &>(pr.second) = strCoding::UrlDecodeComponent(pr.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user