From 456fd868b3caf0bba1f64929a4127bac3c4cc989 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Mon, 8 Jan 2018 19:48:29 +0000 Subject: [PATCH 1/2] added check to set path to / if empty --- lib/http/2/compressor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/http/2/compressor.rb b/lib/http/2/compressor.rb index f3aa82c4..5c8240af 100644 --- a/lib/http/2/compressor.rb +++ b/lib/http/2/compressor.rb @@ -444,7 +444,11 @@ def encode(headers) # Literal header names MUST be translated to lowercase before # encoding and transmission. - headers.map! { |hk, hv| [hk.downcase, hv] } + headers.map! do |hk, hv| + key = hk.downcase + hv = "/" if key == ":path" && hv.empty? + [key, hv] + end commands = @cc.encode(headers) commands.each do |cmd| From e45b0c3443494c51df41a09919e986d7dfc82228 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Mon, 8 Jan 2018 20:04:01 +0000 Subject: [PATCH 2/2] rubocopz --- lib/http/2/compressor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/http/2/compressor.rb b/lib/http/2/compressor.rb index 5c8240af..c759095b 100644 --- a/lib/http/2/compressor.rb +++ b/lib/http/2/compressor.rb @@ -446,7 +446,7 @@ def encode(headers) # encoding and transmission. headers.map! do |hk, hv| key = hk.downcase - hv = "/" if key == ":path" && hv.empty? + hv = '/' if key == ':path' && hv.empty? [key, hv] end