From 5a986c13d3a54d94f82f6332670eb1be5a79d476 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 15 Sep 2023 03:35:34 -0300 Subject: [PATCH] No longer neccessary to call `String#freeze` on string literals. See #144 --- lib/net/http.rb | 2 +- lib/net/http/generic_request.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/net/http.rb b/lib/net/http.rb index 4cf3fa3e..1b73b9b3 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1798,7 +1798,7 @@ def proxy_from_env? def proxy_uri # :nodoc: return if @proxy_uri == false @proxy_uri ||= URI::HTTP.new( - "http".freeze, nil, address, port, nil, nil, nil, nil, nil + "http", nil, address, port, nil, nil, nil, nil, nil ).find_proxy || false @proxy_uri || nil end diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb index 9421535c..44e329a0 100644 --- a/lib/net/http/generic_request.rb +++ b/lib/net/http/generic_request.rb @@ -23,7 +23,7 @@ def initialize(m, reqbody, resbody, uri_or_path, initheader = nil) # :nodoc: raise ArgumentError, "no host component for URI" unless (hostname && hostname.length > 0) @uri = uri_or_path.dup host = @uri.hostname.dup - host << ":".freeze << @uri.port.to_s if @uri.port != @uri.default_port + host << ":" << @uri.port.to_s if @uri.port != @uri.default_port @path = uri_or_path.request_uri raise ArgumentError, "no HTTP request path given" unless @path else @@ -212,15 +212,15 @@ def update_uri(addr, port, ssl) # :nodoc: internal use only return unless @uri if ssl - scheme = 'https'.freeze + scheme = 'https' klass = URI::HTTPS else - scheme = 'http'.freeze + scheme = 'http' klass = URI::HTTP end if host = self['host'] - host.sub!(/:.*/m, ''.freeze) + host.sub!(/:.*/m, '') elsif host = @uri.host else host = addr