mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
http2: Curl_http2_setup needs to init stream data in all invokes
Thus function was written to avoid doing multiple connection data initializations, which is fine, but since it also initiates stream related data it is crucial that it doesn't skip those even if called again for the same connection. Solved by moving the stream initializations before the "doing-it-again" check. Reported-by: Inho Oh Fixes #7630 Closes #7692
This commit is contained in:
parent
e41e1b2a4d
commit
3cb8a74867
29
lib/http2.c
29
lib/http2.c
@ -763,6 +763,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
|
||||
ncopy);
|
||||
stream->nread_header_recvbuf += ncopy;
|
||||
|
||||
DEBUGASSERT(stream->mem);
|
||||
H2BUGF(infof(data_s, "Store %zu bytes headers from stream %u at %p",
|
||||
ncopy, stream_id, stream->mem));
|
||||
|
||||
@ -2214,6 +2215,22 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
|
||||
Curl_dyn_init(&stream->header_recvbuf, DYN_H2_HEADERS);
|
||||
Curl_dyn_init(&stream->trailer_recvbuf, DYN_H2_TRAILERS);
|
||||
|
||||
stream->upload_left = 0;
|
||||
stream->upload_mem = NULL;
|
||||
stream->upload_len = 0;
|
||||
stream->mem = data->state.buffer;
|
||||
stream->len = data->set.buffer_size;
|
||||
|
||||
httpc->inbuflen = 0;
|
||||
httpc->nread_inbuf = 0;
|
||||
|
||||
httpc->pause_stream_id = 0;
|
||||
httpc->drain_total = 0;
|
||||
|
||||
multi_connchanged(data->multi);
|
||||
/* below this point only connection related inits are done, which only needs
|
||||
to be done once per connection */
|
||||
|
||||
if((conn->handler == &Curl_handler_http2_ssl) ||
|
||||
(conn->handler == &Curl_handler_http2))
|
||||
return CURLE_OK; /* already done */
|
||||
@ -2230,24 +2247,12 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
infof(data, "Using HTTP2, server supports multiplexing");
|
||||
stream->upload_left = 0;
|
||||
stream->upload_mem = NULL;
|
||||
stream->upload_len = 0;
|
||||
stream->mem = data->state.buffer;
|
||||
stream->len = data->set.buffer_size;
|
||||
|
||||
httpc->inbuflen = 0;
|
||||
httpc->nread_inbuf = 0;
|
||||
|
||||
httpc->pause_stream_id = 0;
|
||||
httpc->drain_total = 0;
|
||||
|
||||
conn->bits.multiplex = TRUE; /* at least potentially multiplexed */
|
||||
conn->httpversion = 20;
|
||||
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
|
||||
|
||||
infof(data, "Connection state changed (HTTP/2 confirmed)");
|
||||
multi_connchanged(data->multi);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user