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 187"CGI/1.2".freeze
-
CHUNKED =
# File 'lib/puma/const.rb', line 228"chunked".freeze
-
CHUNK_SIZE =
The basic max request size we’ll try to read.
16 * 1024
-
CLOSE =
# File 'lib/puma/const.rb', line 214"close".freeze
-
CLOSE_CHUNKED =
# File 'lib/puma/const.rb', line 226"0\r\n\r\n".freeze
-
CODE_NAME =
# File 'lib/puma/const.rb', line 104"Birdie's Version".freeze
-
COLON =
# File 'lib/puma/const.rb', line 230": ".freeze
-
CONNECTION_CLOSE =
# File 'lib/puma/const.rb', line 222"Connection: close\r\n".freeze
-
CONNECTION_KEEP_ALIVE =
# File 'lib/puma/const.rb', line 223"Connection: Keep-Alive\r\n".freeze
-
CONTENT_LENGTH =
# File 'lib/puma/const.rb', line 133"CONTENT_LENGTH".freeze
-
CONTENT_LENGTH2 =
# File 'lib/puma/const.rb', line 217"content-length".freeze
-
CONTENT_LENGTH_S =
# File 'lib/puma/const.rb', line 218"Content-Length: ".freeze
-
CONTINUE =
# File 'lib/puma/const.rb', line 208"100-continue".freeze
-
DQUOTE =
Illegal character in the key or value of response header
"\"".freeze
-
EARLY_HINTS =
# File 'lib/puma/const.rb', line 238"rack.early_hints".freeze
-
ERROR_RESPONSE =
# File 'lib/puma/const.rb', line 139{ # Indicate that we couldn't parse the request 400 => "HTTP/1.1 400 Bad Request\r\n\r\n".freeze, # 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".freeze, # 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".freeze, # Indicate that there was an internal error, obviously. 500 => "HTTP/1.1 500 Internal Server Error\r\n\r\n".freeze, # Incorrect or invalid header value 501 => "HTTP/1.1 501 Not Implemented\r\n\r\n".freeze, # 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 }.freeze
-
FAST_TRACK_KA_TIMEOUT =
# File 'lib/puma/const.rb', line 1080.2
-
FIRST_DATA_TIMEOUT =
The default number of seconds to wait until we get the first data for the request
30
-
GATEWAY_INTERFACE =
# File 'lib/puma/const.rb', line 186"GATEWAY_INTERFACE".freeze
-
HALT_COMMAND =
# File 'lib/puma/const.rb', line 190"!".freeze
-
HEAD =
# File 'lib/puma/const.rb', line 165"HEAD".freeze
-
HIJACK =
# File 'lib/puma/const.rb', line 235"rack.hijack".freeze
-
HIJACK_IO =
# File 'lib/puma/const.rb', line 236"rack.hijack_io".freeze
-
HIJACK_P =
# File 'lib/puma/const.rb', line 234"rack.hijack?".freeze
-
HTTP =
# File 'lib/puma/const.rb', line 200"http".freeze
-
HTTPS =
# File 'lib/puma/const.rb', line 201"https".freeze
-
HTTPS_KEY =
# File 'lib/puma/const.rb', line 203"HTTPS".freeze
-
HTTP_10_200 =
# File 'lib/puma/const.rb', line 212"HTTP/1.0 200 OK\r\n".freeze
-
HTTP_11 =
# File 'lib/puma/const.rb', line 183"HTTP/1.1".freeze
-
HTTP_11_100 =
# File 'lib/puma/const.rb', line 210"HTTP/1.1 100 Continue\r\n\r\n".freeze
-
HTTP_11_200 =
# File 'lib/puma/const.rb', line 211"HTTP/1.1 200 OK\r\n".freeze
-
HTTP_CONNECTION =
# File 'lib/puma/const.rb', line 206"HTTP_CONNECTION".freeze
-
HTTP_EXPECT =
# File 'lib/puma/const.rb', line 207"HTTP_EXPECT".freeze
-
HTTP_HEADER_DELIMITER =
# File 'lib/puma/const.rb', line 242Regexp.escape("(),/:;<=>?@[]{}\\").freeze
-
HTTP_HOST =
# File 'lib/puma/const.rb', line 176"HTTP_HOST".freeze
-
HTTP_VERSION =
# File 'lib/puma/const.rb', line 205"HTTP_VERSION".freeze
-
HTTP_X_FORWARDED_FOR =
# File 'lib/puma/const.rb', line 169"HTTP_X_FORWARDED_FOR".freeze
-
HTTP_X_FORWARDED_PROTO =
# File 'lib/puma/const.rb', line 172"HTTP_X_FORWARDED_PROTO".freeze
-
HTTP_X_FORWARDED_SCHEME =
# File 'lib/puma/const.rb', line 171"HTTP_X_FORWARDED_SCHEME".freeze
-
HTTP_X_FORWARDED_SSL =
# File 'lib/puma/const.rb', line 170"HTTP_X_FORWARDED_SSL".freeze
-
ILLEGAL_HEADER_KEY_REGEX =
# File 'lib/puma/const.rb', line 243/[\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 215"keep-alive".freeze
-
LINE_END =
ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
"\r\n".freeze
-
LOCALHOST =
# File 'lib/puma/const.rb', line 179"localhost".freeze
-
LOCALHOST_IP =
# File 'lib/puma/const.rb', line 180"127.0.0.1".freeze
-
MAX_BODY =
Maximum request body size before it is moved out of memory and into a tempfile for reading.
MAX_HEADER
-
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.
10
-
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 232"\n".freeze
-
PATH_INFO =
# File 'lib/puma/const.rb', line 135'PATH_INFO'.freeze
-
PERSISTENT_TIMEOUT =
The default number of seconds for another request within a persistent session.
20
-
PORT_443 =
# File 'lib/puma/const.rb', line 178"443".freeze
-
PORT_80 =
# File 'lib/puma/const.rb', line 177"80".freeze
-
PROXY_PROTOCOL_V1_REGEX =
# File 'lib/puma/const.rb', line 258/^PROXY (?:TCP4|TCP6|UNKNOWN) ([^\r]+)\r\n/.freeze
-
PUMA_CONFIG =
# File 'lib/puma/const.rb', line 197"puma.config".freeze
-
PUMA_PEERCERT =
# File 'lib/puma/const.rb', line 198"puma.peercert".freeze
-
PUMA_SERVER_STRING =
# File 'lib/puma/const.rb', line 106['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
-
PUMA_SOCKET =
# File 'lib/puma/const.rb', line 196"puma.socket".freeze
-
PUMA_TMP_BASE =
# File 'lib/puma/const.rb', line 137"puma".freeze
-
PUMA_VERSION =
# File 'lib/puma/const.rb', line 103VERSION = "5.6.9".freeze
-
QUERY_STRING =
# File 'lib/puma/const.rb', line 132'QUERY_STRING'.freeze
-
RACK_AFTER_REPLY =
# File 'lib/puma/const.rb', line 195"rack.after_reply".freeze
-
RACK_INPUT =
# File 'lib/puma/const.rb', line 193"rack.input".freeze
-
RACK_URL_SCHEME =
# File 'lib/puma/const.rb', line 194"rack.url_scheme".freeze
-
REMOTE_ADDR =
# File 'lib/puma/const.rb', line 168"REMOTE_ADDR".freeze
-
REQUEST_METHOD =
# File 'lib/puma/const.rb', line 164"REQUEST_METHOD".freeze
-
REQUEST_PATH =
# File 'lib/puma/const.rb', line 131'REQUEST_PATH'.freeze
-
REQUEST_URI =
The original URI requested by the client.
'REQUEST_URI'.freeze
-
RESTART_COMMAND =
# File 'lib/puma/const.rb', line 191"R".freeze
-
SERVER_NAME =
# File 'lib/puma/const.rb', line 174"SERVER_NAME".freeze
-
SERVER_PORT =
# File 'lib/puma/const.rb', line 175"SERVER_PORT".freeze
-
SERVER_PROTOCOL =
# File 'lib/puma/const.rb', line 182"SERVER_PROTOCOL".freeze
-
SERVER_SOFTWARE =
# File 'lib/puma/const.rb', line 185"SERVER_SOFTWARE".freeze
-
STOP_COMMAND =
# File 'lib/puma/const.rb', line 189"?".freeze
-
TRANSFER_ENCODING =
# File 'lib/puma/const.rb', line 219"transfer-encoding".freeze
-
TRANSFER_ENCODING2 =
# File 'lib/puma/const.rb', line 220"HTTP_TRANSFER_ENCODING".freeze
-
TRANSFER_ENCODING_CHUNKED =
# File 'lib/puma/const.rb', line 225"Transfer-Encoding: chunked\r\n".freeze
-
UNMASKABLE_HEADERS =
The keys of headers that should not be convert to underscore normalized versions. These headers are ignored at the request reading layer, but if we normalize them after reading, it’s just confusing for the application.
{ "HTTP_TRANSFER,ENCODING" => true, "HTTP_CONTENT,LENGTH" => true, }
-
WRITE_TIMEOUT =
How long to wait when getting some write blocking on the socket when sending data back
10