summaryrefslogtreecommitdiff
path: root/plugin/protocol/http2/src/http2_stream.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2019-06-08 10:57:49 +0800
committerfengweihao <[email protected]>2019-06-08 10:57:49 +0800
commit814d5b4a30a7c667451f8a2b7b864c02afb0b029 (patch)
tree4c2496b2283d4d169d80799fcd86579a48167813 /plugin/protocol/http2/src/http2_stream.cpp
parent0eea8bd2a2cf67b684b4248a3e2feaec50c06d05 (diff)
Fix screwup, fixes #137
1.修复HTTP2压缩段错误 2.修改发送无效的9字节DATA帧 3.对manipulate_profile结构多线程调用加锁处理
Diffstat (limited to 'plugin/protocol/http2/src/http2_stream.cpp')
-rw-r--r--plugin/protocol/http2/src/http2_stream.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp
index 30eaa25..7514279 100644
--- a/plugin/protocol/http2/src/http2_stream.cpp
+++ b/plugin/protocol/http2/src/http2_stream.cpp
@@ -387,7 +387,7 @@ h2_half_ops_append_body(struct tfe_http_half * half, char * buff, size_t size, i
struct tfe_h2_half_private * resp = nghttp2_to_half_private(half);
struct tfe_h2_payload *body = &resp->h2_payload;
- if (buff == NULL && size == 0){
+ if (buff == NULL || size == 0){
if (body->gzip != HTTP2_CONTENT_ENCODING_NONE){
xret = deflate_write(&body->deflate, NULL, 0, resp->h2_payload.evbuf_body, body->gzip, 1);
}
@@ -661,6 +661,10 @@ upstream_read_callback(nghttp2_session *session, int32_t stream_id,
if (!to_send_body->evbuf_body || !(input = evbuffer_pullup(to_send_body->evbuf_body, -1))
|| 0==(inputlen = evbuffer_get_length(to_send_body->evbuf_body)))
{
+ if ((to_send_body->flags & NGHTTP2_FLAG_END_STREAM) == 0)
+ {
+ *data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
+ }
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
return 0;
}
@@ -689,6 +693,7 @@ nghttp2_server_frame_submit_response(struct tfe_h2_stream *h2_stream_info,
return ACTION_FORWARD_DATA;
struct tfe_h2_payload *body = &pangu_resp->h2_payload;
+ body->flags |= NGHTTP2_FLAG_END_STREAM;
char str_sz_evbuf_body[TFE_STRING_MAX];
snprintf(str_sz_evbuf_body, sizeof(str_sz_evbuf_body) - 1, "%lu", evbuffer_get_length(body->evbuf_body));