Skip to content

Commit 8cba783

Browse files
committed
Remove Rack::Utils.bytesize usage from error_app.rb also
1 parent 421a99d commit 8cba783

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/ruby/jruby/rack/error_app.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,14 @@ def serve(code, path, env)
7070
headers = { 'Last-Modified' => last_modified }
7171
DEFAULT_HEADERS.each { |field, content| headers[field] = content }
7272
ext = File.extname(path)
73+
size = File.size?(path)
7374
mime = ::Rack::Mime.mime_type(ext, DEFAULT_MIME) if defined?(::Rack::Mime)
7475
mime = 'text/html' if ! mime && ( ext == '.html' || ext == '.htm' )
7576
headers['Content-Type'] = mime if mime
7677

77-
body = env['REQUEST_METHOD'] == 'HEAD' ? [] : FileBody.new(path, size = File.size?(path))
78+
body = env['REQUEST_METHOD'] == 'HEAD' ? [] : FileBody.new(path, size)
7879
response = [ code, headers, body ]
7980

80-
size ||= ::Rack::Utils.bytesize(File.read(path)) if defined?(::Rack::Utils.bytesize)
81-
8281
response[1]['Content-Length'] = size.to_s if size
8382
response
8483
end
@@ -169,4 +168,4 @@ def http_accept?(env, mime)
169168

170169
end
171170
end
172-
end
171+
end

0 commit comments

Comments
 (0)