Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e77c766

Browse files
0x1eefmatzbot
authored andcommitted
[ruby/net-http] No longer neccessary to call String#freeze on string literals.
See #144 ruby/net-http@5a986c13d3
1 parent 465c222 commit e77c766

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/net/http.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ def proxy_from_env?
17981798
def proxy_uri # :nodoc:
17991799
return if @proxy_uri == false
18001800
@proxy_uri ||= URI::HTTP.new(
1801-
"http".freeze, nil, address, port, nil, nil, nil, nil, nil
1801+
"http", nil, address, port, nil, nil, nil, nil, nil
18021802
).find_proxy || false
18031803
@proxy_uri || nil
18041804
end

lib/net/http/generic_request.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def initialize(m, reqbody, resbody, uri_or_path, initheader = nil) # :nodoc:
2323
raise ArgumentError, "no host component for URI" unless (hostname && hostname.length > 0)
2424
@uri = uri_or_path.dup
2525
host = @uri.hostname.dup
26-
host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port
26+
host << ":" << @uri.port.to_s if @uri.port != @uri.default_port
2727
@path = uri_or_path.request_uri
2828
raise ArgumentError, "no HTTP request path given" unless @path
2929
else
@@ -212,15 +212,15 @@ def update_uri(addr, port, ssl) # :nodoc: internal use only
212212
return unless @uri
213213

214214
if ssl
215-
scheme = 'https'.freeze
215+
scheme = 'https'
216216
klass = URI::HTTPS
217217
else
218-
scheme = 'http'.freeze
218+
scheme = 'http'
219219
klass = URI::HTTP
220220
end
221221

222222
if host = self['host']
223-
host.sub!(/:.*/m, ''.freeze)
223+
host.sub!(/:.*/m, '')
224224
elsif host = @uri.host
225225
else
226226
host = addr

0 commit comments

Comments
 (0)