summary refs log tree commit homepage
path: root/lib/unicorn/const.rb
blob: ec5444d0d26e104d286a3439377f896e2dfe51e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- encoding: binary -*-

# Frequently used constants when constructing requests or responses.
# Many times the constant just refers to a string with the same
# contents.  Using these constants gave about a 3% to 10% performance
# improvement over using the strings directly.  Symbols did not really
# improve things much compared to constants.
module Unicorn::Const

  # The current version of Unicorn, currently 2.0.0pre1
  UNICORN_VERSION = "2.0.0pre1"

  # default TCP listen host address (0.0.0.0, all interfaces)
  DEFAULT_HOST = "0.0.0.0"

  # default TCP listen port (8080)
  DEFAULT_PORT = 8080

  # default TCP listen address and port (0.0.0.0:8080)
  DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}"

  # The basic request body size we'll try to read at once (16 kilobytes).
  CHUNK_SIZE = 16 * 1024

  # Maximum request body size before it is moved out of memory and into a
  # temporary file for reading (112 kilobytes).
  MAX_BODY = 1024 * 112

  # :stopdoc:
  # common errors we'll send back
  ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n"
  ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n"
  EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n"

  HTTP_EXPECT = "HTTP_EXPECT"
  # :startdoc:
end