Module: Unicorn::Const

Defined in:
lib/unicorn/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. Symbols did not really improve things much compared to constants.

Constant Summary collapse

UNICORN_VERSION =
"0.93.5"
DEFAULT_HOST =

default TCP listen host address

"0.0.0.0"
DEFAULT_PORT =

default TCP listen port

8080
DEFAULT_LISTEN =
"#{DEFAULT_HOST}:#{DEFAULT_PORT}"
CHUNK_SIZE =

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

(16 * 1024)
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)
MAX_BODY =

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

MAX_HEADER
ERROR_400_RESPONSE =

common errors we’ll send back

"HTTP/1.1 400 Bad Request\r\n\r\n"
ERROR_500_RESPONSE =
"HTTP/1.1 500 Internal Server Error\r\n\r\n"
EXPECT_100_RESPONSE =
"HTTP/1.1 100 Continue\r\n\r\n"
REMOTE_ADDR =

A frozen format for this is about 15% faster

"REMOTE_ADDR".freeze
HTTP_EXPECT =
"HTTP_EXPECT".freeze
RACK_INPUT =
"rack.input".freeze