修正HTTP用户覆盖应答设置后,原应答仍然转发的问题。

This commit is contained in:
Lu Qiuwen
2018-09-26 16:00:28 +08:00
parent e1122bb4bd
commit c7eeda0fb1
2 changed files with 11 additions and 6 deletions

View File

@@ -195,6 +195,13 @@ enum tfe_stream_action __http_connection_entry_on_response(const struct tfe_stre
/* Set callback, this callback used to raise business event */
hf_private_set_callback(hf_private_resp_in, __user_event_dispatch, __closure, free);
/* Setup user's action */
if (hs_private->hf_private_resp_user != NULL)
{
hf_private_resp_in->is_user_stream_action_set = true;
hf_private_resp_in->user_stream_action = ACTION_DROP_DATA;
}
}
/* Parse the content, the data which in defered state has been ignored. */

View File

@@ -484,6 +484,8 @@ struct http_half_private * hf_private_create(tfe_http_direction ht_dir, short ma
assert(ht_dir == TFE_HTTP_REQUEST || ht_dir == TFE_HTTP_RESPONSE);
/* PUBLIC */
hf_private->hf_public.major_version = major;
hf_private->hf_public.minor_version = minor;
hf_private->hf_public.direction = ht_dir;
hf_private->hf_public.ops = &__http_half_ops;
@@ -502,6 +504,8 @@ struct http_half_private * hf_private_create(tfe_http_direction ht_dir, short ma
hf_private->parse_settings = &__http_half_parse_setting;
hf_private->parse_object->data = hf_private;
hf_private->major = major;
hf_private->minor = minor;
TAILQ_INIT(&hf_private->header_list);
return hf_private;
@@ -659,9 +663,6 @@ void __construct_request_line(struct http_half_private * hf_private)
__str_method = "";
}
hf_private->major = 1;
hf_private->minor = 1;
evbuffer_add_printf(hf_private->evbuf_raw, "%s %s HTTP/%d.%d\r\n",
__str_method, hf_private->url_storage, hf_private->major, hf_private->minor);
}
@@ -675,9 +676,6 @@ void __construct_response_line(struct http_half_private * hf_private)
__str_resp_code = "";
}
hf_private->major = 1;
hf_private->minor = 1;
evbuffer_add_printf(hf_private->evbuf_raw, "HTTP/%d.%d %d %s\r\n",
hf_private->major, hf_private->minor, __resp_code, __str_resp_code);
}