Skip to content

Commit

Permalink
http2: discard frames with no SessionHandle
Browse files Browse the repository at this point in the history
Return 0 instead of NGHTTP2_ERR_CALLBACK_FAILURE if we can't locate the
SessionHandle. Apparently mod_h2 will sometimes send a frame for a
stream_id we're finished with.

Use nghttp2_session_get_stream_user_data and
nghttp2_session_set_stream_user_data to identify SessionHandles instead
of a hash.

Closes #372
  • Loading branch information
Andersbakken authored and bagder committed Aug 11, 2015
1 parent c8a656d commit 5778e6f
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 138 deletions.
9 changes: 8 additions & 1 deletion lib/http.c
Expand Up @@ -1443,7 +1443,10 @@ CURLcode Curl_http_done(struct connectdata *conn,
CURLcode status, bool premature)
{
struct SessionHandle *data = conn->data;
struct HTTP *http =data->req.protop;
struct HTTP *http = data->req.protop;
#ifdef USE_NGHTTP2
struct http_conn *httpc = &conn->proto.httpc;
#endif

Curl_unencode_cleanup(conn);

Expand Down Expand Up @@ -1482,6 +1485,10 @@ CURLcode Curl_http_done(struct connectdata *conn,
free(http->push_headers);
http->push_headers = NULL;
}
if(http->stream_id) {
nghttp2_session_set_stream_user_data(httpc->h2, http->stream_id, 0);
http->stream_id = 0;
}
#endif

if(HTTPREQ_POST_FORM == data->set.httpreq) {
Expand Down
1 change: 0 additions & 1 deletion lib/http.h
Expand Up @@ -215,7 +215,6 @@ struct http_conn {
nghttp2_session_mem_recv */

/* this is a hash of all individual streams (SessionHandle structs) */
struct curl_hash streamsh;
struct h2settings settings;
#else
int unused; /* prevent a compiler warning */
Expand Down

0 comments on commit 5778e6f

Please sign in to comment.