diff options
| author | fengweihao <[email protected]> | 2019-06-14 13:15:49 +0800 |
|---|---|---|
| committer | fengweihao <[email protected]> | 2019-06-14 13:15:49 +0800 |
| commit | 39c84b0bbdd8da51b42bfbfb5f01b4e635d7994b (patch) | |
| tree | 20126bc48284e1db450d68c096eab4658ff2538f /plugin/protocol/http2/src | |
| parent | 104fe5af71ea6567cf6241c0ebba99def9be745b (diff) | |
close #144
修复页面编码方式为gb2312,命中替换规则后,页面无法显示
修复insert script告警
Diffstat (limited to 'plugin/protocol/http2/src')
| -rw-r--r-- | plugin/protocol/http2/src/http2_stream.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp index 4808d2b..93ed2da 100644 --- a/plugin/protocol/http2/src/http2_stream.cpp +++ b/plugin/protocol/http2/src/http2_stream.cpp @@ -424,6 +424,16 @@ static void delete_http_req_spec(struct tfe_http_req_spec *req_spec) free((char *)req_spec->url); } +static void delete_http_resp_spec(struct tfe_http_resp_spec *resp_spec) +{ + if (resp_spec->content_encoding) + free((char *)resp_spec->content_encoding); + if (resp_spec->content_type) + free((char *)resp_spec->content_type); + if (resp_spec->content_length) + free((char *)resp_spec->content_length); +} + void delete_stream_half_data(struct tfe_h2_half_private **data, int body_flag, enum tfe_conn_dir dir) { @@ -446,6 +456,12 @@ void delete_stream_half_data(struct tfe_h2_half_private **data, struct tfe_http_req_spec *req_spec = &((*data)->half_public.req_spec); delete_http_req_spec(req_spec); } + if (dir == CONN_DIR_UPSTREAM) + { + struct tfe_http_resp_spec *resp_spec = &((*data)->half_public.resp_spec); + delete_http_resp_spec(resp_spec); + } + if((*data)->event_cb_user_deleter != NULL) (*data)->event_cb_user_deleter((*data)->event_cb_user); free(*data); @@ -1378,15 +1394,15 @@ fill_resp_spec_from_handle(struct tfe_h2_half_private *half_private) continue; } if (!strncmp((char *)(h2_field->nv.name), "content-type", strlen("content-type"))){ - resp_spec->content_type = (const char *)(h2_field->nv.value); + resp_spec->content_type = tfe_strdup((const char *)(h2_field->nv.value));; continue; } if (!strncmp((char *)(h2_field->nv.name), "content-encoding", strlen("content-encoding"))){ - resp_spec->content_encoding = (const char *)(h2_field->nv.value); + resp_spec->content_encoding = tfe_strdup((const char *)(h2_field->nv.value));; continue; } if (!strncmp((char *)(h2_field->nv.name), "content-length", strlen("content-length"))){ - resp_spec->content_length = (const char *)(h2_field->nv.value); + resp_spec->content_length = tfe_strdup((const char *)(h2_field->nv.value));; continue; } } |
