unicorn 0.90.0
[unicorn.git] / lib / unicorn / const.rb
blobf2e465627a3c639fcab9a97717792ace323d301e
1 module Unicorn
3   # Frequently used constants when constructing requests or responses.  Many times
4   # the constant just refers to a string with the same contents.  Using these constants
5   # gave about a 3% to 10% performance improvement over using the strings directly.
6   # Symbols did not really improve things much compared to constants.
7   module Const
8     UNICORN_VERSION="0.90.0".freeze
10     DEFAULT_HOST = "0.0.0.0".freeze # default TCP listen host address
11     DEFAULT_PORT = "8080".freeze    # default TCP listen port
12     DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}".freeze
14     # The basic max request size we'll try to read.
15     CHUNK_SIZE=(16 * 1024)
17     # This is the maximum header that is allowed before a client is booted.  The parser detects
18     # this, but we'd also like to do this as well.
19     MAX_HEADER=1024 * (80 + 32)
21     # Maximum request body size before it is moved out of memory and into a tempfile for reading.
22     MAX_BODY=MAX_HEADER
24     # common errors we'll send back
25     ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n".freeze
26     ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n".freeze
27     EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n"
29     # A frozen format for this is about 15% faster
30     REMOTE_ADDR="REMOTE_ADDR".freeze
31     HTTP_EXPECT="HTTP_EXPECT".freeze
32     RACK_INPUT="rack.input".freeze
33   end
35 end