修复残留数据,造成select_padding函数段错误
This commit is contained in:
@@ -372,38 +372,33 @@ int deflate_write(struct z_stream_st **strm, const uint8_t *source,
|
||||
void inflate_finished(struct z_stream_st **strm)
|
||||
{
|
||||
if (*strm != NULL){
|
||||
if ((*strm)->brdec_state){
|
||||
if ((*strm)->brdec_state)
|
||||
{
|
||||
BrotliDecoderDestroyInstance((*strm)->brdec_state);
|
||||
(*strm)->brdec_state = NULL;
|
||||
return;
|
||||
goto finish;
|
||||
}
|
||||
(void)inflateEnd(&((*strm)->zst));
|
||||
finish:
|
||||
free(*strm);
|
||||
*strm = NULL;
|
||||
}
|
||||
}
|
||||
void deflate_finished(struct z_stream_st **strm)
|
||||
{
|
||||
if (*strm != NULL){
|
||||
if (*strm != NULL)
|
||||
{
|
||||
if ((*strm)->brenc_state)
|
||||
{
|
||||
BrotliEncoderDestroyInstance((*strm)->brenc_state);
|
||||
(*strm)->brenc_state = NULL;
|
||||
goto finish;
|
||||
|
||||
}
|
||||
(void) deflateEnd(&((*strm)->zst));
|
||||
finish:
|
||||
free(*strm);
|
||||
*strm = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void frame_display(const uint8_t *payload, uint16_t payload_len)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
printf("context:(%d)\n", payload_len);
|
||||
for(i=0; i < (int)payload_len; ++i){
|
||||
printf(" 0x%02x,", payload[i]);
|
||||
if( (i + 1) % 16 == 0)
|
||||
printf("\n");
|
||||
if ( i > 500)
|
||||
break;
|
||||
}
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1056,19 +1056,17 @@ nghttp2_submit_frame_ping(struct tfe_h2_stream *connection,const nghttp2_frame *
|
||||
|
||||
nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_session(connection, dir);
|
||||
|
||||
rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags,
|
||||
ping->opaque_data);
|
||||
if (rv != 0){
|
||||
rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags, ping->opaque_data);
|
||||
if (rv != 0)
|
||||
{
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n",
|
||||
dir, nghttp2_strerror(rv));
|
||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n", dir, nghttp2_strerror(rv));
|
||||
return 0;
|
||||
}
|
||||
xret = nghttp2_session_send(ngh2_session);
|
||||
if (xret != 0) {
|
||||
stream_action = ACTION_FORWARD_DATA;
|
||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n",
|
||||
dir, nghttp2_strerror(xret));
|
||||
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n", dir, nghttp2_strerror(xret));
|
||||
}
|
||||
connection->stream_action = stream_action;
|
||||
return 0;
|
||||
@@ -1843,6 +1841,7 @@ nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea
|
||||
|
||||
req = h2_session->req;
|
||||
fill_req_spec_from_handle(h2_session->req);
|
||||
h2_stream_info->as_client->last_sent_stream_id = MIN(h2_stream_info->as_client->last_sent_stream_id, stream_id) - 1;
|
||||
|
||||
req->event_cb(req, EV_HTTP_REQ_HDR, NULL, 0, req->event_cb_user);
|
||||
|
||||
@@ -2260,13 +2259,13 @@ static ssize_t nghttp2_client_select_padding_callback(nghttp2_session *session,
|
||||
size_t max_payloadlen, void *user_data)
|
||||
{
|
||||
struct tfe_h2_half_private *resp = NULL;
|
||||
struct tfe_h2_session *h2_session = NULL;
|
||||
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, frame->hd.stream_id);
|
||||
if (h2_session == NULL) return frame->hd.length;
|
||||
|
||||
h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
|
||||
if (!h2_session)
|
||||
return frame->hd.length;
|
||||
resp = h2_session->resp;
|
||||
if (!resp)
|
||||
if (resp == NULL)
|
||||
return frame->hd.length;
|
||||
|
||||
return (ssize_t)MIN(max_payloadlen, frame->hd.length + (resp->h2_payload.padlen));
|
||||
|
||||
Reference in New Issue
Block a user