diff options
author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-02-26 23:28:30 +0900 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2015-02-27 21:17:27 +0000 |
commit | 48b5374e65a48a14aee18eab0f0b7e3d97850d8f (patch) | |
tree | b034b2b7e5ebfdd07c751ff32d348a8743e89939 /lib/http2.c | |
parent | c715fa0b60c86449e09b313245de621b32e329d2 (diff) |
http2: Return error if stream was closed with other than NO_ERROR
Previously, we just ignored error code passed to
on_stream_close_callback and just return 0 (success) after stream
closure even if stream was reset with error. This patch records error
code in on_stream_close_callback, and return -1 and use CURLE_HTTP2
error code on abnormal stream closure.
Diffstat (limited to 'lib/http2.c')
-rw-r--r-- | lib/http2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/http2.c b/lib/http2.c index 8cde9101c..d1f42942e 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -365,6 +365,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id, return 0; } + c->error_code = error_code; c->closed = TRUE; return 0; @@ -783,6 +784,13 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex, /* Reset to FALSE to prevent infinite loop in readwrite_data function. */ httpc->closed = FALSE; + if(httpc->error_code != NGHTTP2_NO_ERROR) { + failf(conn->data, + "HTTP/2 stream = %x was not closed cleanly: error_code = %d", + httpc->stream_id, httpc->error_code); + *err = CURLE_HTTP2; + return -1; + } return 0; } *err = CURLE_AGAIN; @@ -980,6 +988,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn) infof(conn->data, "Using HTTP2\n"); httpc->bodystarted = FALSE; + httpc->error_code = NGHTTP2_NO_ERROR; httpc->closed = FALSE; httpc->header_recvbuf = Curl_add_buffer_init(); httpc->nread_header_recvbuf = 0; |