From eae293b6de074152c0b2296a0073731f23aac369 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Fri, 27 Nov 2020 11:48:26 -0600 Subject: [PATCH] Fix regex warnings in const.rb & test_launcher.rb Fix Puma::Const::ILLEGAL_HEADER_KEY_REGEX overlap See https://github.com/puma/puma/pull/2495 and https://github.com/puma/puma/pull/2439 Update test_launcher.rb, use parenthesis with regex parameters --- lib/puma/const.rb | 2 +- test/test_launcher.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puma/const.rb b/lib/puma/const.rb index 12a804f630..375c14bb2d 100644 --- a/lib/puma/const.rb +++ b/lib/puma/const.rb @@ -241,7 +241,7 @@ module Const # Illegal character in the key or value of response header DQUOTE = "\"".freeze HTTP_HEADER_DELIMITER = Regexp.escape("(),/:;<=>?@[]{}").freeze - ILLEGAL_HEADER_KEY_REGEX = /(\u0000-\u0025|#{DQUOTE}|#{HTTP_HEADER_DELIMITER})/.freeze + ILLEGAL_HEADER_KEY_REGEX = /[\u0000-\u0025#{HTTP_HEADER_DELIMITER}]/.freeze ILLEGAL_HEADER_VALUE_REGEX = /[\000-\037]/.freeze # Banned keys of response header diff --git a/test/test_launcher.rb b/test/test_launcher.rb index d765b8dce1..ac790dce6b 100644 --- a/test/test_launcher.rb +++ b/test/test_launcher.rb @@ -171,7 +171,7 @@ def test_log_config_enabled end def test_log_config_disabled - refute_match /Configuration:/, launcher.events.stdout.string + refute_match(/Configuration:/, launcher.events.stdout.string) end private