4 # Every standard HTTP code mapped to the appropriate message. These are
5 # used so frequently that they are placed directly in Unicorn for easy
6 # access rather than Unicorn::Const itself.
9 101 => 'Switching Protocols',
13 203 => 'Non-Authoritative Information',
15 205 => 'Reset Content',
16 206 => 'Partial Content',
17 300 => 'Multiple Choices',
18 301 => 'Moved Permanently',
19 302 => 'Moved Temporarily',
21 304 => 'Not Modified',
24 401 => 'Unauthorized',
25 402 => 'Payment Required',
28 405 => 'Method Not Allowed',
29 406 => 'Not Acceptable',
30 407 => 'Proxy Authentication Required',
31 408 => 'Request Time-out',
34 411 => 'Length Required',
35 412 => 'Precondition Failed',
36 413 => 'Request Entity Too Large',
37 414 => 'Request-URI Too Large',
38 415 => 'Unsupported Media Type',
39 500 => 'Internal Server Error',
40 501 => 'Not Implemented',
42 503 => 'Service Unavailable',
43 504 => 'Gateway Time-out',
44 505 => 'HTTP Version not supported'
47 # Frequently used constants when constructing requests or responses. Many times
48 # the constant just refers to a string with the same contents. Using these constants
49 # gave about a 3% to 10% performance improvement over using the strings directly.
50 # Symbols did not really improve things much compared to constants.
52 # While Unicorn does try to emulate the CGI/1.2 protocol, it does not use the REMOTE_IDENT,
53 # REMOTE_USER, or REMOTE_HOST parameters since those are either a security problem or
54 # too taxing on performance.
58 # This is the part of the path after the SCRIPT_NAME.
59 PATH_INFO="PATH_INFO".freeze
62 HTTP_BODY="HTTP_BODY".freeze
64 # This is the initial part that your handler is identified as by URIClassifier.
65 SCRIPT_NAME="SCRIPT_NAME".freeze
67 # The original URI requested by the client. Passed to URIClassifier to build PATH_INFO and SCRIPT_NAME.
68 REQUEST_URI='REQUEST_URI'.freeze
69 REQUEST_PATH='REQUEST_PATH'.freeze
71 UNICORN_VERSION="0.1.0".freeze
73 UNICORN_TMP_BASE="unicorn".freeze
75 DEFAULT_HOST = "0.0.0.0".freeze # default TCP listen host address
76 DEFAULT_PORT = "8080".freeze # default TCP listen port
77 DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}".freeze
79 # The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
80 ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Unicorn #{UNICORN_VERSION}\r\n\r\nNOT FOUND".freeze
82 CONTENT_LENGTH="CONTENT_LENGTH".freeze
84 # A common header for indicating the server is too busy. Not used yet.
85 ERROR_503_RESPONSE="HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze
87 # The basic max request size we'll try to read.
88 CHUNK_SIZE=(16 * 1024)
90 # This is the maximum header that is allowed before a client is booted. The parser detects
91 # this, but we'd also like to do this as well.
92 MAX_HEADER=1024 * (80 + 32)
94 # Maximum request body size before it is moved out of memory and into a tempfile for reading.
97 # A frozen format for this is about 15% faster
98 CONTENT_TYPE = "Content-Type".freeze
99 LAST_MODIFIED = "Last-Modified".freeze
101 REQUEST_METHOD="REQUEST_METHOD".freeze
104 # ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
105 ETAG_FORMAT="\"%x-%x-%x\"".freeze
106 LINE_END="\r\n".freeze
107 REMOTE_ADDR="REMOTE_ADDR".freeze
108 HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze
109 HTTP_IF_MODIFIED_SINCE="HTTP_IF_MODIFIED_SINCE".freeze
110 HTTP_IF_NONE_MATCH="HTTP_IF_NONE_MATCH".freeze
111 REDIRECT = "HTTP/1.1 302 Found\r\nLocation: %s\r\nConnection: close\r\n\r\n".freeze
113 CONNECTION = "Connection".freeze