diff --git a/lib/net/http.rb b/lib/net/http.rb
index a5834412..9632b31f 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# = net/http.rb
#
@@ -1028,7 +1028,7 @@ def connect
write_timeout: @write_timeout,
continue_timeout: @continue_timeout,
debug_output: @debug_output)
- buf = "CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n"
+ buf = +"CONNECT #{conn_address}:#{@port} HTTP/#{HTTPVersion}\r\n"
buf << "Host: #{@address}:#{@port}\r\n"
if proxy_user
credential = ["#{proxy_user}:#{proxy_pass}"].pack('m0')
diff --git a/lib/net/http/backward.rb b/lib/net/http/backward.rb
index 691e41e4..b44577ed 100644
--- a/lib/net/http/backward.rb
+++ b/lib/net/http/backward.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# for backward compatibility
# :enddoc:
diff --git a/lib/net/http/exceptions.rb b/lib/net/http/exceptions.rb
index 9c425cae..ceec8f7b 100644
--- a/lib/net/http/exceptions.rb
+++ b/lib/net/http/exceptions.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Net
# Net::HTTP exception class.
# You cannot use Net::HTTPExceptions directly; instead, you must use
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb
index 313de6ac..d74b7a04 100644
--- a/lib/net/http/generic_request.rb
+++ b/lib/net/http/generic_request.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# HTTPGenericRequest is the parent of the Net::HTTPRequest class.
# Do not use this directly; use a subclass of Net::HTTPRequest.
#
@@ -110,7 +110,7 @@ def set_body_internal(str) #:nodoc: internal use only
raise ArgumentError, "both of body argument and HTTPRequest#body set" if str and (@body or @body_stream)
self.body = str if str
if @body.nil? && @body_stream.nil? && @body_data.nil? && request_body_permitted?
- self.body = ''
+ self.body = +''
end
end
@@ -239,7 +239,7 @@ def encode_multipart_form_data(out, params, opt)
boundary ||= SecureRandom.urlsafe_base64(40)
chunked_p = chunked?
- buf = ''
+ buf = +''
params.each do |key, value, h={}|
key = quote_string(key, charset)
filename =
@@ -324,7 +324,7 @@ def write_header(sock, ver, path)
if /[\r\n]/ =~ reqline
raise ArgumentError, "A Request-Line must not contain CR or LF"
end
- buf = ""
+ buf = +""
buf << reqline << "\r\n"
each_capitalized do |k,v|
buf << "#{k}: #{v}\r\n"
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
index b0ec4b06..cd68ef35 100644
--- a/lib/net/http/header.rb
+++ b/lib/net/http/header.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# The HTTPHeader module defines methods for reading and writing
# HTTP headers.
#
diff --git a/lib/net/http/proxy_delta.rb b/lib/net/http/proxy_delta.rb
index a2f770eb..e7d30def 100644
--- a/lib/net/http/proxy_delta.rb
+++ b/lib/net/http/proxy_delta.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
module Net::HTTP::ProxyDelta #:nodoc: internal use only
private
diff --git a/lib/net/http/request.rb b/lib/net/http/request.rb
index 1e86f3e4..0de2ff07 100644
--- a/lib/net/http/request.rb
+++ b/lib/net/http/request.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# HTTP request class.
# This class wraps together the request header and the request path.
# You cannot use this class directly. Instead, you should use one of its
diff --git a/lib/net/http/requests.rb b/lib/net/http/requests.rb
index d4c80a38..72c4c5e8 100644
--- a/lib/net/http/requests.rb
+++ b/lib/net/http/requests.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# HTTP/1.1 methods --- RFC2616
#
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index f8b522f1..dbf59345 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# HTTP response class.
#
# This class wraps together the response header and the response body (the
@@ -513,7 +513,7 @@ def procdest(dest, block)
if block
Net::ReadAdapter.new(block)
else
- dest || ''
+ dest || +''
end
end
diff --git a/lib/net/https.rb b/lib/net/https.rb
index d46721c8..0f23e1fb 100644
--- a/lib/net/https.rb
+++ b/lib/net/https.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
=begin
= net/https -- SSL/TLS enhancement for Net::HTTP.
diff --git a/test/net/http/test_buffered_io.rb b/test/net/http/test_buffered_io.rb
index 8c299ead..41b5c168 100644
--- a/test/net/http/test_buffered_io.rb
+++ b/test/net/http/test_buffered_io.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'test/unit'
require 'net/http'
require 'stringio'
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index e9471273..fc6f847a 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -1,5 +1,5 @@
# coding: US-ASCII
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'test/unit'
require 'net/http'
require 'stringio'
@@ -362,7 +362,7 @@ def _test_get__get(http)
end
def _test_get__iter(http)
- buf = ''
+ buf = +''
res = http.get('/') {|s| buf << s }
assert_kind_of Net::HTTPResponse, res
# assert_kind_of String, res.body
@@ -378,7 +378,7 @@ def _test_get__iter(http)
end
def _test_get__chunked(http)
- buf = ''
+ buf = +''
res = http.get('/') {|s| buf << s }
assert_kind_of Net::HTTPResponse, res
# assert_kind_of String, res.body
@@ -685,7 +685,7 @@ def _test_request__file(http)
assert_not_nil res['content-length']
assert_equal $test_net_http_data.size, res['content-length'].to_i
end
- f = StringIO.new("".force_encoding("ASCII-8BIT"))
+ f = StringIO.new("".b)
res.read_body f
assert_equal $test_net_http_data.bytesize, f.string.bytesize
assert_equal $test_net_http_data.encoding, f.string.encoding
@@ -828,7 +828,7 @@ def test_set_form
data = [
['name', 'Gonbei Nanashi'],
['name', "\u{540d}\u{7121}\u{3057}\u{306e}\u{6a29}\u{5175}\u{885b}"],
- ['s"i\o', StringIO.new("\u{3042 3044 4e9c 925b}")],
+ ['s"i\o', StringIO.new(+"\u{3042 3044 4e9c 925b}")],
["file", file, filename: "ruby-test"]
]
expected = <<"__EOM__".gsub(/\n/, "\r\n")
@@ -990,7 +990,7 @@ class TestNetHTTPContinue < Test::Unit::TestCase
include TestNetHTTPUtils
def logfile
- @debug = StringIO.new('')
+ @debug = StringIO.new(+'')
end
def mount_proc(&block)
@@ -1090,7 +1090,7 @@ class TestNetHTTPSwitchingProtocols < Test::Unit::TestCase
include TestNetHTTPUtils
def logfile
- @debug = StringIO.new('')
+ @debug = StringIO.new(+'')
end
def mount_proc(&block)
diff --git a/test/net/http/test_http_request.rb b/test/net/http/test_http_request.rb
index 7fd82b03..7d9d61f9 100644
--- a/test/net/http/test_http_request.rb
+++ b/test/net/http/test_http_request.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'net/http'
require 'test/unit'
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb
index b1ca9e82..4a943a14 100644
--- a/test/net/http/test_httpheader.rb
+++ b/test/net/http/test_httpheader.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'net/http'
require 'test/unit'
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index 394b4c5b..e7e3fa4b 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -1,5 +1,5 @@
# coding: US-ASCII
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'net/http'
require 'test/unit'
require 'stringio'
@@ -189,12 +189,12 @@ def test_read_body_body_encoding_true_with_iso_8859_1_content_type_header
body = res.read_body
end
- assert_equal "hello\u1234".force_encoding("ISO-8859-1"), body
+ assert_equal (+"hello\u1234").force_encoding("ISO-8859-1"), body
assert_equal Encoding::ISO_8859_1, body.encoding
end
def test_read_body_body_encoding_true_with_utf8_meta_charset
- res_body = "hello\u1234"
+ res_body = +"hello\u1234"
io = dummy_io(<hello\u1234