summaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-05-20 16:50:24 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-05-20 16:50:24 +0200
commit99114faf8281e13492e857c935f51d3fad6f22dc (patch)
tree043482db2034e88a139b35e8bd6963dfab432e14 /lib/http.c
parent316f79cef2318baf65dc55dec9b1617684fd78dd (diff)
downloadcurl-99114faf8281e13492e857c935f51d3fad6f22dc.tar.gz
http2: make connection re-use work
Http2 connections would wrongly get closed after each individual request. Co-authored-by: Tatsuhiro Tsujikawa Bug: http://curl.haxx.se/bug/view.cgi?id=1374
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index 1bb9ffb69..7dde8212e 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1744,9 +1744,12 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
the rest of the request in the PERFORM phase. */
*done = TRUE;
- switch (conn->negnpn) {
+ if(conn->httpversion < 20) { /* unless the connection is re-used and already
+ http2 */
+ switch (conn->negnpn) {
case NPN_HTTP2:
Curl_http2_init(conn);
+ Curl_http2_setup(conn);
Curl_http2_switched(conn);
break;
case NPN_HTTP1_1:
@@ -1755,7 +1758,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
default:
/* and as fallback */
break;
+ }
}
+ else
+ /* prepare for a http2 request */
+ Curl_http2_setup(conn);
http = data->req.protop;
@@ -2999,7 +3006,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
k->header = FALSE; /* no more header to parse! */
if((k->size == -1) && !k->chunk && !conn->bits.close &&
- (conn->httpversion >= 11) &&
+ (conn->httpversion == 11) &&
!(conn->handler->protocol & CURLPROTO_RTSP) &&
data->set.httpreq != HTTPREQ_HEAD) {
/* On HTTP 1.1, when connection is not to get closed, but no