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
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
IANA_HTTP_METHODS

list from www.iana.org/assignments/http-methods/http-methods.xhtml as of 04-May-23

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_IPV4
LOCALHOST_IPV6
MAX_BODY

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

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
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
SUPPORTED_HTTP_METHODS

based on www.rfc-editor.org/rfc/rfc9110.html#name-overview, with CONNECT removed, and PATCH added

TRANSFER_ENCODING
TRANSFER_ENCODING2
TRANSFER_ENCODING_CHUNKED
UNSPECIFIED_IPV4
UNSPECIFIED_IPV6
WRITE_TIMEOUT

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