mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 04:08:57 +08:00
修复FullUrl()未url转义导致的bug
This commit is contained in:
parent
626bf3dcf9
commit
03e9c09c42
@ -47,8 +47,6 @@ typedef void* mk_parser;
|
||||
API_EXPORT const char* API_CALL mk_parser_get_method(const mk_parser ctx);
|
||||
//Parser::Url(),获取HTTP的访问url(不包括?后面的参数)
|
||||
API_EXPORT const char* API_CALL mk_parser_get_url(const mk_parser ctx);
|
||||
//Parser::FullUrl(),包括?后面的参数
|
||||
API_EXPORT const char* API_CALL mk_parser_get_full_url(const mk_parser ctx);
|
||||
//Parser::Params(),?后面的参数字符串
|
||||
API_EXPORT const char* API_CALL mk_parser_get_url_params(const mk_parser ctx);
|
||||
//Parser::getUrlArgs()["key"],获取?后面的参数中的特定参数
|
||||
|
@ -90,11 +90,6 @@ API_EXPORT const char* API_CALL mk_parser_get_url(const mk_parser ctx){
|
||||
Parser *parser = (Parser *)ctx;
|
||||
return parser->Url().c_str();
|
||||
}
|
||||
API_EXPORT const char* API_CALL mk_parser_get_full_url(const mk_parser ctx){
|
||||
assert(ctx);
|
||||
Parser *parser = (Parser *)ctx;
|
||||
return parser->FullUrl().c_str();
|
||||
}
|
||||
API_EXPORT const char* API_CALL mk_parser_get_url_params(const mk_parser ctx){
|
||||
assert(ctx);
|
||||
Parser *parser = (Parser *)ctx;
|
||||
|
@ -49,16 +49,16 @@ void Parser::Parse(const char *buf) {
|
||||
}
|
||||
if (start == buf) {
|
||||
_strMethod = FindField(line.data(), NULL, " ");
|
||||
_strFullUrl = FindField(line.data(), " ", " ");
|
||||
auto args_pos = _strFullUrl.find('?');
|
||||
auto strFullUrl = FindField(line.data(), " ", " ");
|
||||
auto args_pos = strFullUrl.find('?');
|
||||
if (args_pos != string::npos) {
|
||||
_strUrl = _strFullUrl.substr(0, args_pos);
|
||||
_params = _strFullUrl.substr(args_pos + 1);
|
||||
_strUrl = strFullUrl.substr(0, args_pos);
|
||||
_params = strFullUrl.substr(args_pos + 1);
|
||||
_mapUrlArgs = parseArgs(_params);
|
||||
} else {
|
||||
_strUrl = _strFullUrl;
|
||||
_strUrl = strFullUrl;
|
||||
}
|
||||
_strTail = FindField(line.data(), (_strFullUrl + " ").data(), NULL);
|
||||
_strTail = FindField(line.data(), (strFullUrl + " ").data(), NULL);
|
||||
} else {
|
||||
auto field = FindField(line.data(), NULL, ": ");
|
||||
auto value = FindField(line.data(), ": ", NULL);
|
||||
@ -82,8 +82,11 @@ const string &Parser::Url() const {
|
||||
return _strUrl;
|
||||
}
|
||||
|
||||
const string &Parser::FullUrl() const {
|
||||
return _strFullUrl;
|
||||
string Parser::FullUrl() const {
|
||||
if (_params.empty()) {
|
||||
return _strUrl;
|
||||
}
|
||||
return _strUrl + "?" + _params;
|
||||
}
|
||||
|
||||
const string &Parser::Tail() const {
|
||||
@ -105,7 +108,6 @@ const string &Parser::Content() const {
|
||||
void Parser::Clear() {
|
||||
_strMethod.clear();
|
||||
_strUrl.clear();
|
||||
_strFullUrl.clear();
|
||||
_params.clear();
|
||||
_strTail.clear();
|
||||
_strContent.clear();
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
//获取中间url,不包含?后面的参数
|
||||
const string &Url() const;
|
||||
//获取中间url,包含?后面的参数
|
||||
const string &FullUrl() const;
|
||||
string FullUrl() const;
|
||||
//获取命令协议名
|
||||
const string &Tail() const;
|
||||
//根据header key名,获取请求header value值
|
||||
@ -96,7 +96,6 @@ private:
|
||||
string _strTail;
|
||||
string _strContent;
|
||||
string _strNull;
|
||||
string _strFullUrl;
|
||||
string _params;
|
||||
mutable StrCaseMap _mapHeaders;
|
||||
mutable StrCaseMap _mapUrlArgs;
|
||||
|
Loading…
Reference in New Issue
Block a user