* 增加插入js接口,源数据为空判断
* 删除http2解压缩失败后,主动发送数据函数
This commit is contained in:
@@ -323,7 +323,7 @@ size_t insert_string(char * in, size_t in_sz, const char *insert_on, const char
|
|||||||
char* insert_from=NULL;
|
char* insert_from=NULL;
|
||||||
size_t offset=0;
|
size_t offset=0;
|
||||||
|
|
||||||
if (script == NULL)
|
if (script == NULL || in == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -830,32 +830,6 @@ nghttp2_submit_end_data_by_h2_half(struct tfe_h2_stream *h2_stream_info, int32_t
|
|||||||
return;
|
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
|
static enum tfe_stream_action
|
||||||
nghttp2_submit_data_by_h2_half(struct tfe_h2_stream *connection,
|
nghttp2_submit_data_by_h2_half(struct tfe_h2_stream *connection,
|
||||||
struct tfe_h2_session *h2_session,
|
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){
|
frame->headers.cat != NGHTTP2_HCAT_REQUEST){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tfe_h2_session *h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(ngh2_session, frame->hd.stream_id);
|
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){
|
if (!h2_session){
|
||||||
TFE_LOG_ERROR(logger()->handle, "Header stream id %d, can't find stream information",
|
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;
|
struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)user_data;
|
||||||
|
|
||||||
/*proc build resp*/
|
/*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);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2067,21 +2041,6 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
input = (const uint8_t*)uncompr;
|
input = (const uint8_t*)uncompr;
|
||||||
input_len = uncompr_len;
|
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;
|
data = input;
|
||||||
len = input_len;
|
len = input_len;
|
||||||
|
|||||||
Reference in New Issue
Block a user