Module: Mongrel::Const

Defined in:
lib/mongrel.rb

Overview

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.

Constant Summary collapse

PATH_INFO =

This is the part of the path after the SCRIPT_NAME. URIClassifier will determine this.

"PATH_INFO"
SCRIPT_NAME =

This is the intial part that your handler is identified as by URIClassifier.

"SCRIPT_NAME"
REQUEST_URI =

The original URI requested by the client. Passed to URIClassifier to build PATH_INFO and SCRIPT_NAME.

'REQUEST_URI'
CONTENT_LENGTH =

Content length (also available as HTTP_CONTENT_LENGTH).

'CONTENT_LENGTH'
HTTP_CONTENT_LENGTH =

Content length (also available as CONTENT_LENGTH).

'HTTP_CONTENT_LENGTH'
CONTENT_TYPE =

Content type (also available as HTTP_CONTENT_TYPE).

'CONTENT_TYPE'
HTTP_CONTENT_TYPE =

Content type (also available as CONTENT_TYPE).

'HTTP_CONTENT_TYPE'
GATEWAY_INTERFACE =

Gateway interface key in the HttpRequest parameters.

'GATEWAY_INTERFACE'
GATEWAY_INTERFACE_VALUE =

We claim to support CGI/1.2.

'CGI/1.2'
REMOTE_ADDR =

Hosts remote IP address. Mongrel does not do DNS resolves since that slows processing down considerably.

'REMOTE_ADDR'
REMOTE_HOST =

This is not given since Mongrel does not do DNS resolves. It is only here for completeness for the CGI standard.

'REMOTE_HOST'
SERVER_NAME =

The name/host of our server as given by the HttpServer.new(host,port) call.

'SERVER_NAME'
SERVER_PORT =

The port of our server as given by the HttpServer.new(host,port) call.

'SERVER_PORT'
SERVER_PROTOCOL =

Official server protocol key in the HttpRequest parameters.

'SERVER_PROTOCOL'
SERVER_PROTOCOL_VALUE =

Mongrel claims to support HTTP/1.1.

'HTTP/1.1'
SERVER_SOFTWARE =

The actual server software being used (it’s Mongrel man).

'SERVER_SOFTWARE'
MONGREL_VERSION =

Current Mongrel version (used for SERVER_SOFTWARE and other response headers).

'Mongrel 0.2.2'
ERROR_404_RESPONSE =

The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff.

"HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: #{MONGREL_VERSION}\r\n\r\nNOT FOUND"
ERROR_503_RESPONSE =

A common header for indicating the server is too busy. Not used yet.

"HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY"
CHUNK_SIZE =

The basic max request size we’ll try to read.

(16 * 1024)