]> granicus.if.org Git - curl/commitdiff
http2: lazy init header_recvbuf
authorDaniel Stenberg <daniel@haxx.se>
Fri, 8 May 2015 13:53:18 +0000 (15:53 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 18 May 2015 06:57:18 +0000 (08:57 +0200)
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!

lib/http.c
lib/http2.c

index b2ecc9c0a84091379a9263aa49ad211937386e51..6d11c288b1576330a9e1df3f30f5830d8e998df3 100644 (file)
@@ -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;
index 7070df51142b087d7dd92abb46d562f00be19eae..b492e286a60f7c726846e4fdbc18c0b336e3e69d 100644 (file)
@@ -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 */