http2: discard frames with no SessionHandle

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
This commit is contained in:
Anders Bakken 2015-08-10 17:26:36 -07:00 committed by Daniel Stenberg
parent c8a656d3c7
commit 5778e6f526
3 changed files with 111 additions and 140 deletions

View file

@ -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);
@ -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) {