Skip to content

Commit 7430364

Browse files
authored
Change backquote to singlequote in messages (#154)
See <https://bugs.ruby-lang.org/issues/16495> for more context.
1 parent 1ff2b89 commit 7430364

11 files changed

+31
-31
lines changed

lib/webrick/cgi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def service(req, res)
160160
__send__(method_name, req, res)
161161
else
162162
raise HTTPStatus::MethodNotAllowed,
163-
"unsupported method `#{req.request_method}'."
163+
"unsupported method '#{req.request_method}'."
164164
end
165165
end
166166

lib/webrick/httpproxy.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def proxy_service(req, res)
118118
public_send("do_#{req.request_method}", req, res)
119119
rescue NoMethodError
120120
raise HTTPStatus::MethodNotAllowed,
121-
"unsupported method `#{req.request_method}'."
121+
"unsupported method '#{req.request_method}'."
122122
rescue => err
123123
logger.debug("#{err.class}: #{err.message}")
124124
raise HTTPStatus::ServiceUnavailable, err.message
@@ -149,7 +149,7 @@ def do_CONNECT(req, res)
149149
end
150150

151151
begin
152-
@logger.debug("CONNECT: upstream proxy is `#{host}:#{port}'.")
152+
@logger.debug("CONNECT: upstream proxy is '#{host}:#{port}'.")
153153
os = TCPSocket.new(host, port) # origin server
154154

155155
if proxy
@@ -175,7 +175,7 @@ def do_CONNECT(req, res)
175175
@logger.debug("CONNECT #{host}:#{port}: succeeded")
176176
res.status = HTTPStatus::RC_OK
177177
rescue => ex
178-
@logger.debug("CONNECT #{host}:#{port}: failed `#{ex.message}'")
178+
@logger.debug("CONNECT #{host}:#{port}: failed '#{ex.message}'")
179179
res.set_error(ex)
180180
raise HTTPStatus::EOFError
181181
ensure
@@ -241,7 +241,7 @@ def choose_header(src, dst)
241241
if HopByHop.member?(key) || # RFC2616: 13.5.1
242242
connections.member?(key) || # RFC2616: 14.10
243243
ShouldNotTransfer.member?(key) # pragmatics
244-
@logger.debug("choose_header: `#{key}: #{value}'")
244+
@logger.debug("choose_header: '#{key}: #{value}'")
245245
next
246246
end
247247
dst[key] = value

lib/webrick/httprequest.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def parse(socket=nil)
224224
@script_name = ""
225225
@path_info = @path.dup
226226
rescue
227-
raise HTTPStatus::BadRequest, "bad URI `#{@unparsed_uri}'."
227+
raise HTTPStatus::BadRequest, "bad URI '#{@unparsed_uri}'."
228228
end
229229

230230
if /\Aclose\z/io =~ self["connection"]
@@ -464,7 +464,7 @@ def read_request_line(socket)
464464
@http_version = HTTPVersion.new($3 ? $3 : "0.9")
465465
else
466466
rl = @request_line.sub(/\x0d?\x0a\z/o, '')
467-
raise HTTPStatus::BadRequest, "bad Request-Line `#{rl}'."
467+
raise HTTPStatus::BadRequest, "bad Request-Line '#{rl}'."
468468
end
469469
end
470470

@@ -563,7 +563,7 @@ def read_chunk_size(socket)
563563
chunk_ext = $2
564564
[ chunk_size, chunk_ext ]
565565
else
566-
raise HTTPStatus::BadRequest, "bad chunk `#{line}'."
566+
raise HTTPStatus::BadRequest, "bad chunk '#{line}'."
567567
end
568568
end
569569

@@ -581,7 +581,7 @@ def read_chunked(socket, block)
581581

582582
line = read_line(socket) # skip CRLF
583583
unless line == "\r\n"
584-
raise HTTPStatus::BadRequest, "extra data after chunk `#{line}'."
584+
raise HTTPStatus::BadRequest, "extra data after chunk '#{line}'."
585585
end
586586

587587
chunk_size, = read_chunk_size(socket)

lib/webrick/httpresponse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def error_body(backtrace, ex, host, port)
453453
_end_of_html_
454454

455455
if backtrace && $DEBUG
456-
@body << "backtrace of `#{HTMLUtils::escape(ex.class.to_s)}' "
456+
@body << "backtrace of '#{HTMLUtils::escape(ex.class.to_s)}' "
457457
@body << "#{HTMLUtils::escape(ex.message)}"
458458
@body << "<PRE>"
459459
ex.backtrace.each{|line| @body << "\t#{line}\n"}

lib/webrick/httpserver.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ def service(req, res)
128128
do_OPTIONS(req, res)
129129
raise HTTPStatus::OK
130130
end
131-
raise HTTPStatus::NotFound, "`#{req.unparsed_uri}' not found."
131+
raise HTTPStatus::NotFound, "'#{req.unparsed_uri}' not found."
132132
end
133133

134134
servlet, options, script_name, path_info = search_servlet(req.path)
135-
raise HTTPStatus::NotFound, "`#{req.path}' not found." unless servlet
135+
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless servlet
136136
req.script_name = script_name
137137
req.path_info = path_info
138138
si = servlet.get_instance(self, *options)

lib/webrick/httpservlet/abstract.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def service(req, res)
105105
__send__(method_name, req, res)
106106
else
107107
raise HTTPStatus::MethodNotAllowed,
108-
"unsupported method `#{req.request_method}'."
108+
"unsupported method '#{req.request_method}'."
109109
end
110110
end
111111

lib/webrick/httpservlet/filehandler.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def do_GET(req, res)
250250

251251
def do_POST(req, res)
252252
unless exec_handler(req, res)
253-
raise HTTPStatus::NotFound, "`#{req.path}' not found."
253+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
254254
end
255255
end
256256

@@ -307,7 +307,7 @@ def prevent_directory_traversal(req, res)
307307
end
308308

309309
def exec_handler(req, res)
310-
raise HTTPStatus::NotFound, "`#{req.path}' not found." unless @root
310+
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless @root
311311
if set_filename(req, res)
312312
handler = get_handler(req, res)
313313
call_callback(:HandlerCallback, req, res)
@@ -359,7 +359,7 @@ def set_filename(req, res)
359359
call_callback(:FileCallback, req, res)
360360
return true
361361
else
362-
raise HTTPStatus::NotFound, "`#{req.path}' not found."
362+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
363363
end
364364
end
365365

@@ -368,8 +368,8 @@ def set_filename(req, res)
368368

369369
def check_filename(req, res, name)
370370
if nondisclosure_name?(name) || windows_ambiguous_name?(name)
371-
@logger.warn("the request refers nondisclosure name `#{name}'.")
372-
raise HTTPStatus::NotFound, "`#{req.path}' not found."
371+
@logger.warn("the request refers nondisclosure name '#{name}'.")
372+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
373373
end
374374
end
375375

@@ -437,7 +437,7 @@ def nondisclosure_name?(name)
437437
def set_dir_list(req, res)
438438
redirect_to_directory_uri(req, res)
439439
unless @options[:FancyIndexing]
440-
raise HTTPStatus::Forbidden, "no access permission to `#{req.path}'"
440+
raise HTTPStatus::Forbidden, "no access permission to '#{req.path}'"
441441
end
442442
local_path = res.filename
443443
list = Dir::entries(local_path).collect{|name|

lib/webrick/httputils.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ module HTTPUtils
2929
# normalized.
3030

3131
def normalize_path(path)
32-
raise "abnormal path `#{path}'" if path[0] != ?/
32+
raise "abnormal path '#{path}'" if path[0] != ?/
3333
ret = path.dup
3434

3535
ret.gsub!(%r{/+}o, '/') # // => /
3636
while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
3737
while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
3838

39-
raise "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
39+
raise "abnormal path '#{path}'" if %r{/\.\.(/|\Z)} =~ ret
4040
ret
4141
end
4242
module_function :normalize_path

lib/webrick/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def cleanup_listener
365365
begin
366366
s.shutdown
367367
rescue Errno::ENOTCONN
368-
# when `Errno::ENOTCONN: Socket is not connected' on some platforms,
368+
# when 'Errno::ENOTCONN: Socket is not connected' on some platforms,
369369
# call #close instead of #shutdown.
370370
# (ignore @config[:ShutdownSocketWithoutClose])
371371
s.close

test/webrick/test_filehandler.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def test_filehandler
188188
def test_non_disclosure_name
189189
config = { :DocumentRoot => File.dirname(__FILE__), }
190190
log_tester = lambda {|log, access_log|
191-
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
191+
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
192192
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
193193
assert_equal([], log)
194194
}
@@ -220,7 +220,7 @@ def test_directory_traversal
220220
config = { :DocumentRoot => File.dirname(__FILE__), }
221221
log_tester = lambda {|log, access_log|
222222
log = log.reject {|s| /ERROR bad URI/ =~ s }
223-
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
223+
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
224224
assert_equal([], log)
225225
}
226226
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
@@ -249,7 +249,7 @@ def test_short_filename
249249
return if File.executable?(__FILE__) # skip on strange file system
250250

251251
log_tester = lambda {|log, access_log|
252-
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
252+
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
253253
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
254254
assert_equal([], log)
255255
}
@@ -346,7 +346,7 @@ def req.meta_vars
346346
},
347347
}
348348
log_tester = lambda {|log, access_log|
349-
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
349+
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
350350
assert_equal([], log)
351351
}
352352
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
@@ -382,7 +382,7 @@ def req.meta_vars
382382
def test_erbhandler
383383
config = { :DocumentRoot => File.dirname(__FILE__) }
384384
log_tester = lambda {|log, access_log|
385-
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
385+
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
386386
assert_equal([], log)
387387
}
388388
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|

test/webrick/test_httpserver.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ def test_callbacks
237237
:RequestCallback => Proc.new{|req, res| requested0 += 1 },
238238
}
239239
log_tester = lambda {|log, access_log|
240-
assert(log.find {|s| %r{ERROR `/' not found\.} =~ s })
241-
assert_equal([], log.reject {|s| %r{ERROR `/' not found\.} =~ s })
240+
assert(log.find {|s| %r{ERROR '/' not found\.} =~ s })
241+
assert_equal([], log.reject {|s| %r{ERROR '/' not found\.} =~ s })
242242
}
243243
TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
244244
vhost_config = {
@@ -411,7 +411,7 @@ def test_request_handler_callback_is_deprecated
411411
log_tester = lambda {|log, access_log|
412412
assert_equal(2, log.length)
413413
assert_match(/WARN :RequestHandler is deprecated, please use :RequestCallback/, log[0])
414-
assert_match(%r{ERROR `/' not found\.}, log[1])
414+
assert_match(%r{ERROR '/' not found\.}, log[1])
415415
}
416416
TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
417417
Thread.pass while server.status != :Running
@@ -465,7 +465,7 @@ def test_cntrl_in_path
465465
http = Net::HTTP.new(addr[3], addr[1])
466466
req = Net::HTTP::Get.new('/notexist%0a/foo')
467467
http.request(req) { |res| assert_equal('404', res.code) }
468-
exp = %Q(ERROR `/notexist\\n/foo' not found.\n)
468+
exp = %Q(ERROR '/notexist\\n/foo' not found.\n)
469469
assert_equal 1, log_ary.size
470470
assert_include log_ary[0], exp
471471
ensure

0 commit comments

Comments
 (0)