修复火狐建联时发送priority,服务端回复reset帧后,nghttp2无法关闭流信息
修复命中规则后,请求头的flags未置位
This commit is contained in:
@@ -615,6 +615,8 @@ void h2_ops_request_set(struct tfe_http_session * session, struct tfe_http_half
|
|||||||
{
|
{
|
||||||
struct tfe_h2_session *stream_data = nghttp2_to_stream_data(session);
|
struct tfe_h2_session *stream_data = nghttp2_to_stream_data(session);
|
||||||
struct tfe_h2_half_private *half_user = nghttp2_to_half_private(req_user);
|
struct tfe_h2_half_private *half_user = nghttp2_to_half_private(req_user);
|
||||||
|
|
||||||
|
half_user->header.flag = stream_data->req->header.flag;
|
||||||
|
|
||||||
stream_data->plugin_built_req = half_user;
|
stream_data->plugin_built_req = half_user;
|
||||||
}
|
}
|
||||||
@@ -918,7 +920,7 @@ nghttp2_submit_frame_priority(struct tfe_h2_stream *connection,const nghttp2_fra
|
|||||||
&(priority->pri_spec));
|
&(priority->pri_spec));
|
||||||
if (rv != 0){
|
if (rv != 0){
|
||||||
stream_action = ACTION_FORWARD_DATA;
|
stream_action = ACTION_FORWARD_DATA;
|
||||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n",
|
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit priority error: %s\n",
|
||||||
dir, nghttp2_strerror(rv));
|
dir, nghttp2_strerror(rv));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -928,6 +930,7 @@ nghttp2_submit_frame_priority(struct tfe_h2_stream *connection,const nghttp2_fra
|
|||||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n",
|
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n",
|
||||||
dir, nghttp2_strerror(xret));
|
dir, nghttp2_strerror(xret));
|
||||||
}
|
}
|
||||||
|
ngh2_session->last_sent_stream_id = MAX(ngh2_session->last_sent_stream_id, frame->hd.stream_id);
|
||||||
connection->stream_action = stream_action;
|
connection->stream_action = stream_action;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1957,7 +1960,7 @@ nghttp2_on_stream_close(nghttp2_session *session, const nghttp2_frame *frame, co
|
|||||||
if (!h2_session)
|
if (!h2_session)
|
||||||
return 0;
|
return 0;
|
||||||
if (error_code != 0){
|
if (error_code != 0){
|
||||||
const char *str = (dir == CONN_DIR_UPSTREAM) ? "Upstream" : "Downstream";
|
const char *str = (dir == CONN_DIR_UPSTREAM) ? "Simulation s" : "Simulation c";
|
||||||
TFE_LOG_DEBUG(logger()->handle, "%s close, id = %d, error_code = %d", str,
|
TFE_LOG_DEBUG(logger()->handle, "%s close, id = %d, error_code = %d", str,
|
||||||
stream_id, error_code);
|
stream_id, error_code);
|
||||||
}
|
}
|
||||||
@@ -2041,17 +2044,18 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
|
|
||||||
/*proc build resp*/
|
/*proc build resp*/
|
||||||
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)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
resp = h2_session->resp;
|
resp = h2_session->resp;
|
||||||
if (resp == NULL){
|
if (resp == NULL)
|
||||||
|
{
|
||||||
h2_stream_info->stream_action = ACTION_DROP_DATA;
|
h2_stream_info->stream_action = ACTION_DROP_DATA;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
evbuffer_add(resp->h2_payload.evbuf_body, input, input_len);
|
evbuffer_add(resp->h2_payload.evbuf_body, input, input_len);
|
||||||
|
|
||||||
if (resp->h2_payload.gzip != HTTP2_CONTENT_ENCODING_NONE){
|
if (resp->h2_payload.gzip != HTTP2_CONTENT_ENCODING_NONE){
|
||||||
ret = inflate_read(input, input_len, &uncompr, &uncompr_len,
|
ret = inflate_read(input, input_len, &uncompr, &uncompr_len,
|
||||||
&resp->h2_payload.inflate, resp->h2_payload.gzip);
|
&resp->h2_payload.inflate, resp->h2_payload.gzip);
|
||||||
@@ -2072,7 +2076,7 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
resp->event_cb_user);
|
resp->event_cb_user);
|
||||||
}
|
}
|
||||||
if (flags == NGHTTP2_FLAG_END_STREAM){
|
if (flags == NGHTTP2_FLAG_END_STREAM){
|
||||||
resp->h2_payload.flags = 0;
|
resp->h2_payload.flags = NGHTTP2_FLAG_NONE;
|
||||||
}else{
|
}else{
|
||||||
resp->h2_payload.flags = flags;
|
resp->h2_payload.flags = flags;
|
||||||
}
|
}
|
||||||
@@ -2084,7 +2088,7 @@ nghttp2_client_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
resp->event_cb_user);
|
resp->event_cb_user);
|
||||||
}
|
}
|
||||||
if (flags == NGHTTP2_FLAG_END_STREAM){
|
if (flags == NGHTTP2_FLAG_END_STREAM){
|
||||||
resp->h2_payload.flags = 0;
|
resp->h2_payload.flags = NGHTTP2_FLAG_NONE;
|
||||||
}else{
|
}else{
|
||||||
resp->h2_payload.flags = flags;
|
resp->h2_payload.flags = flags;
|
||||||
}
|
}
|
||||||
@@ -2399,24 +2403,29 @@ nghttp2_server_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
len = input_len;
|
len = input_len;
|
||||||
/*todo post data scan**/
|
/*todo post data scan**/
|
||||||
if (req->body_state == H2_READ_STATE_BEGIN){
|
if (req->body_state == H2_READ_STATE_BEGIN){
|
||||||
if (req->event_cb) {
|
if (req->event_cb)
|
||||||
|
{
|
||||||
req->event_cb(req, EV_HTTP_REQ_BODY_BEGIN, NULL, len,
|
req->event_cb(req, EV_HTTP_REQ_BODY_BEGIN, NULL, len,
|
||||||
req->event_cb_user);
|
req->event_cb_user);
|
||||||
}
|
}
|
||||||
if (flags == NGHTTP2_FLAG_END_STREAM){
|
if (flags == NGHTTP2_FLAG_END_STREAM)
|
||||||
req->h2_payload.flags = 0;
|
{
|
||||||
}else{
|
req->h2_payload.flags = NGHTTP2_FLAG_NONE;
|
||||||
|
}else
|
||||||
|
{
|
||||||
req->h2_payload.flags = flags;
|
req->h2_payload.flags = flags;
|
||||||
}
|
}
|
||||||
req->body_state = H2_READ_STATE_READING;
|
req->body_state = H2_READ_STATE_READING;
|
||||||
}
|
}
|
||||||
if (req->body_state == H2_READ_STATE_READING){
|
if (req->body_state == H2_READ_STATE_READING)
|
||||||
if (req->event_cb) {
|
{
|
||||||
|
if (req->event_cb)
|
||||||
|
{
|
||||||
req->event_cb(req, EV_HTTP_REQ_BODY_CONT, data, len,
|
req->event_cb(req, EV_HTTP_REQ_BODY_CONT, data, len,
|
||||||
req->event_cb_user);
|
req->event_cb_user);
|
||||||
}
|
}
|
||||||
if (flags == NGHTTP2_FLAG_END_STREAM){
|
if (flags == NGHTTP2_FLAG_END_STREAM){
|
||||||
req->h2_payload.flags = 0;
|
req->h2_payload.flags = NGHTTP2_FLAG_NONE;
|
||||||
}else{
|
}else{
|
||||||
req->h2_payload.flags = flags;
|
req->h2_payload.flags = flags;
|
||||||
}
|
}
|
||||||
@@ -2426,7 +2435,8 @@ nghttp2_server_on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
|||||||
stream_action = nghttp2_submit_data_by_h2_half(h2_stream_info, h2_session, CONN_DIR_DOWNSTREAM);
|
stream_action = nghttp2_submit_data_by_h2_half(h2_stream_info, h2_session, CONN_DIR_DOWNSTREAM);
|
||||||
if (stream_action == ACTION_DROP_DATA){
|
if (stream_action == ACTION_DROP_DATA){
|
||||||
xret = nghttp2_session_send(h2_stream_info->as_client);
|
xret = nghttp2_session_send(h2_stream_info->as_client);
|
||||||
if (xret != 0) {
|
if (xret != 0)
|
||||||
|
{
|
||||||
stream_action = ACTION_FORWARD_DATA;
|
stream_action = ACTION_FORWARD_DATA;
|
||||||
TFE_LOG_ERROR(logger()->handle, "Fatal upstream send error: %s, %d\n",nghttp2_strerror(xret), __LINE__);
|
TFE_LOG_ERROR(logger()->handle, "Fatal upstream send error: %s, %d\n",nghttp2_strerror(xret), __LINE__);
|
||||||
}
|
}
|
||||||
@@ -2538,7 +2548,7 @@ detect_up_stream_protocol(struct tfe_h2_stream *h2_stream_info, const struct tfe
|
|||||||
h2_stream_info->tf_stream = tfe_stream;
|
h2_stream_info->tf_stream = tfe_stream;
|
||||||
h2_stream_info->thread_id = thread_id;
|
h2_stream_info->thread_id = thread_id;
|
||||||
|
|
||||||
if (!h2_stream_info->as_server)
|
if (!h2_stream_info->as_client)
|
||||||
goto forward;
|
goto forward;
|
||||||
readlen = nghttp2_session_mem_recv(h2_stream_info->as_client, data, len);
|
readlen = nghttp2_session_mem_recv(h2_stream_info->as_client, data, len);
|
||||||
if (readlen < 0){
|
if (readlen < 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user