Skip to content

Commit

Permalink
Fixing some bugs
Browse files Browse the repository at this point in the history
Signed-off-by: why the lucky stiff <[email protected]>
  • Loading branch information
judofyr authored and why the lucky stiff committed Feb 24, 2009
1 parent f07cbf8 commit acdb84c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/camping/reloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def load_apps
old_apps = @apps.dup
@apps = new_apps.inject({}) do |hash, app|
key = app.name.to_sym
hash[key] = old_apps[key] || App.new(self)
hash[key] = (old = old_apps[key]) || App.new(self)
hash[key].app = app
app.create if app.respond_to?(:create) && !old
hash
end
self
Expand Down
12 changes: 7 additions & 5 deletions lib/camping/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def app
end
Rack::URLMap.new(hash)
end
rapp = Rack::ContentLength.new(rapp)
rapp = Rack::Lint.new(rapp)
rapp = XSendfile.new(rapp)
rapp = Rack::ShowExceptions.new(rapp)
Expand All @@ -108,8 +109,8 @@ def start
handler, conf = case @conf.server
when "console"
puts "** Starting console"
this = self
eval("self", TOPLEVEL_BINDING).meta_def(:reload!) { this.reload!; nil }
reload!
this = self; eval("self", TOPLEVEL_BINDING).meta_def(:reload!) { this.reload!; nil }
ARGV.clear
IRB.start
exit
Expand Down Expand Up @@ -145,10 +146,11 @@ def initialize(app)

def call(env)
status, headers, body = @app.call(env)
headers = Utils::HeaderHash.new(headers)
if path = HEADERS.detect { |header| headers.include?(header) }
headers = Rack::Utils::HeaderHash.new(headers)
if header = HEADERS.detect { |header| headers.include?(header) }
path = headers[header]
body = File.read(path)
headers['Content-Length'] = body.length
headers['Content-Length'] = body.length.to_s
end
[status, headers, body]
end
Expand Down

0 comments on commit acdb84c

Please sign in to comment.