Sha256: 8a35f369e9b10724e677d7fc7ceedf8ef4518c6eaeab19c28bc8586b3386b0ce
Contents?: true
Size: 581 Bytes
Versions: 1
Compression:
Stored size: 581 Bytes
Contents
module ServerHere class Core def call env req = Rack::Request.new env path = File.join('.', req.path_info) if not File.exists? path return [404, {'Content-Type' => 'text/plain'}, ["#{path} does not exist"] ] end if File.directory? path return [200, {'Content-Type' => 'text/plain'}, [`ls -al #{path}`] ] end file = FileWrapper.new path header = { 'Content-Type' => file.content_type, 'Last-Modified' => file.last_mod } [200, header, file.to_body] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
server_here-0.1.1 | lib/server_here/core.rb |