Transfer-Encoding: chunked streaming input support
[unicorn.git] / lib / unicorn / const.rb
blobb81dce059305d4b18dd0d9f7efb800ef36bde568
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.8.1".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
28     # A frozen format for this is about 15% faster
29     HTTP_TRANSFER_ENCODING = 'HTTP_TRANSFER_ENCODING'.freeze
30     CONTENT_LENGTH="CONTENT_LENGTH".freeze
31     REMOTE_ADDR="REMOTE_ADDR".freeze
32     HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze
33     RACK_INPUT="rack.input".freeze
34     STREAM_INPUT="unicorn.stream_input".freeze
35   end
37 end