From: Daniel Stenberg Date: Fri, 8 May 2015 13:53:18 +0000 (+0200) Subject: http2: lazy init header_recvbuf X-Git-Tag: curl-7_43_0~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be4c8fd1ef11a565fcfceed48d40aa9889f095d4;p=curl http2: lazy init header_recvbuf It makes us use less memory when not doing HTTP/2 and subsequently also makes us not have to cleanup HTTP/2 related data when not using HTTP/2! --- diff --git a/lib/http.c b/lib/http.c index b2ecc9c0a..6d11c288b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -163,7 +163,6 @@ CURLcode Curl_http_setup_conn(struct connectdata *conn) conn->data->req.protop = http; - http->header_recvbuf = Curl_add_buffer_init(); http->nread_header_recvbuf = 0; http->bodystarted = FALSE; http->status_code = -1; diff --git a/lib/http2.c b/lib/http2.c index 7070df511..b492e286a 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1168,6 +1168,9 @@ CURLcode Curl_http2_setup(struct connectdata *conn) stream->stream_id = -1; + if(!stream->header_recvbuf) + stream->header_recvbuf = Curl_add_buffer_init(); + if((conn->handler == &Curl_handler_http2_ssl) || (conn->handler == &Curl_handler_http2)) return CURLE_OK; /* already done */