From 69e6a793d34ff71da7c8ca59962d627e2fb508d8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 Dec 2012 02:35:26 +0000 Subject: fix const error responses for Rainbows! Rainbows! relies on the ERROR_XXX_RESPONSE constants of unicorn 4.x. Changing the constants in unicorn 4.x will break existing versions of Rainbows!, so remove the dependency on the constants and generate the error response dynamically. Unlike Mongrel, unicorn is unlikely to see malicious traffic and thus unlikely to benefit from making error messages constant. For unicorn 5.x, we will drop these constants entirely. (Rainbows! most likely cannot support check_client_connection consistently across all concurrency models since some of them pessimistically buffer all writes in userspace. However, the extra concurrency of Rainbows! makes it less likely to be overloaded than unicorn, so this feature is likely less useful for Rainbows!) --- lib/unicorn/http_response.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/unicorn/http_response.rb') diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index 61563cd..579d957 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -17,6 +17,10 @@ module Unicorn::HttpResponse } CRLF = "\r\n" + def err_response(code, response_start_sent) + "#{response_start_sent ? '' : 'HTTP/1.1 '}#{CODES[code]}\r\n\r\n" + end + # writes the rack_response to socket as an HTTP response def http_response_write(socket, status, headers, body, response_start_sent=false) -- cgit v1.2.3-24-ge0c7