Merge pull request #5022 from taosdata/fix/TD-2832

[TD-2832]<fix>: use httpDecodeUrl to parse reserved characters after …
This commit is contained in:
Shengliang Guan 2021-01-25 18:45:14 +08:00 committed by GitHub
commit 3480099198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -535,7 +535,7 @@ char *httpDecodeUrl(const char *enc) {
dec = str.str;
str.str = NULL;
}
httpCleanupString(&str);
//httpCleanupString(&str);
return dec;
}
@ -646,7 +646,7 @@ static int32_t httpParserOnTarget(HttpParser *parser, HTTP_PARSER_STATE state, c
}
break;
}
parser->target = strdup(parser->str.str);
parser->target = httpDecodeUrl(parser->str.str);
if (!parser->target) {
httpError("context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom", pContext, pContext->fd, state, c, c);
ok = -1;
@ -715,6 +715,10 @@ static int32_t httpParserOnVersion(HttpParser *parser, HTTP_PARSER_STATE state,
if (parser->method) {
ok = httpOnRequestLine(parser, parser->method, parser->target, parser->version);
if (parser->target) {
free(parser->target);
parser->target = NULL;
}
}
httpClearString(&parser->str);