Module Mongrel::Const
In: lib/mongrel.rb

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.

While Mongrel does try to emulate the CGI/1.2 protocol, it does not use the REMOTE_IDENT, REMOTE_USER, or REMOTE_HOST parameters since those are either a security problem or too taxing on performance.

Constants

DATE = "Date".freeze
PATH_INFO = "PATH_INFO".freeze   This is the part of the path after the SCRIPT_NAME. URIClassifier will determine this.
SCRIPT_NAME = "SCRIPT_NAME".freeze   This is the initial part that your handler is identified as by URIClassifier.
REQUEST_URI = 'REQUEST_URI'.freeze   The original URI requested by the client. Passed to URIClassifier to build PATH_INFO and SCRIPT_NAME.
REQUEST_PATH = 'REQUEST_PATH'.freeze
MONGREL_VERSION = "0.3.13.4".freeze
MONGREL_TMP_BASE = "mongrel".freeze   TODO: this use of a base for tempfiles needs to be looked at for security problems
ERROR_404_RESPONSE = "HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Mongrel #{MONGREL_VERSION}\r\n\r\nNOT FOUND".freeze   The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.
CONTENT_LENGTH = "CONTENT_LENGTH".freeze
ERROR_503_RESPONSE = "HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze   A common header for indicating the server is too busy. Not used yet.
CHUNK_SIZE = (16 * 1024)   The basic max request size we’ll try to read.
MAX_HEADER = 1024 * (80 + 32)   This is the maximum header that is allowed before a client is booted. The parser detects this, but we’d also like to do this as well.
MAX_BODY = MAX_HEADER   Maximum request body size before it is moved out of memory and into a tempfile for reading.
STATUS_FORMAT = "HTTP/1.1 %d %s\r\nConnection: close\r\n".freeze   A frozen format for this is about 15% faster
CONTENT_TYPE = "Content-Type".freeze
LAST_MODIFIED = "Last-Modified".freeze
ETAG = "ETag".freeze
SLASH = "/".freeze
REQUEST_METHOD = "REQUEST_METHOD".freeze
GET = "GET".freeze
HEAD = "HEAD".freeze
ETAG_FORMAT = "\"%x-%x-%x\"".freeze   ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
HEADER_FORMAT = "%s: %s\r\n".freeze
LINE_END = "\r\n".freeze
REMOTE_ADDR = "REMOTE_ADDR".freeze
HTTP_X_FORWARDED_FOR = "HTTP_X_FORWARDED_FOR".freeze
HTTP_IF_MODIFIED_SINCE = "HTTP_IF_MODIFIED_SINCE".freeze
HTTP_IF_NONE_MATCH = "HTTP_IF_NONE_MATCH".freeze
REDIRECT = "HTTP/1.1 302 Found\r\nLocation: %s\r\nConnection: close\r\n\r\n".freeze

[Validate]