[macruby-changes] [4279] ControlTower/trunk/lib/control_tower/server.rb
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 25 14:23:28 PDT 2010
Revision: 4279
http://trac.macosforge.org/projects/ruby/changeset/4279
Author: lsansonetti at apple.com
Date: 2010-06-25 14:23:27 -0700 (Fri, 25 Jun 2010)
Log Message:
-----------
misc optim
Modified Paths:
--------------
ControlTower/trunk/lib/control_tower/server.rb
Modified: ControlTower/trunk/lib/control_tower/server.rb
===================================================================
--- ControlTower/trunk/lib/control_tower/server.rb 2010-06-25 21:03:30 UTC (rev 4278)
+++ ControlTower/trunk/lib/control_tower/server.rb 2010-06-25 21:23:27 UTC (rev 4279)
@@ -35,7 +35,7 @@
def wrap_output(status, headers, body)
# Unless somebody's already set it for us (or we don't need it), set the Content-Length
unless (status == -1 ||
- (100..199).include?(status) ||
+ (status >= 100 and status <= 199) ||
status == 204 ||
status == 304 ||
headers.has_key?("Content-Length"))
@@ -51,12 +51,14 @@
# TODO -- We don't handle keep-alive connections yet
headers["Connection"] = 'close'
- headers_out = headers.map do |header, value|
- "#{header}: #{value}\r\n"
- end.join
+ resp = "HTTP/1.1 #{status}\r\n"
+ headers.each do |header, value|
+ resp << "#{header}: #{value}\r\n"
+ end
+ resp << "\r\n"
# Assemble our response...
- chunks = ["HTTP/1.1 #{status}\r\n#{headers_out}\r\n"]
+ chunks = [resp]
if body.respond_to?(:each)
body.each do |chunk|
chunks << chunk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100625/486d66b2/attachment.html>
More information about the macruby-changes
mailing list