aboutsummaryrefslogtreecommitdiff
path: root/lib/http2.c
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-02-17 21:36:59 +0900
committerJay Satiro <raysatiro@yahoo.com>2016-04-11 21:43:24 -0400
commit92c2a4c053f75bbfe8434379dbdd6acd714a2252 (patch)
tree8e9ddd90b90500e33da0cf006a11ee6b18b47334 /lib/http2.c
parentb2a0376350cb4f788ca2cdff2e89a23bdc789888 (diff)
http2: Add handling stream level error
Previously, when a stream was closed with other than NGHTTP2_NO_ERROR by RST_STREAM, underlying TCP connection was dropped. This is undesirable since there may be other streams multiplexed and they are very much fine. This change introduce new error code CURLE_HTTP2_STREAM, which indicates stream error that only affects the relevant stream, and connection should be kept open. The existing CURLE_HTTP2 means connection error in general. Ref: https://github.com/curl/curl/issues/659 Ref: https://github.com/curl/curl/pull/663
Diffstat (limited to 'lib/http2.c')
-rw-r--r--lib/http2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/http2.c b/lib/http2.c
index 8f19ebaee..e15237e77 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1059,7 +1059,7 @@ static ssize_t http2_handle_stream_close(struct connectdata *conn,
if(stream->error_code != NGHTTP2_NO_ERROR) {
failf(data, "HTTP/2 stream %u was not closed cleanly: error_code = %d",
stream->stream_id, stream->error_code);
- *err = CURLE_HTTP2;
+ *err = CURLE_HTTP2_STREAM;
return -1;
}
@@ -1231,6 +1231,13 @@ 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