Module: Puma::Const
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/puma/const.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.
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
-
BANNED_HEADER_KEY =
Banned keys of response header
/\A(rack\.|status\z)/.freeze
-
CGI_VER =
# File 'lib/puma/const.rb', line 175"CGI/1.2"
-
CHUNKED =
# File 'lib/puma/const.rb', line 216"chunked"
-
CHUNK_SIZE =
The basic max request size we’ll try to read.
16 * 1024
-
CLOSE =
# File 'lib/puma/const.rb', line 202"close"
-
CLOSE_CHUNKED =
# File 'lib/puma/const.rb', line 214"0\r\n\r\n"
-
CODE_NAME =
# File 'lib/puma/const.rb', line 103"Sunflower"
-
COLON =
# File 'lib/puma/const.rb', line 218": "
-
CONNECTION_CLOSE =
# File 'lib/puma/const.rb', line 210"Connection: close\r\n"
-
CONNECTION_KEEP_ALIVE =
# File 'lib/puma/const.rb', line 211"Connection: Keep-Alive\r\n"
-
CONTENT_LENGTH =
# File 'lib/puma/const.rb', line 117"CONTENT_LENGTH"
-
CONTENT_LENGTH2 =
# File 'lib/puma/const.rb', line 205"content-length"
-
CONTENT_LENGTH_S =
# File 'lib/puma/const.rb', line 206"Content-Length: "
-
CONTINUE =
# File 'lib/puma/const.rb', line 196"100-continue"
-
DQUOTE =
Illegal character in the key or value of response header
"\""
-
EARLY_HINTS =
# File 'lib/puma/const.rb', line 226"rack.early_hints"
-
ERROR_RESPONSE =
# File 'lib/puma/const.rb', line 123{ # Indicate that we couldn't parse the request 400 => "HTTP/1.1 400 Bad Request\r\n\r\n", # The standard empty 404 response for bad requests. Use Error4040Handler for custom stuff. 404 => "HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Puma #{PUMA_VERSION}\r\n\r\nNOT FOUND", # The standard empty 408 response for requests that timed out. 408 => "HTTP/1.1 408 Request Timeout\r\nConnection: close\r\nServer: Puma #{PUMA_VERSION}\r\n\r\n", # Indicate that there was an internal error, obviously. 500 => "HTTP/1.1 500 Internal Server Error\r\n\r\n", # Incorrect or invalid header value 501 => "HTTP/1.1 501 Not Implemented\r\n\r\n", # A common header for indicating the server is too busy. Not used yet. 503 => "HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY" }.freeze
-
FAST_TRACK_KA_TIMEOUT =
# File 'lib/puma/const.rb', line 1070.2
-
GATEWAY_INTERFACE =
# File 'lib/puma/const.rb', line 174"GATEWAY_INTERFACE"
-
HALT_COMMAND =
# File 'lib/puma/const.rb', line 178"!"
-
HEAD =
# File 'lib/puma/const.rb', line 149"HEAD"
-
HIJACK =
# File 'lib/puma/const.rb', line 223"rack.hijack"
-
HIJACK_IO =
# File 'lib/puma/const.rb', line 224"rack.hijack_io"
-
HIJACK_P =
# File 'lib/puma/const.rb', line 222"rack.hijack?"
-
HTTP =
# File 'lib/puma/const.rb', line 188"http"
-
HTTPS =
# File 'lib/puma/const.rb', line 189"https"
-
HTTPS_KEY =
# File 'lib/puma/const.rb', line 191"HTTPS"
-
HTTP_10_200 =
# File 'lib/puma/const.rb', line 200"HTTP/1.0 200 OK\r\n"
-
HTTP_11 =
# File 'lib/puma/const.rb', line 171"HTTP/1.1"
-
HTTP_11_100 =
# File 'lib/puma/const.rb', line 198"HTTP/1.1 100 Continue\r\n\r\n"
-
HTTP_11_200 =
# File 'lib/puma/const.rb', line 199"HTTP/1.1 200 OK\r\n"
-
HTTP_CONNECTION =
# File 'lib/puma/const.rb', line 194"HTTP_CONNECTION"
-
HTTP_EXPECT =
# File 'lib/puma/const.rb', line 195"HTTP_EXPECT"
-
HTTP_HEADER_DELIMITER =
# File 'lib/puma/const.rb', line 230Regexp.escape("(),/:;<=>?@[]{}\\").freeze
-
HTTP_HOST =
# File 'lib/puma/const.rb', line 161"HTTP_HOST"
-
HTTP_VERSION =
# File 'lib/puma/const.rb', line 193"HTTP_VERSION"
-
HTTP_X_FORWARDED_FOR =
# File 'lib/puma/const.rb', line 154"HTTP_X_FORWARDED_FOR"
-
HTTP_X_FORWARDED_PROTO =
# File 'lib/puma/const.rb', line 157"HTTP_X_FORWARDED_PROTO"
-
HTTP_X_FORWARDED_SCHEME =
# File 'lib/puma/const.rb', line 156"HTTP_X_FORWARDED_SCHEME"
-
HTTP_X_FORWARDED_SSL =
# File 'lib/puma/const.rb', line 155"HTTP_X_FORWARDED_SSL"
-
ILLEGAL_HEADER_KEY_REGEX =
# File 'lib/puma/const.rb', line 231/[\x00-\x20#{DQUOTE}#{HTTP_HEADER_DELIMITER}]/.freeze
-
ILLEGAL_HEADER_VALUE_REGEX =
header values can contain HTAB?
/[\x00-\x08\x0A-\x1F]/.freeze
-
KEEP_ALIVE =
# File 'lib/puma/const.rb', line 203"keep-alive"
-
LINE_END =
ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
"\r\n"
-
LOCALHOST =
# File 'lib/puma/const.rb', line 164"localhost"
-
LOCALHOST_IPV4 =
# File 'lib/puma/const.rb', line 165"127.0.0.1"
-
LOCALHOST_IPV6 =
# File 'lib/puma/const.rb', line 166"::1"
-
MAX_BODY =
Maximum request body size before it is moved out of memory and into a tempfile for reading.
MAX_HEADER
-
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.
1024 * (80 + 32)
-
NEWLINE =
# File 'lib/puma/const.rb', line 220"\n"
-
PATH_INFO =
# File 'lib/puma/const.rb', line 119"PATH_INFO"
-
PORT_443 =
# File 'lib/puma/const.rb', line 163"443"
-
PORT_80 =
# File 'lib/puma/const.rb', line 162"80"
-
PROXY_PROTOCOL_V1_REGEX =
# File 'lib/puma/const.rb', line 238/^PROXY (?:TCP4|TCP6|UNKNOWN) ([^\r]+)\r\n/.freeze
-
PUMA_CONFIG =
# File 'lib/puma/const.rb', line 185"puma.config"
-
PUMA_PEERCERT =
# File 'lib/puma/const.rb', line 186"puma.peercert"
-
PUMA_SERVER_STRING =
# File 'lib/puma/const.rb', line 105["puma", PUMA_VERSION, CODE_NAME].join(" ").freeze
-
PUMA_SOCKET =
# File 'lib/puma/const.rb', line 184"puma.socket"
-
PUMA_TMP_BASE =
# File 'lib/puma/const.rb', line 121"puma"
-
PUMA_VERSION =
# File 'lib/puma/const.rb', line 102VERSION = "6.0.2"
-
QUERY_STRING =
# File 'lib/puma/const.rb', line 116"QUERY_STRING"
-
RACK_AFTER_REPLY =
# File 'lib/puma/const.rb', line 183"rack.after_reply"
-
RACK_INPUT =
# File 'lib/puma/const.rb', line 181"rack.input"
-
RACK_URL_SCHEME =
# File 'lib/puma/const.rb', line 182"rack.url_scheme"
-
REMOTE_ADDR =
# File 'lib/puma/const.rb', line 153"REMOTE_ADDR"
-
REQUEST_METHOD =
# File 'lib/puma/const.rb', line 148"REQUEST_METHOD"
-
REQUEST_PATH =
# File 'lib/puma/const.rb', line 115"REQUEST_PATH"
-
REQUEST_URI =
The original URI requested by the client.
"REQUEST_URI"
-
RESTART_COMMAND =
# File 'lib/puma/const.rb', line 179"R"
-
SERVER_NAME =
# File 'lib/puma/const.rb', line 159"SERVER_NAME"
-
SERVER_PORT =
# File 'lib/puma/const.rb', line 160"SERVER_PORT"
-
SERVER_PROTOCOL =
# File 'lib/puma/const.rb', line 170"SERVER_PROTOCOL"
-
SERVER_SOFTWARE =
# File 'lib/puma/const.rb', line 173"SERVER_SOFTWARE"
-
STOP_COMMAND =
# File 'lib/puma/const.rb', line 177"?"
-
SUPPORTED_HTTP_METHODS =
# File 'lib/puma/const.rb', line 150%w[HEAD GET POST PUT DELETE OPTIONS TRACE PATCH].freeze
-
TRANSFER_ENCODING =
# File 'lib/puma/const.rb', line 207"transfer-encoding"
-
TRANSFER_ENCODING2 =
# File 'lib/puma/const.rb', line 208"HTTP_TRANSFER_ENCODING"
-
TRANSFER_ENCODING_CHUNKED =
# File 'lib/puma/const.rb', line 213"Transfer-Encoding: chunked\r\n"
-
UNSPECIFIED_IPV4 =
# File 'lib/puma/const.rb', line 167"0.0.0.0"
-
UNSPECIFIED_IPV6 =
# File 'lib/puma/const.rb', line 168"::"
-
WRITE_TIMEOUT =
How long to wait when getting some write blocking on the socket when sending data back
10