Permalink
Browse files

Small fixes

git-svn-id: http://svn.macosforge.org/repository/ruby/ControlTower/trunk@4124 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 223c058 commit 7456fa7ee8a22d7cc2c633bd38ed4d0d9662db48 @jballanc jballanc committed May 19, 2010
Showing with 5 additions and 7 deletions.
  1. +1 −1 Rakefile
  2. +1 −1 bin/control_tower
  3. +0 −2 lib/control_tower.rb
  4. +3 −3 lib/control_tower/rack_socket.rb
View
@@ -24,7 +24,7 @@ GEM_SPEC = Gem::Specification.new do |spec|
lib/control_tower/vendor
lib/control_tower/vendor/rack
lib/control_tower/vendor/rack.rb
- ) + Dir.glob('lib/control_tower/vendor/rack/*')
+ ) + Dir.glob('lib/control_tower/vendor/rack/**/*')
spec.executable = 'control_tower'
end
View
@@ -44,7 +44,7 @@ end
ENV['RACK_ENV'] = 'development'
rackup_config = File.read(File.expand_path(@options[:rackup]))
-app = eval("Rack::Builder.new {( #{rackup_config}\n )}.to_app", TOPLEVEL_BINDING)
+app = eval("Rack::Builder.new { #{rackup_config} }.to_app")
# Let's get to business!
server = ControlTower::Server.new(app, @options)
View
@@ -7,5 +7,3 @@
require 'rack'
require File.join(File.dirname(__FILE__), 'control_tower', 'rack_socket')
require File.join(File.dirname(__FILE__), 'control_tower', 'server')
-
-
@@ -33,6 +33,7 @@ def open
# TODO -- Concurrency doesn't quite work yet...
#@request_group.dispatch(@request_queue) do
req_data = parse!(connection, prepare_environment)
+ req_data['REMOTE_ADDR'] = connection.addr[3]
data = @server.handle_request(req_data)
data.each do |chunk|
connection.write chunk
@@ -59,7 +60,7 @@ def close
def prepare_environment
{ 'rack.errors' => $stderr,
- 'rack.input' => '',
+ 'rack.input' => ''.force_encoding('ASCII-8BIT'),
'rack.multiprocess' => false, # No multiprocess, yet...probably never
'rack.run_once' => false,
RACK_VERSION => VERSION }
@@ -75,8 +76,7 @@ def parse!(connection, env)
select([connection], nil, nil, 1)
if headers_done
begin
- data = connection.readpartial(READ_SIZE)
- env['rack.input'] << data
+ env['rack.input'] << connection.readpartial(READ_SIZE)
rescue EOFError
break
end

0 comments on commit 7456fa7

Please sign in to comment.