summaryrefslogtreecommitdiff
path: root/plugin/protocol/http/src/http_half.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2022-12-02 10:29:42 +0800
committerfengweihao <[email protected]>2022-12-02 10:29:42 +0800
commit2ee230726563e67fe1abefe807d3b44d7f2ae219 (patch)
tree7d98e84e5a8cf392091a829a0f3e8e81140b5483 /plugin/protocol/http/src/http_half.cpp
parent6481bce4b43f15b6f0c25b6043ad77396803847f (diff)
TSG-12671 lua脚本在删除host时,导致日志http.host字段乱码v4.6.25-20221202release-4.6develop-4.6
Diffstat (limited to 'plugin/protocol/http/src/http_half.cpp')
-rw-r--r--plugin/protocol/http/src/http_half.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/protocol/http/src/http_half.cpp b/plugin/protocol/http/src/http_half.cpp
index 8044812..07bfa1a 100644
--- a/plugin/protocol/http/src/http_half.cpp
+++ b/plugin/protocol/http/src/http_half.cpp
@@ -152,7 +152,8 @@ void __hf_public_req_fill_from_private(struct http_half_private * hf_private, st
hf_private->method_or_status = (enum tfe_http_std_method) parser->method;
const static struct http_field_name __host_field_name = {TFE_HTTP_HOST, NULL};
- hf_req_spec->host = (char *) tfe_http_field_read(hf_public, &__host_field_name);
+ hf_private->host = strdup((char *) tfe_http_field_read(hf_public, &__host_field_name));
+ hf_req_spec->host = hf_private->host;
/* uri is stored in underlay evbuffer, we need to append a terminal zero */
static const char __zero = 0;
@@ -701,6 +702,12 @@ void hf_private_destory(struct http_half_private * hf_private)
hf_private->evbuf_uri = NULL;
}
+ if(hf_private->host)
+ {
+ free(hf_private->host);
+ hf_private->host = NULL;
+ }
+
if (hf_private->url_storage)
{
free(hf_private->url_storage);