aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-02-20 00:05:47 +0900
committerJay Satiro <raysatiro@yahoo.com>2016-04-11 21:43:26 -0400
commit4ec9eeb0c9a735c8bdf7d5ca18eafc80bb87b230 (patch)
tree619837687fb851954c9362bc47c5c84f547e453c /lib
parent92c2a4c053f75bbfe8434379dbdd6acd714a2252 (diff)
http2: Check session closure early in http2_recv
Ref: https://github.com/curl/curl/issues/659 Ref: https://github.com/curl/curl/pull/663
Diffstat (limited to 'lib')
-rw-r--r--lib/http2.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/http2.c b/lib/http2.c
index e15237e77..616c9d194 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1150,6 +1150,14 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
(void)sockindex; /* we always do HTTP2 on sockindex 0 */
+ if(!nghttp2_session_want_read(httpc->h2) &&
+ !nghttp2_session_want_write(httpc->h2)) {
+ DEBUGF(infof(data,
+ "http2_recv: nothing to do in this session\n"));
+ *err = CURLE_HTTP2;
+ return -1;
+ }
+
/* Nullify here because we call nghttp2_session_send() and they
might refer to the old buffer. */
stream->upload_mem = NULL;
@@ -1231,13 +1239,6 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
*err = CURLE_AGAIN;
return -1;
}
- else if(!nghttp2_session_want_read(httpc->h2) &&
- !nghttp2_session_want_write(httpc->h2)) {
- DEBUGF(infof(data,
- "http2_recv: nothing to do in this session\n"));
- *err = CURLE_HTTP2;
- return -1;
- }
else {
char *inbuf;
/* remember where to store incoming data for this stream and how big the