diff options
author | Eric Wong <e@80x24.org> | 2015-04-07 21:30:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-04-07 21:30:23 +0000 |
commit | 76cc538fd8962eb380e8980a78d59b2133880196 (patch) | |
tree | 231099438aa60a925abb0a382519833829ba22f7 /lib | |
parent | ef17ddc255bbfca4cbe1d58058cf49f8327250dd (diff) | |
download | yahns-76cc538fd8962eb380e8980a78d59b2133880196.tar.gz |
A dumb string comparison will do here, so there's no point in paying the memory and CPU cost of a regexp match when we already extracted the suffix from a header key.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yahns/proxy_pass.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb index 48a61af..1b8eed7 100644 --- a/lib/yahns/proxy_pass.rb +++ b/lib/yahns/proxy_pass.rb @@ -223,7 +223,8 @@ class Yahns::ProxyPass # :nodoc: # header in the request next if /\A(?:VERSION|CONNECTION|KEEP_ALIVE|X_FORWARDED_FOR|TRAILER)/ =~ key - chunked = true if %r{\ATRANSFER_ENCODING} =~ key && val =~ /\bchunked\b/i + 'TRANSFER_ENCODING'.freeze == key && val =~ /\bchunked\b/i and + chunked = true key.tr!('_'.freeze, '-'.freeze) req << "#{key}: #{val}\r\n" end |