aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-11-13 02:07:24 +0900
committerDaniel Stenberg <daniel@haxx.se>2014-11-13 15:38:12 +0100
commit7b7f0da4a7397c918308bf9acb831d4a1d1a9583 (patch)
treeda99d5909e82ec1238ddc21e5cb749434ef362da /lib/http.c
parent676d62fa0ede12e8f66688675d9db3bb7103cd55 (diff)
http2: Deal with HTTP/2 data inside response header buffer
Previously if HTTP/2 traffic is appended to HTTP Upgrade response header (thus they are in the same buffer), the trailing HTTP/2 traffic is not processed and lost. The appended data is most likely SETTINGS frame. If it is lost, nghttp2 library complains server does not obey the HTTP/2 protocol and issues GOAWAY frame and curl eventually drops connection. This commit fixes this problem and now trailing data is processed.
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/http.c b/lib/http.c
index 2487bac08..9083337c3 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1746,7 +1746,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(result)
return result;
- result = Curl_http2_switched(conn);
+ result = Curl_http2_switched(conn, NULL, 0);
if(result)
return result;
break;
@@ -2993,10 +2993,12 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
infof(data, "Received 101\n");
k->upgr101 = UPGR101_RECEIVED;
- /* switch to http2 now */
- result = Curl_http2_switched(conn);
+ /* switch to http2 now. The bytes after response headers
+ are also processed here, otherwise they are lost. */
+ result = Curl_http2_switched(conn, k->str, *nread);
if(result)
return result;
+ *nread = 0;
}
break;
default: