* 增加插入js接口,源数据为空判断
* 删除http2解压缩失败后,主动发送数据函数
This commit is contained in:
@@ -121,10 +121,10 @@ tfe_h2_header_modify_field(struct tfe_h2_header *header, nghttp2_nv *hdrs, const
|
||||
{
|
||||
hdrs[nvlen].value = h2_field->nv.value;
|
||||
hdrs[nvlen].valuelen = h2_field->nv.valuelen;
|
||||
}
|
||||
}
|
||||
hdrs[nvlen].flags = h2_field->nv.flags;
|
||||
nvlen++;
|
||||
}
|
||||
}
|
||||
return hdrs;
|
||||
}
|
||||
|
||||
@@ -830,32 +830,6 @@ nghttp2_submit_end_data_by_h2_half(struct tfe_h2_stream *h2_stream_info, int32_t
|
||||
return;
|
||||
}
|
||||
|
||||
static enum tfe_stream_action
|
||||
nghttp2_submit_data_by_user(struct tfe_h2_stream *connection,
|
||||
struct tfe_h2_session *h2_session,
|
||||
enum tfe_conn_dir dir)
|
||||
{
|
||||
int rv = -1;
|
||||
enum tfe_stream_action stream_action = ACTION_DROP_DATA;
|
||||
|
||||
struct tfe_h2_half_private *h2_half = tfe_h2_stream_get_half(h2_session, dir);
|
||||
nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_session(connection, dir);
|
||||
|
||||
struct tfe_h2_payload *body = &h2_half->h2_payload;
|
||||
|
||||
nghttp2_data_provider upstream_data_provider;
|
||||
upstream_data_provider.source.ptr = (void *)body;
|
||||
upstream_data_provider.read_callback = upstream_read_callback;
|
||||
|
||||
rv = nghttp2_submit_data(ngh2_session, body->flags,
|
||||
h2_session->ngh2_stream_id, &upstream_data_provider);
|
||||
if (rv != 0){
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
//printf("Fatal server submit data error: %s\n", nghttp2_strerror(rv));
|
||||
}
|
||||
return stream_action;
|
||||
}
|
||||
|
||||
static enum tfe_stream_action
|
||||
nghttp2_submit_data_by_h2_half(struct tfe_h2_stream *connection,
|
||||
struct tfe_h2_session *h2_session,
|
||||
@@ -1869,7 +1843,6 @@ nghttp2_fill_up_header(nghttp2_session *ngh2_session, const nghttp2_frame *frame
|
||||
frame->headers.cat != NGHTTP2_HCAT_REQUEST){
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct tfe_h2_session *h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(ngh2_session, frame->hd.stream_id);
|
||||
if (!h2_session){
|
||||
TFE_LOG_ERROR(logger()->handle, "Header stream id %d, can't find stream information",
|
||||
@@ -2046,8 +2019,9 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)user_data;
|
||||
|
||||
/*proc build resp*/
|
||||
/*when input_len == 1 is end_stream, Nghttp2 sends this frame, drop it*/
|
||||
struct tfe_h2_session *h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
if (h2_session == NULL)
|
||||
if (h2_session == NULL || input_len == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -2067,21 +2041,6 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
input = (const uint8_t*)uncompr;
|
||||
input_len = uncompr_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_action = nghttp2_submit_data_by_user(h2_stream_info, h2_session, CONN_DIR_UPSTREAM);
|
||||
if (stream_action == ACTION_DROP_DATA)
|
||||
{
|
||||
xret = nghttp2_session_send(h2_stream_info->as_server);
|
||||
if (xret != 0)
|
||||
{
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
TFE_LOG_ERROR(logger()->handle, "Fatal upstream(%d) send error: %s\n",stream_id, nghttp2_strerror(xret));
|
||||
}
|
||||
}
|
||||
h2_stream_info->stream_action = stream_action;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
data = input;
|
||||
len = input_len;
|
||||
|
||||
Reference in New Issue
Block a user