diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp index 734fd88..806037f 100644 --- a/plugin/protocol/http2/src/http2_stream.cpp +++ b/plugin/protocol/http2/src/http2_stream.cpp @@ -727,8 +727,16 @@ upstream_read_callback(nghttp2_session *session, int32_t stream_id, void *user_data) { unsigned char *input = NULL; - ssize_t datalen = 0, inputlen=0; - + ssize_t datalen = 0, inputlen=0; + + struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)user_data; + struct tfe_h2_session *h2_session = TAILQ_LIST_FIND(h2_stream_info, stream_id); + if (h2_session == NULL) + { + TFE_LOG_ERROR(logger()->handle, "Failed to send data, stream_id %d", stream_id); + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + return 0; + } struct tfe_h2_payload *to_send_body = (struct tfe_h2_payload *)source->ptr; if (!to_send_body->evbuf_body || 0==(inputlen = evbuffer_get_length(to_send_body->evbuf_body)) ||!(input = evbuffer_pullup(to_send_body->evbuf_body, MIN(length, inputlen))))