提交 acaefc09 编写于 作者: M Minglei Jin

[TD-2832]<fix>: use httpDecodeUrl to parse reserved characters after percent-encoding

上级 2130b01b
...@@ -537,7 +537,7 @@ char *httpDecodeUrl(const char *enc) { ...@@ -537,7 +537,7 @@ char *httpDecodeUrl(const char *enc) {
dec = str.str; dec = str.str;
str.str = NULL; str.str = NULL;
} }
httpCleanupString(&str); //httpCleanupString(&str);
return dec; return dec;
} }
...@@ -648,7 +648,7 @@ static int32_t httpParserOnTarget(HttpParser *parser, HTTP_PARSER_STATE state, c ...@@ -648,7 +648,7 @@ static int32_t httpParserOnTarget(HttpParser *parser, HTTP_PARSER_STATE state, c
} }
break; break;
} }
parser->target = strdup(parser->str.str); parser->target = httpDecodeUrl(parser->str.str);
if (!parser->target) { if (!parser->target) {
httpError("context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom", pContext, pContext->fd, state, c, c); httpError("context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom", pContext, pContext->fd, state, c, c);
ok = -1; ok = -1;
...@@ -717,6 +717,10 @@ static int32_t httpParserOnVersion(HttpParser *parser, HTTP_PARSER_STATE state, ...@@ -717,6 +717,10 @@ static int32_t httpParserOnVersion(HttpParser *parser, HTTP_PARSER_STATE state,
if (parser->method) { if (parser->method) {
ok = httpOnRequestLine(parser, parser->method, parser->target, parser->version); ok = httpOnRequestLine(parser, parser->method, parser->target, parser->version);
if (parser->target) {
free(parser->target);
parser->target = NULL;
}
} }
httpClearString(&parser->str); httpClearString(&parser->str);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册