diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-06-27 19:17:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-27 19:17:32 -0400 |
commit | 2d41895fdcfb3c93c23afe702691ad8a9becf62c (patch) | |
tree | 52a635f6129ef36e30faaea1ff042dedcee4fe4b | |
parent | 70c838f7204f9bb08992d2b68b1d52b80c97b016 (diff) | |
parent | dd396f693c8bc29332864f38b8c5fee2c6de5aa0 (diff) | |
download | rack-2d41895fdcfb3c93c23afe702691ad8a9becf62c.tar.gz |
Merge pull request #1373 from olleolleolle/host-using-index-instead-of-regex
Avoid regex in Request#host
-rw-r--r-- | lib/rack/request.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb index f999cd4a..951fe8cb 100644 --- a/lib/rack/request.rb +++ b/lib/rack/request.rb @@ -243,7 +243,12 @@ module Rack def host # Remove port number. - host_with_port.to_s.sub(/:\d+\z/, '') + h = host_with_port + if colon_index = h.index(":") + h[0, colon_index] + else + h + end end def port |