diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index bcef5cb..c671bc2 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -1002,6 +1002,7 @@ static void http_redirect(const struct tfe_http_session * session, enum tfe_http response = tfe_http_session_response_create(to_write, resp_code); tfe_http_std_field_write(response, TFE_HTTP_LOCATION, url); + tfe_http_std_field_write(response, TFE_HTTP_CONT_LENGTH, "0"); tfe_http_half_append_body(response, NULL, 0, 0); tfe_http_session_response_set(to_write, response); diff --git a/plugin/protocol/http/src/http_half.cpp b/plugin/protocol/http/src/http_half.cpp index f37314e..29048da 100644 --- a/plugin/protocol/http/src/http_half.cpp +++ b/plugin/protocol/http/src/http_half.cpp @@ -1090,7 +1090,7 @@ void hf_private_construct(struct http_half_private * hf_private) hf_content_compress_write(hf_private->cv_compress_object, NULL, 0, hf_private->evbuf_body, 1); } - if (hf_private->content_encoding != HTTP_ACCEPT_ENCODING_NONE) + if (hf_private->evbuf_body && hf_private->content_encoding != HTTP_ACCEPT_ENCODING_NONE) { const char * __str_content_encoding = __hf_content_encoding_to_str(hf_private->content_encoding); const static struct http_field_name __cont_encoding_type_name = {TFE_HTTP_CONT_ENCODING, NULL};