diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp index 29f8c69..4ff47e6 100644 --- a/plugin/protocol/http2/src/http2_stream.cpp +++ b/plugin/protocol/http2/src/http2_stream.cpp @@ -1629,7 +1629,11 @@ nghttp2_server_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea stream_action = ACTION_DEFER_DATA; goto finish; } - nghttp2_write_log(h2_session,h2_stream_info->tf_stream->str_stream_info, CONN_DIR_UPSTREAM); + + // int googletest, h2_stream_info->tf_stream is NULL + if (h2_session && h2_stream_info && h2_stream_info->tf_stream) { + nghttp2_write_log(h2_session, h2_stream_info->tf_stream->str_stream_info, CONN_DIR_UPSTREAM); + } stream_action = nghttp2_server_frame_submit_header(h2_stream_info, h2_session); if (stream_action == ACTION_DROP_DATA){ @@ -1799,7 +1803,10 @@ nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea req->event_cb(req, EV_HTTP_REQ_HDR, NULL, 0, req->event_cb_user); - nghttp2_write_log(h2_session, h2_stream_info->tf_stream->str_stream_info, CONN_DIR_DOWNSTREAM); + // int googletest, h2_stream_info->tf_stream is NULL + if (h2_session && h2_stream_info && h2_stream_info->tf_stream) { + nghttp2_write_log(h2_session, h2_stream_info->tf_stream->str_stream_info, CONN_DIR_DOWNSTREAM); + } stream_action = nghttp2_client_frame_submit_header(h2_stream_info, h2_session); if (stream_action == ACTION_DROP_DATA){ xret = nghttp2_session_send(h2_stream_info->as_client); diff --git a/plugin/protocol/http2/test/test_http2_stream.cpp b/plugin/protocol/http2/test/test_http2_stream.cpp index cf4c83d..681ebb9 100644 --- a/plugin/protocol/http2/test/test_http2_stream.cpp +++ b/plugin/protocol/http2/test/test_http2_stream.cpp @@ -114,8 +114,10 @@ void UT_Parse_ReqHeaders(nghttp2_session *as_server) /*rewrite date **/ field_name.field_id = TFE_HTTP_DATE; field_name.field_name = "date"; + xret = tfe_http_field_write(tfe_half, &field_name, NULL); // delete field_name xret = tfe_http_field_write(tfe_half, &field_name, "201x101x"); EXPECT_EQ(xret, 0); + field_name.field_id = TFE_HTTP_DATE; hdr_value = tfe_http_field_read((const struct tfe_http_half*)tfe_half, &field_name); EXPECT_STREQ(hdr_value, "201x101x");