aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guff/handlers.cr12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/guff/handlers.cr b/src/guff/handlers.cr
index b0fc09a..51be36e 100644
--- a/src/guff/handlers.cr
+++ b/src/guff/handlers.cr
@@ -170,9 +170,7 @@ module Guff::Handlers
if context.request.method == "GET"
# send body for GET requests
File.open(abs_path) do |fh|
- STDERR.puts "sending #{abs_path}"
IO.copy(fh, context.response)
- STDERR.puts "done sending #{abs_path}"
end
end
end
@@ -548,6 +546,11 @@ module Guff::Handlers
# FIXME: this is very similar to AssetsHandler, so maybe combine them?
class FilesHandler < Handler
+ def initialize(context : Context)
+ super(context)
+ @magic = Magic.new
+ end
+
def call(context : HTTP::Server::Context)
req_path = context.request.path.not_nil!
@@ -625,10 +628,7 @@ module Guff::Handlers
end
private def get_mime_type(path : String) : String
- puts "DEBUG: getting mime type"
- r = Guff::Magic.get_mime_type(path)
- puts "DEBUG: mime type = #{r}"
- r
+ @magic.file(path)
end
end