Fix screwup, fixes #137

1.修复HTTP2压缩段错误
2.修改发送无效的9字节DATA帧
3.对manipulate_profile结构多线程调用加锁处理
This commit is contained in:
fengweihao
2019-06-08 10:57:49 +08:00
parent 0eea8bd2a2
commit 814d5b4a30
3 changed files with 36 additions and 15 deletions

View File

@@ -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));