summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2018-10-18 16:20:22 +0800
committerzhengchao <[email protected]>2018-10-18 16:20:44 +0800
commitaa4629ca3175f7a5bacef9d3aea35105f2a24945 (patch)
tree4e7c403b7d1b6f34e6d899eefd2355c7381b9921 /plugin
parent26d537b67affa946eb8f5397340c78413bea8de0 (diff)
todo:http 写文件的bug。
Diffstat (limited to 'plugin')
-rw-r--r--plugin/business/pangu-http/src/pangu_logger.cpp2
-rw-r--r--plugin/protocol/http/src/http_entry.cpp3
-rw-r--r--plugin/protocol/http/src/http_half.cpp25
3 files changed, 21 insertions, 9 deletions
diff --git a/plugin/business/pangu-http/src/pangu_logger.cpp b/plugin/business/pangu-http/src/pangu_logger.cpp
index 9053a59..1bb753f 100644
--- a/plugin/business/pangu-http/src/pangu_logger.cpp
+++ b/plugin/business/pangu-http/src/pangu_logger.cpp
@@ -207,7 +207,7 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg)
cJSON_AddStringToObject(common_obj,req_fields[i].log_filed_name, tmp_val);
}
}
- for(size_t i=0;i<sizeof(resp_fields)/sizeof(struct json_spec);i++)
+ for(size_t i=0;i<sizeof(resp_fields)/sizeof(struct json_spec) && http->resp!=NULL;i++)
{
tmp_val=tfe_http_std_field_read(http->resp, resp_fields[i].field_id);
if(tmp_val!=NULL)
diff --git a/plugin/protocol/http/src/http_entry.cpp b/plugin/protocol/http/src/http_entry.cpp
index 28007c2..8d1e315 100644
--- a/plugin/protocol/http/src/http_entry.cpp
+++ b/plugin/protocol/http/src/http_entry.cpp
@@ -171,7 +171,8 @@ int __on_request_handle_user_req_or_resp(const tfe_stream * stream, struct http_
TAILQ_INSERT_TAIL(&hc_private->hs_private_orphan_list, hs_private, next);
}
- assert(hf_private_req_in->stream_action == ACTION_DEFER_DATA);
+ assert(hf_private_req_in->stream_action == ACTION_DEFER_DATA
+ || hf_private_req_in->stream_action == ACTION_DROP_DATA);
hf_private_req_in->stream_action = ACTION_DROP_DATA;
}
diff --git a/plugin/protocol/http/src/http_half.cpp b/plugin/protocol/http/src/http_half.cpp
index a3f0c75..8ec8710 100644
--- a/plugin/protocol/http/src/http_half.cpp
+++ b/plugin/protocol/http/src/http_half.cpp
@@ -838,19 +838,30 @@ void hs_ops_response_set(struct tfe_http_session * session, struct tfe_http_half
{
struct http_half_private * hf_private = to_hf_private(resp);
struct http_session_private * hs_private = to_hs_private(session);
- struct http_half_private * hf_in_private = to_hf_response_private(hs_private);
+ struct http_half_private * hf_in_req_private = to_hf_request_private(hs_private);
+ struct http_half_private * hf_in_resp_private = to_hf_response_private(hs_private);
- if (hf_in_private != NULL)
+ /* Call at request's callback, early response */
+ if(hf_in_req_private != NULL && hf_in_resp_private == NULL)
{
- if (hf_in_private->stream_action == ACTION_DEFER_DATA)
+ /* Drop the incoming request */
+ if (hf_in_req_private->stream_action == ACTION_DEFER_DATA)
{
- hf_in_private->user_stream_action = ACTION_DROP_DATA;
- hf_in_private->is_user_stream_action_set = true;
+ hf_in_req_private->user_stream_action = ACTION_DROP_DATA;
+ hf_in_req_private->is_user_stream_action_set = true;
}
- else
+ else assert(0);
+ }
+
+ /* Call at response's callback, replace incoming response */
+ if (hf_in_req_private != NULL && hf_in_resp_private != NULL)
+ {
+ if (hf_in_resp_private->stream_action == ACTION_DEFER_DATA)
{
- assert(0);
+ hf_in_resp_private->user_stream_action = ACTION_DROP_DATA;
+ hf_in_resp_private->is_user_stream_action_set = true;
}
+ else assert(0);
}
assert(hs_private->hf_private_resp_user == NULL);