TSG-12671 lua脚本在删除host时,导致日志http.host字段乱码

This commit is contained in:
fengweihao
2022-12-02 10:29:42 +08:00
parent 6481bce4b4
commit 2ee2307265
2 changed files with 9 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ struct http_half_private
short minor; short minor;
/* URI */ /* URI */
char * host;
struct evbuffer * evbuf_uri; struct evbuffer * evbuf_uri;
char * url_storage; char * url_storage;

View File

@@ -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; 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}; 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 */ /* uri is stored in underlay evbuffer, we need to append a terminal zero */
static const char __zero = 0; static const char __zero = 0;
@@ -701,6 +702,12 @@ void hf_private_destory(struct http_half_private * hf_private)
hf_private->evbuf_uri = NULL; hf_private->evbuf_uri = NULL;
} }
if(hf_private->host)
{
free(hf_private->host);
hf_private->host = NULL;
}
if (hf_private->url_storage) if (hf_private->url_storage)
{ {
free(hf_private->url_storage); free(hf_private->url_storage);