about summary refs log tree commit homepage
path: root/lib/yahns/http_response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/http_response.rb')
-rw-r--r--lib/yahns/http_response.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index fabd4b7..b70491d 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -59,7 +59,7 @@ module Yahns::HttpResponse # :nodoc:
   end
 
   def err_response(code)
-    "#{response_start}#{CODES[code]}\r\n\r\n"
+    "#{response_start}#{code} #{Rack::Utils::HTTP_STATUS_CODES[code]}\r\n\r\n"
   end
 
   def response_header_blocked(ret, header, body, alive, offset, count)
@@ -130,7 +130,6 @@ module Yahns::HttpResponse # :nodoc:
   # writes the rack_response to socket as an HTTP response
   # returns :wait_readable, :wait_writable, :forget, or nil
   def http_response_write(status, headers, body)
-    status = CODES[status.to_i] || status
     offset = 0
     count = hijack = nil
     k = self.class
@@ -138,7 +137,10 @@ module Yahns::HttpResponse # :nodoc:
     flags = MSG_DONTWAIT
 
     if @hs.headers?
-      buf = "#{response_start}#{status}\r\nDate: #{httpdate}\r\n"
+      code = status.to_i
+      msg = Rack::Utils::HTTP_STATUS_CODES[code]
+      buf = "#{response_start}#{msg ? %Q(#{code} #{msg}) : status}\r\n" \
+            "Date: #{httpdate}\r\n"
       headers.each do |key, value|
         case key
         when %r{\ADate\z}i