From 57a62fe19a6c991ed66676c4abb3bd62f705905e Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Wed, 14 Feb 2018 19:04:45 +0000 Subject: [PATCH] removing pushed request from pending to avoid race-condition on sent requests --- lib/httpx/plugins/push_promise.rb | 1 + test/support/requests/plugins/push_promise.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/httpx/plugins/push_promise.rb b/lib/httpx/plugins/push_promise.rb index 503ae880..26cb1fa7 100644 --- a/lib/httpx/plugins/push_promise.rb +++ b/lib/httpx/plugins/push_promise.rb @@ -44,6 +44,7 @@ module HTTPX if request request.merge_headers(headers) @promise_headers[stream] = request + parser.pending.delete(request) else stream.refuse end diff --git a/test/support/requests/plugins/push_promise.rb b/test/support/requests/plugins/push_promise.rb index aa7b58bb..7427b290 100644 --- a/test/support/requests/plugins/push_promise.rb +++ b/test/support/requests/plugins/push_promise.rb @@ -4,7 +4,7 @@ module Requests module Plugins module PushPromise def test_plugin_push_promise_get - client = HTTPX.with(debug_level: 2, debug: $stderr).plugin(:push_promise) + client = HTTPX.plugin(:push_promise) html, css = client.get(push_html_uri, push_css_uri) verify_status(html.status, 200) verify_status(css.status, 200)