http: Fix HTTP/2 connection reuse
authorJay Satiro <raysatiro@yahoo.com>
Sun, 5 Jun 2016 07:13:32 +0000 (03:13 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Sun, 5 Jun 2016 07:13:32 +0000 (03:13 -0400)
- Change the parser to not require a minor version for HTTP/2.

HTTP/2 connection reuse broke when we changed from HTTP/2.0 to HTTP/2
in 8243a95 because the parser still expected a minor version.

Bug: https://github.com/curl/curl/issues/855
Reported-by: Andrew Robbins, Frank Gevaerts
lib/http.c

index 6a76b88ed19c8e20635b9d60c7ab4a7c1fb07d49..357f81ef241926519629518eca30765b7f07fe5f 100644 (file)
@@ -3308,6 +3308,13 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
                     &httpversion_major,
                     &conn->httpversion,
                     &k->httpcode);
+
+        if(nc == 1 && httpversion_major == 2 &&
+           1 == sscanf(HEADER1, " HTTP/2 %d", &k->httpcode)) {
+          conn->httpversion = 0;
+          nc = 3;
+        }
+
         if(nc==3) {
           conn->httpversion += 10 * httpversion_major;