diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-03-23 10:25:18 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-03-23 10:26:04 +0100 |
commit | 4b02b84897c0038ee9d52891307ec10e5f50da01 (patch) | |
tree | 2839f478d5125db190d9fc2309417c495d055e00 | |
parent | 145c4692ffb58ea4492a7912f636b3b834c84dd7 (diff) |
http2: move the init too for when its actually needed
... it would otherwise lead to memory leakage if we never actually do
the switch.
-rw-r--r-- | lib/http2.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/http2.c b/lib/http2.c index 4c9d9f760..f6dbd8069 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -636,10 +636,6 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req, struct SingleRequest *k = &conn->data->req; uint8_t *binsettings = conn->proto.httpc.binsettings; - result = Curl_http2_init(conn); - if(result) - return result; - /* As long as we have a fixed set of settings, we don't have to dynamically * figure out the base64 strings since it'll always be the same. However, * the settings will likely not be fixed every time in the future. @@ -974,12 +970,17 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex, CURLcode Curl_http2_setup(struct connectdata *conn) { + CURLcode result; struct http_conn *httpc = &conn->proto.httpc; if(conn->handler->flags & PROTOPT_SSL) conn->handler = &Curl_handler_http2_ssl; else conn->handler = &Curl_handler_http2; + result = Curl_http2_init(conn); + if(result) + return result; + infof(conn->data, "Using HTTP2\n"); httpc->bodystarted = FALSE; httpc->error_code = NGHTTP2_NO_ERROR; @@ -996,7 +997,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn) conn->httpversion = 20; - return 0; + return CURLE_OK; } CURLcode Curl_http2_switched(struct connectdata *conn, |