summaryrefslogtreecommitdiff
path: root/lib/http.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-02-23 23:33:04 +0900
committerJay Satiro <raysatiro@yahoo.com>2016-04-11 21:43:28 -0400
commit86c633a893f1c0b40383dcc40a73d4bb76356969 (patch)
tree2abfc7f471c4344d777879f8f11eec7f0fde598c /lib/http.h
parentb5f82148f5cd3ec7f7a5a6ab760f7c9a15673958 (diff)
downloadcurl-86c633a893f1c0b40383dcc40a73d4bb76356969.tar.gz
http2: Ensure that http2_handle_stream_close is called
This commit ensures that streams which was closed in on_stream_close callback gets passed to http2_handle_stream_close. Previously, this might not happen. To achieve this, we increment drain property to forcibly call recv function for that stream. To more accurately check that we have no pending event before shutting down HTTP/2 session, we sum up drain property into http_conn.drain_total. We only shutdown session if that value is 0. With this commit, when stream was closed before reading response header fields, error code CURLE_HTTP2_STREAM is returned even if HTTP/2 level error is NO_ERROR. This signals the upper layer that stream was closed by error just like TCP connection close in HTTP/1. Ref: https://github.com/curl/curl/issues/659 Ref: https://github.com/curl/curl/pull/663
Diffstat (limited to 'lib/http.h')
-rw-r--r--lib/http.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/http.h b/lib/http.h
index 5000df448..8aae35206 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -214,6 +214,7 @@ struct http_conn {
them for both cases. */
int32_t pause_stream_id; /* stream ID which paused
nghttp2_session_mem_recv */
+ int drain_total; /* sum of all stream's UrlState.drain */
/* this is a hash of all individual streams (SessionHandle structs) */
struct h2settings settings;