Skip to content

Change backquote to singlequote in messages #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/webrick/cgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def service(req, res)
__send__(method_name, req, res)
else
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."
"unsupported method '#{req.request_method}'."
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/webrick/httpproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def proxy_service(req, res)
public_send("do_#{req.request_method}", req, res)
rescue NoMethodError
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."
"unsupported method '#{req.request_method}'."
rescue => err
logger.debug("#{err.class}: #{err.message}")
raise HTTPStatus::ServiceUnavailable, err.message
Expand Down Expand Up @@ -149,7 +149,7 @@ def do_CONNECT(req, res)
end

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

if proxy
Expand All @@ -175,7 +175,7 @@ def do_CONNECT(req, res)
@logger.debug("CONNECT #{host}:#{port}: succeeded")
res.status = HTTPStatus::RC_OK
rescue => ex
@logger.debug("CONNECT #{host}:#{port}: failed `#{ex.message}'")
@logger.debug("CONNECT #{host}:#{port}: failed '#{ex.message}'")
res.set_error(ex)
raise HTTPStatus::EOFError
ensure
Expand Down Expand Up @@ -241,7 +241,7 @@ def choose_header(src, dst)
if HopByHop.member?(key) || # RFC2616: 13.5.1
connections.member?(key) || # RFC2616: 14.10
ShouldNotTransfer.member?(key) # pragmatics
@logger.debug("choose_header: `#{key}: #{value}'")
@logger.debug("choose_header: '#{key}: #{value}'")
next
end
dst[key] = value
Expand Down
8 changes: 4 additions & 4 deletions lib/webrick/httprequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def parse(socket=nil)
@script_name = ""
@path_info = @path.dup
rescue
raise HTTPStatus::BadRequest, "bad URI `#{@unparsed_uri}'."
raise HTTPStatus::BadRequest, "bad URI '#{@unparsed_uri}'."
end

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

Expand Down Expand Up @@ -563,7 +563,7 @@ def read_chunk_size(socket)
chunk_ext = $2
[ chunk_size, chunk_ext ]
else
raise HTTPStatus::BadRequest, "bad chunk `#{line}'."
raise HTTPStatus::BadRequest, "bad chunk '#{line}'."
end
end

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

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

chunk_size, = read_chunk_size(socket)
Expand Down
2 changes: 1 addition & 1 deletion lib/webrick/httpresponse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def error_body(backtrace, ex, host, port)
_end_of_html_

if backtrace && $DEBUG
@body << "backtrace of `#{HTMLUtils::escape(ex.class.to_s)}' "
@body << "backtrace of '#{HTMLUtils::escape(ex.class.to_s)}' "
@body << "#{HTMLUtils::escape(ex.message)}"
@body << "<PRE>"
ex.backtrace.each{|line| @body << "\t#{line}\n"}
Expand Down
4 changes: 2 additions & 2 deletions lib/webrick/httpserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def service(req, res)
do_OPTIONS(req, res)
raise HTTPStatus::OK
end
raise HTTPStatus::NotFound, "`#{req.unparsed_uri}' not found."
raise HTTPStatus::NotFound, "'#{req.unparsed_uri}' not found."
end

servlet, options, script_name, path_info = search_servlet(req.path)
raise HTTPStatus::NotFound, "`#{req.path}' not found." unless servlet
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless servlet
req.script_name = script_name
req.path_info = path_info
si = servlet.get_instance(self, *options)
Expand Down
2 changes: 1 addition & 1 deletion lib/webrick/httpservlet/abstract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def service(req, res)
__send__(method_name, req, res)
else
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."
"unsupported method '#{req.request_method}'."
end
end

Expand Down
12 changes: 6 additions & 6 deletions lib/webrick/httpservlet/filehandler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def do_GET(req, res)

def do_POST(req, res)
unless exec_handler(req, res)
raise HTTPStatus::NotFound, "`#{req.path}' not found."
raise HTTPStatus::NotFound, "'#{req.path}' not found."
end
end

Expand Down Expand Up @@ -307,7 +307,7 @@ def prevent_directory_traversal(req, res)
end

def exec_handler(req, res)
raise HTTPStatus::NotFound, "`#{req.path}' not found." unless @root
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless @root
if set_filename(req, res)
handler = get_handler(req, res)
call_callback(:HandlerCallback, req, res)
Expand Down Expand Up @@ -359,7 +359,7 @@ def set_filename(req, res)
call_callback(:FileCallback, req, res)
return true
else
raise HTTPStatus::NotFound, "`#{req.path}' not found."
raise HTTPStatus::NotFound, "'#{req.path}' not found."
end
end

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

def check_filename(req, res, name)
if nondisclosure_name?(name) || windows_ambiguous_name?(name)
@logger.warn("the request refers nondisclosure name `#{name}'.")
raise HTTPStatus::NotFound, "`#{req.path}' not found."
@logger.warn("the request refers nondisclosure name '#{name}'.")
raise HTTPStatus::NotFound, "'#{req.path}' not found."
end
end

Expand Down Expand Up @@ -437,7 +437,7 @@ def nondisclosure_name?(name)
def set_dir_list(req, res)
redirect_to_directory_uri(req, res)
unless @options[:FancyIndexing]
raise HTTPStatus::Forbidden, "no access permission to `#{req.path}'"
raise HTTPStatus::Forbidden, "no access permission to '#{req.path}'"
end
local_path = res.filename
list = Dir::entries(local_path).collect{|name|
Expand Down
4 changes: 2 additions & 2 deletions lib/webrick/httputils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ module HTTPUtils
# normalized.

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

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

raise "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
raise "abnormal path '#{path}'" if %r{/\.\.(/|\Z)} =~ ret
ret
end
module_function :normalize_path
Expand Down
2 changes: 1 addition & 1 deletion lib/webrick/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def cleanup_listener
begin
s.shutdown
rescue Errno::ENOTCONN
# when `Errno::ENOTCONN: Socket is not connected' on some platforms,
# when 'Errno::ENOTCONN: Socket is not connected' on some platforms,
# call #close instead of #shutdown.
# (ignore @config[:ShutdownSocketWithoutClose])
s.close
Expand Down
10 changes: 5 additions & 5 deletions test/webrick/test_filehandler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_filehandler
def test_non_disclosure_name
config = { :DocumentRoot => File.dirname(__FILE__), }
log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
assert_equal([], log)
}
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_directory_traversal
config = { :DocumentRoot => File.dirname(__FILE__), }
log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR bad URI/ =~ s }
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
assert_equal([], log)
}
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
Expand Down Expand Up @@ -249,7 +249,7 @@ def test_short_filename
return if File.executable?(__FILE__) # skip on strange file system

log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
assert_equal([], log)
}
Expand Down Expand Up @@ -346,7 +346,7 @@ def req.meta_vars
},
}
log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
assert_equal([], log)
}
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
Expand Down Expand Up @@ -382,7 +382,7 @@ def req.meta_vars
def test_erbhandler
config = { :DocumentRoot => File.dirname(__FILE__) }
log_tester = lambda {|log, access_log|
log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
log = log.reject {|s| /ERROR '.*' not found\./ =~ s }
assert_equal([], log)
}
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
Expand Down
8 changes: 4 additions & 4 deletions test/webrick/test_httpserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ def test_callbacks
:RequestCallback => Proc.new{|req, res| requested0 += 1 },
}
log_tester = lambda {|log, access_log|
assert(log.find {|s| %r{ERROR `/' not found\.} =~ s })
assert_equal([], log.reject {|s| %r{ERROR `/' not found\.} =~ s })
assert(log.find {|s| %r{ERROR '/' not found\.} =~ s })
assert_equal([], log.reject {|s| %r{ERROR '/' not found\.} =~ s })
}
TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
vhost_config = {
Expand Down Expand Up @@ -411,7 +411,7 @@ def test_request_handler_callback_is_deprecated
log_tester = lambda {|log, access_log|
assert_equal(2, log.length)
assert_match(/WARN :RequestHandler is deprecated, please use :RequestCallback/, log[0])
assert_match(%r{ERROR `/' not found\.}, log[1])
assert_match(%r{ERROR '/' not found\.}, log[1])
}
TestWEBrick.start_httpserver(config, log_tester){|server, addr, port, log|
Thread.pass while server.status != :Running
Expand Down Expand Up @@ -465,7 +465,7 @@ def test_cntrl_in_path
http = Net::HTTP.new(addr[3], addr[1])
req = Net::HTTP::Get.new('/notexist%0a/foo')
http.request(req) { |res| assert_equal('404', res.code) }
exp = %Q(ERROR `/notexist\\n/foo' not found.\n)
exp = %Q(ERROR '/notexist\\n/foo' not found.\n)
assert_equal 1, log_ary.size
assert_include log_ary[0], exp
ensure
Expand Down