4 # Every standard HTTP code mapped to the appropriate message. These are
5 # used so frequently that they are placed directly in Mongrel for easy
6 # access rather than Mongrel::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 Mongrel 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. URIClassifier will determine this.
59 PATH_INFO="PATH_INFO".freeze
61 # This is the initial part that your handler is identified as by URIClassifier.
62 SCRIPT_NAME="SCRIPT_NAME".freeze
64 # The original URI requested by the client. Passed to URIClassifier to build PATH_INFO and SCRIPT_NAME.
65 REQUEST_URI='REQUEST_URI'.freeze
66 REQUEST_PATH='REQUEST_PATH'.freeze
68 MONGREL_VERSION="1.1.5".freeze
70 MONGREL_TMP_BASE="mongrel".freeze
72 # The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
73 ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Mongrel #{MONGREL_VERSION}\r\n\r\nNOT FOUND".freeze
75 CONTENT_LENGTH="CONTENT_LENGTH".freeze
77 # A common header for indicating the server is too busy. Not used yet.
78 ERROR_503_RESPONSE="HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze
80 # The basic max request size we'll try to read.
81 CHUNK_SIZE=(16 * 1024)
83 # This is the maximum header that is allowed before a client is booted. The parser detects
84 # this, but we'd also like to do this as well.
85 MAX_HEADER=1024 * (80 + 32)
87 # Maximum request body size before it is moved out of memory and into a tempfile for reading.
90 # A frozen format for this is about 15% faster
91 STATUS_FORMAT = "HTTP/1.1 %d %s\r\nConnection: close\r\n".freeze
92 CONTENT_TYPE = "Content-Type".freeze
93 LAST_MODIFIED = "Last-Modified".freeze
96 REQUEST_METHOD="REQUEST_METHOD".freeze
99 # ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
100 ETAG_FORMAT="\"%x-%x-%x\"".freeze
101 HEADER_FORMAT="%s: %s\r\n".freeze
102 LINE_END="\r\n".freeze
103 REMOTE_ADDR="REMOTE_ADDR".freeze
104 HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze
105 HTTP_IF_MODIFIED_SINCE="HTTP_IF_MODIFIED_SINCE".freeze
106 HTTP_IF_NONE_MATCH="HTTP_IF_NONE_MATCH".freeze
107 REDIRECT = "HTTP/1.1 302 Found\r\nLocation: %s\r\nConnection: close\r\n\r\n".freeze