module Puma::Const

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.

Constants

BANNED_HEADER_KEY

Banned keys of response header

CGI_VER
CHUNKED
CHUNK_SIZE

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

CLOSE
CLOSE_CHUNKED
CODE_NAME
COLON
CONNECTION_CLOSE
CONNECTION_KEEP_ALIVE
CONTENT_LENGTH
CONTENT_LENGTH2
CONTENT_LENGTH_S
CONTINUE
DQUOTE

Illegal character in the key or value of response header

EARLY_HINTS
ERROR_RESPONSE
FAST_TRACK_KA_TIMEOUT
FIRST_DATA_TIMEOUT

The default number of seconds to wait until we get the first data for the request

GATEWAY_INTERFACE
HALT_COMMAND
HIJACK
HIJACK_IO
HIJACK_P
HTTP
HTTPS
HTTPS_KEY
HTTP_10_200
HTTP_11
HTTP_11_100
HTTP_11_200
HTTP_CONNECTION
HTTP_EXPECT
HTTP_HEADER_DELIMITER
HTTP_HOST
HTTP_VERSION
HTTP_X_FORWARDED_FOR
HTTP_X_FORWARDED_PROTO
HTTP_X_FORWARDED_SCHEME
HTTP_X_FORWARDED_SSL
ILLEGAL_HEADER_KEY_REGEX
ILLEGAL_HEADER_VALUE_REGEX

header values can contain HTAB?

KEEP_ALIVE
LINE_END

ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)

LOCALHOST
LOCALHOST_IP
MAX_BODY

Maximum request body size before it is moved out of memory and into a tempfile for reading.

MAX_FAST_INLINE

How many requests to attempt inline before sending a client back to the reactor to be subject to normal ordering. The idea here is that we amortize the cost of going back to the reactor for a well behaved but very “greedy” client across 10 requests. This prevents a not well behaved client from monopolizing the thread forever.

MAX_HEADER

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.

NEWLINE
PATH_INFO
PERSISTENT_TIMEOUT

The default number of seconds for another request within a persistent session.

PORT_443
PORT_80
PROXY_PROTOCOL_V1_REGEX
PUMA_CONFIG
PUMA_PEERCERT
PUMA_SERVER_STRING
PUMA_SOCKET
PUMA_TMP_BASE
PUMA_VERSION
QUERY_STRING
RACK_AFTER_REPLY
RACK_INPUT
RACK_URL_SCHEME
REMOTE_ADDR
REQUEST_METHOD
REQUEST_PATH
REQUEST_URI

The original URI requested by the client.

RESTART_COMMAND
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
STOP_COMMAND
TRANSFER_ENCODING
TRANSFER_ENCODING2
TRANSFER_ENCODING_CHUNKED
WORKER_CHECK_INTERVAL

Minimum interval to checks worker health

WRITE_TIMEOUT

How long to wait when getting some write blocking on the socket when sending data back