Module: Puma::Const
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| 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
-
ACCEPT_ERROR_DELAY =
# File 'lib/puma/const.rb', line 113
How long the accept loop waits after running out of file descriptors
0.1 -
BANNED_HEADER_KEY =
# File 'lib/puma/const.rb', line 296
Banned keys of response header
/\A(rack\.|status\z)/.freeze
-
CGI_VER =
# File 'lib/puma/const.rb', line 226"CGI/1.2" -
CHUNKED =
# File 'lib/puma/const.rb', line 269"chunked" -
CHUNK_SIZE =
# File 'lib/puma/const.rb', line 141
The basic max request size we'll try to read.
64 * 1024
-
CLOSE =
# File 'lib/puma/const.rb', line 255"close" -
CLOSE_CHUNKED =
# File 'lib/puma/const.rb', line 267"0\r\n\r\n" -
CODE_NAME =
# File 'lib/puma/const.rb', line 104"Into the Arena" -
COLON =
# File 'lib/puma/const.rb', line 271": " -
CONNECTION_CLOSE =
# File 'lib/puma/const.rb', line 263"connection: close\r\n" -
CONNECTION_KEEP_ALIVE =
# File 'lib/puma/const.rb', line 264"connection: keep-alive\r\n" -
CONTENT_LENGTH =
# File 'lib/puma/const.rb', line 119"CONTENT_LENGTH" -
CONTENT_LENGTH2 =
# File 'lib/puma/const.rb', line 258"content-length" -
CONTENT_LENGTH_S =
# File 'lib/puma/const.rb', line 259"content-length: " -
CONTINUE =
# File 'lib/puma/const.rb', line 249"100-continue" -
DQUOTE =
# File 'lib/puma/const.rb', line 282
Illegal character in the key or value of response header
"\"" -
EARLY_HINTS =
# File 'lib/puma/const.rb', line 279"rack.early_hints" -
ERROR_RESPONSE =
# File 'lib/puma/const.rb', line 125{ # 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\n\r\n", # The standard empty 408 response for requests that timed out. 408 => "HTTP/1.1 408 Request Timeout\r\nconnection: close\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\n" }.freeze -
GATEWAY_INTERFACE =
# File 'lib/puma/const.rb', line 225"GATEWAY_INTERFACE" -
HALT_COMMAND =
# File 'lib/puma/const.rb', line 229"!" -
HEAD =
# File 'lib/puma/const.rb', line 151"HEAD" -
HIJACK =
# File 'lib/puma/const.rb', line 276"rack.hijack" -
HIJACK_IO =
# File 'lib/puma/const.rb', line 277"rack.hijack_io" -
HIJACK_P =
# File 'lib/puma/const.rb', line 275"rack.hijack?" -
HTTP =
# File 'lib/puma/const.rb', line 241"http" -
HTTPS =
# File 'lib/puma/const.rb', line 242"https" -
HTTPS_KEY =
# File 'lib/puma/const.rb', line 244"HTTPS" -
HTTP_10_200 =
# File 'lib/puma/const.rb', line 253"HTTP/1.0 200 OK\r\n" -
HTTP_11 =
# File 'lib/puma/const.rb', line 222"HTTP/1.1" -
HTTP_11_100 =
# File 'lib/puma/const.rb', line 251"HTTP/1.1 100 Continue\r\n\r\n" -
HTTP_11_200 =
# File 'lib/puma/const.rb', line 252"HTTP/1.1 200 OK\r\n" -
HTTP_CONNECTION =
# File 'lib/puma/const.rb', line 247"HTTP_CONNECTION" -
HTTP_EXPECT =
# File 'lib/puma/const.rb', line 248"HTTP_EXPECT" -
HTTP_HEADER_DELIMITER =
# File 'lib/puma/const.rb', line 283Regexp.escape("(),/:;<=>?@[]{}\\").freeze
-
HTTP_HOST =
# File 'lib/puma/const.rb', line 212"HTTP_HOST" -
HTTP_VERSION =
# File 'lib/puma/const.rb', line 246"HTTP_VERSION" -
HTTP_X_FORWARDED_FOR =
# File 'lib/puma/const.rb', line 205"HTTP_X_FORWARDED_FOR" -
HTTP_X_FORWARDED_PROTO =
# File 'lib/puma/const.rb', line 208"HTTP_X_FORWARDED_PROTO" -
HTTP_X_FORWARDED_SCHEME =
# File 'lib/puma/const.rb', line 207"HTTP_X_FORWARDED_SCHEME" -
HTTP_X_FORWARDED_SSL =
# File 'lib/puma/const.rb', line 206"HTTP_X_FORWARDED_SSL" -
IANA_HTTP_METHODS =
# File 'lib/puma/const.rb', line 159
list from https://www.iana.org/assignments/http-methods/http-methods.xhtml as of 17-Jun-26, with QUERY added based on https://www.rfc-editor.org/rfc/rfc10008.html
%w[ ACL BASELINE-CONTROL BIND CHECKIN CHECKOUT CONNECT COPY DELETE GET HEAD LABEL LINK LOCK MERGE MKACTIVITY MKCALENDAR MKCOL MKREDIRECTREF MKWORKSPACE MOVE OPTIONS ORDERPATCH PATCH POST PRI PROPFIND PROPPATCH PUT QUERY REBIND REPORT SEARCH TRACE UNBIND UNCHECKOUT UNLINK UNLOCK UPDATE UPDATEREDIRECTREF VERSION-CONTROL ].freeze
-
ILLEGAL_HEADER_KEY_REGEX =
# File 'lib/puma/const.rb', line 284/[\x00-\x20#{DQUOTE}#{HTTP_HEADER_DELIMITER}]/.freeze
-
ILLEGAL_HEADER_VALUE_REGEX =
# File 'lib/puma/const.rb', line 286
header values can contain HTAB?
/[\x00-\x08\x0A-\x1F]/.freeze
-
KEEP_ALIVE =
# File 'lib/puma/const.rb', line 256"keep-alive" -
LINE_END =
# File 'lib/puma/const.rb', line 203
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 215"localhost" -
LOCALHOST_IPV4 =
# File 'lib/puma/const.rb', line 216"127.0.0.1" -
LOCALHOST_IPV6 =
# File 'lib/puma/const.rb', line 217"::1" -
MAX_BODY =
# File 'lib/puma/const.rb', line 148
Maximum request body size before it is moved out of memory and into a tempfile for reading.
MAX_HEADER -
MAX_HEADER =
# File 'lib/puma/const.rb', line 145
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 273"\n" -
PATH_INFO =
# File 'lib/puma/const.rb', line 121"PATH_INFO" -
PORT_443 =
# File 'lib/puma/const.rb', line 214"443" -
PORT_80 =
# File 'lib/puma/const.rb', line 213"80" -
PROXY_PROTOCOL_V1_MAX_LENGTH =
# File 'lib/puma/const.rb', line 299107 -
PROXY_PROTOCOL_V1_REGEX =
# File 'lib/puma/const.rb', line 298/\APROXY (?:TCP4|TCP6|UNKNOWN) ([^\r]+)\r\n/.freeze
-
PUMA_CONFIG =
# File 'lib/puma/const.rb', line 237"puma.config" -
PUMA_PEERCERT =
# File 'lib/puma/const.rb', line 238"puma.peercert" -
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 236"puma.socket" -
PUMA_TMP_BASE =
# File 'lib/puma/const.rb', line 123"puma" -
PUMA_UNDERSCORE_HEADERS =
# File 'lib/puma/const.rb', line 239"puma.underscore_headers" -
PUMA_VERSION =
# File 'lib/puma/const.rb', line 103VERSION = "8.0.3"
-
QUERY_STRING =
# File 'lib/puma/const.rb', line 118"QUERY_STRING" -
RACK_AFTER_REPLY =
# File 'lib/puma/const.rb', line 234"rack.after_reply" -
RACK_INPUT =
# File 'lib/puma/const.rb', line 232"rack.input" -
RACK_RESPONSE_FINISHED =
# File 'lib/puma/const.rb', line 235"rack.response_finished" -
RACK_URL_SCHEME =
# File 'lib/puma/const.rb', line 233"rack.url_scheme" -
REMOTE_ADDR =
# File 'lib/puma/const.rb', line 204"REMOTE_ADDR" -
REQUEST_METHOD =
# File 'lib/puma/const.rb', line 150"REQUEST_METHOD" -
REQUEST_PATH =
# File 'lib/puma/const.rb', line 117"REQUEST_PATH" -
REQUEST_URI =
# File 'lib/puma/const.rb', line 116
The original URI requested by the client.
"REQUEST_URI" -
RESTART_COMMAND =
# File 'lib/puma/const.rb', line 230"R" -
SERVER_NAME =
# File 'lib/puma/const.rb', line 210"SERVER_NAME" -
SERVER_PORT =
# File 'lib/puma/const.rb', line 211"SERVER_PORT" -
SERVER_PROTOCOL =
# File 'lib/puma/const.rb', line 221"SERVER_PROTOCOL" -
SERVER_SOFTWARE =
# File 'lib/puma/const.rb', line 224"SERVER_SOFTWARE" -
STOP_COMMAND =
# File 'lib/puma/const.rb', line 228"?" -
SUPPORTED_HTTP_METHODS =
# File 'lib/puma/const.rb', line 155
based on https://www.rfc-editor.org/rfc/rfc9110.html#name-overview and https://www.rfc-editor.org/rfc/rfc10008.html, with CONNECT removed, and PATCH & QUERY added
%w[HEAD GET POST PUT DELETE OPTIONS TRACE PATCH QUERY].freeze
-
TRANSFER_ENCODING =
# File 'lib/puma/const.rb', line 260"transfer-encoding" -
TRANSFER_ENCODING2 =
# File 'lib/puma/const.rb', line 261"HTTP_TRANSFER_ENCODING" -
TRANSFER_ENCODING_CHUNKED =
# File 'lib/puma/const.rb', line 266"transfer-encoding: chunked\r\n" -
UNMASKABLE_HEADERS =
# File 'lib/puma/const.rb', line 290
Framing aliases must never be normalized into standard header keys. Client#setup_body rejects requests containing these keys before body reads.
{ "HTTP_TRANSFER,ENCODING" => true, "HTTP_CONTENT,LENGTH" => true, } -
UNSPECIFIED_IPV4 =
# File 'lib/puma/const.rb', line 218"0.0.0.0" -
UNSPECIFIED_IPV6 =
# File 'lib/puma/const.rb', line 219"::" -
WRITE_TIMEOUT =
# File 'lib/puma/const.rb', line 110
How long to wait when getting some write blocking on the socket when sending data back
10