summaryrefslogtreecommitdiff
path: root/plugin/protocol/http/src
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/protocol/http/src
parent26d537b67affa946eb8f5397340c78413bea8de0 (diff)
todo:http 写文件的bug。
Diffstat (limited to 'plugin/protocol/http/src')
-rw-r--r--plugin/protocol/http/src/http_entry.cpp3
-rw-r--r--plugin/protocol/http/src/http_half.cpp25
2 files changed, 20 insertions, 8 deletions
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);