lib/bolt/serve.rb in benofsky-bolt-0.4.4 vs lib/bolt/serve.rb in benofsky-bolt-0.4.5
- old
+ new
@@ -53,14 +53,16 @@
@pages = DRbHash.new
DRb.start_service(nil, self)
$drb_uri = DRb.uri
+ $serve = true
+
@server = HTTPServer.new(:host => $config.serve_host, :port => $config.serve_port)
@errors_base = File.expand_path(File.dirname(File.dirname(__FILE__))) + '/bolt/serve_errors/'
- trap("INT") { exit! }
+ trap("INT") { exit! }
end
def run
# This has to be loaded after the DRb server is started above
load 'bolt/serve_page.rb'
@@ -86,9 +88,10 @@
@server.reply(body)
elsif(File.exists?(d($config.resources) + request['GET']))
f = File.new(d($config.resources) + request['GET'])
@server.reply(f.to_s, 200, 'Content-Type' => f.content_type)
else
+ # want to raise an exception here
@server.reply(File.new(@errors_base + '404.html').to_s, 404)
end
end
rescue Exception => e
puts "Error: #{e}"
\ No newline at end of file