diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb index f22480b8..c86d36c9 100644 --- a/lib/webrick/cgi.rb +++ b/lib/webrick/cgi.rb @@ -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 diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb index 196682ec..189faa9b 100644 --- a/lib/webrick/httpproxy.rb +++ b/lib/webrick/httpproxy.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 2b50037e..7f9c002f 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -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"] @@ -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 @@ -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 @@ -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) diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index dde0261d..4ad9cc2c 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -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 << "
" ex.backtrace.each{|line| @body << "\t#{line}\n"} diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb index 0d261bf0..6d9dc26a 100644 --- a/lib/webrick/httpserver.rb +++ b/lib/webrick/httpserver.rb @@ -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) diff --git a/lib/webrick/httpservlet/abstract.rb b/lib/webrick/httpservlet/abstract.rb index 6fae4de9..280a4d3d 100644 --- a/lib/webrick/httpservlet/abstract.rb +++ b/lib/webrick/httpservlet/abstract.rb @@ -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 diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index 7ab88bca..4e759d8c 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -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 @@ -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) @@ -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 @@ -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 @@ -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| diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb index 92f3044d..e2c2a407 100644 --- a/lib/webrick/httputils.rb +++ b/lib/webrick/httputils.rb @@ -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 diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb index f085d5d2..3fe268dc 100644 --- a/lib/webrick/server.rb +++ b/lib/webrick/server.rb @@ -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 diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index 3b299d93..db7618d2 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -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) } @@ -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| @@ -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) } @@ -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| @@ -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| diff --git a/test/webrick/test_httpserver.rb b/test/webrick/test_httpserver.rb index 0c5a6147..71c9f31b 100644 --- a/test/webrick/test_httpserver.rb +++ b/test/webrick/test_httpserver.rb @@ -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 = { @@ -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 @@ -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