* Fix crash when no_token is set
* Use a more meaningful name instead of an empty string
* Adds a test to ensure `{ no_token: true }` works
* Adds an explanation for the usage of a String
Just to justify the use of a String instead of a Symbol.
* Removes thread that would start the server
This removes the part of the test that would start the server. The
reason why the thread was being created originally in the PR was to
ensure that the server was booting even with `{ no_token: true }`.
I believe we don't need to test the full server boot but just ensure
that we won't pass a Symbol to OptionParser. In particular the test
ensures that the token will be set to `'none'` when `no_token: true`.
There're already other tests testing that the server boots.
Reduces runtime allocation by freezing string literals by default.
We could also remove a ton of manual `.freeze` calls, however the ruby supported version is 2.2 and the magic comment only targets 2.3+.
This commit adds the early hints lambda to the headers hash. Users can
call it to emit the early hints headers. For example:
```
class Server
def call env
if env["REQUEST_PATH"] == "/"
env['rack.early_hints'].call("Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload")
[200, { "X-Hello" => "World" }, ["Hello world!"]]
else
[200, { "X-Hello" => "World" }, ["NEAT!"]]
end
end
end
run Server.new
```
In this example, the server sends stylesheet and javascript early hints
if the proxy supports it, it will send H2 pushes to the client.
Of course not every proxy server supports early hints, so to enable the
early hints feature with puma you have to pass the configuration variable,
`--early-hints`.
If `ENV['rack.early_hints']` is not set then early hints is not
supported by the webserver. Early hints is off by default.
When puma is daemonized (or maybe always?) it swallows exceptions that happen during startup. This patch makes the log message slightly more useful.
Should we log the entire stacktrace too? Clutter vs. info...