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.
8 UNICORN_VERSION="0.8.2".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.
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 CONTENT_LENGTH="CONTENT_LENGTH".freeze
30 REMOTE_ADDR="REMOTE_ADDR".freeze
31 HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze
32 RACK_INPUT="rack.input".freeze