Module: Puma::Const

Relationships & Source Files
Namespace Children
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/puma/const.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.

The constants are frozen because Hash#[]= when called with a String key dups the String UNLESS the String is frozen. This saves us therefore 2 object allocations when creating the env hash later.

While Puma 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