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