aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-05-08 15:53:18 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-05-18 08:57:18 +0200
commitbe4c8fd1ef11a565fcfceed48d40aa9889f095d4 (patch)
treef789720c908f7119cf1c6abf4b7222798e503a13
parent783b3c7b427dce4b1906709cef350af5e9623673 (diff)
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!
-rw-r--r--lib/http.c1
-rw-r--r--lib/http2.c3
2 files changed, 3 insertions, 1 deletions
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 */