From 516c4a8686911a3b6c5e1837d183cd6f515e877c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 29 Jun 2009 19:21:34 -0700 Subject: ACK clients on "Expect: 100-continue" header By responding with a "HTTP/1.1 100 Continue" response to encourage a client to send the rest of the body. This is part of the HTTP/1.1 standard but not often implemented by servers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3 This will speed up curl uploads since curl sleeps up to 1 second if no response is received: http://curl.haxx.se/docs/faq.html#My_HTTP_POST_or_PUT_requests_are --- lib/unicorn/const.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/unicorn/const.rb') diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index b81dce0..9dcf031 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -24,12 +24,14 @@ module Unicorn # common errors we'll send back ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n".freeze ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n".freeze + EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n" # A frozen format for this is about 15% faster HTTP_TRANSFER_ENCODING = 'HTTP_TRANSFER_ENCODING'.freeze CONTENT_LENGTH="CONTENT_LENGTH".freeze REMOTE_ADDR="REMOTE_ADDR".freeze HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze + HTTP_EXPECT="HTTP_EXPECT".freeze RACK_INPUT="rack.input".freeze STREAM_INPUT="unicorn.stream_input".freeze end -- cgit v1.2.3-24-ge0c7