unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] http_response: simplify regular expression
@ 2015-06-05  8:49 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-06-05  8:49 UTC (permalink / raw)
  To: unicorn-public; +Cc: Eric Wong

It's ugly and less-readable to have redundant \z statements, and
according to ObjectSpace.memsize_of, this saves 4 bytes on x86-64.
 lib/unicorn/http_response.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index c9c2de8..801bf9a 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -33,7 +33,7 @@ module Unicorn::HttpResponse
             "Connection: close\r\n"
       headers.each do |key, value|
         case key
-        when %r{\A(?:Date\z|Connection\z)}i
+        when %r{\A(?:Date|Connection)\z}i
         when "rack.hijack"
           # This should only be hit under Rack >= 1.5, as this was an illegal

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-05  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05  8:49 [PATCH] http_response: simplify regular expression Eric Wong

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).