修复从服务端控制帧判断http2流字节数限制

This commit is contained in:
fengweihao
2019-07-02 22:20:12 +08:00
parent 348afbc00d
commit c3741ed8c0
2 changed files with 19 additions and 23 deletions

View File

@@ -35,7 +35,7 @@ static const uint8_t kMagicHello[] = {
#define TFE_BASIC_CFG "conf/tfe/tfe.conf"
#define MAGIC_FRAME_LENGTH 24
#define SET_FRAME_LENGTH 18
#define SET_FRAME_LENGTH 9
struct event_timer_ctx
{
@@ -120,25 +120,21 @@ http2_stream_open(const struct tfe_stream *stream, unsigned int thread_id,
return 0;
}
/*setting frame: 00 00 12 04 00 00 00 00 00 00 03 00 00 00 80 00 04 7f ff ff ff 00 05 00 ff ff ff 00 00 04 08 00
00 00 00 00 7f ff 00 00 ***/
/*setting frame: 00 00 06 04 00 00 00 00 00 00 04**/
static int
search_up_stream_data(const unsigned char * data, size_t len)
{
uint8_t indetifier = 0;
if (get_u_int8_t(data, 3) != 0x4)
if ((get_u_int8_t(data, 3) != 0x4) && (get_u_int8_t(data, 4) != 0) && (get_u_int8_t(data, 9) != 0))
{
return 0;
}
indetifier = get_u_int8_t(data, 10);
if (indetifier < NGHTTP2_SETTINGS_HEADER_TABLE_SIZE ||
indetifier > NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE)
return 0;
indetifier = get_u_int8_t(data, 16);
if (indetifier < NGHTTP2_SETTINGS_HEADER_TABLE_SIZE ||
indetifier > NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE)
if (indetifier < NGHTTP2_SETTINGS_HEADER_TABLE_SIZE || indetifier > NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE)
{
return 0;
}
return 1;
}
@@ -160,7 +156,7 @@ http2_stream_data(const struct tfe_stream * stream, unsigned int thread_id,
}
if (search_up_stream_data(data, len)){
}else{
goto finish;
goto detach;
}
}
if (dir == CONN_DIR_DOWNSTREAM){