1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/test
Eileen M. Uchitelle 01699742a8 Add early hints feature (#1403)
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.
2017-10-04 06:30:16 -06:00
..
config Let's use Rubocop! (#1325) 2017-06-04 13:21:05 -07:00
rackup make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
shell Run integration tests in default (#1394) 2017-08-16 16:07:15 -06:00
helper.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_app_status.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_binder.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_cli.rb Add /gc URL to status server to do a major GC. Add a /gc-status URL to get GC.stats as JSON. (#1384) 2017-08-03 15:46:49 -06:00
test_config.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_events.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_http10.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_http11.rb Updates for frozen string literal compatibility. (#1376) 2017-08-02 19:02:40 -06:00
test_integration.rb Run integration tests in default (#1394) 2017-08-16 16:07:15 -06:00
test_iobuffer.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_minissl.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_null_io.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_persistent.rb Updates for frozen string literal compatibility. (#1376) 2017-08-02 19:02:40 -06:00
test_puma_server.rb Add early hints feature (#1403) 2017-10-04 06:30:16 -06:00
test_puma_server_ssl.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_pumactl.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_rack_handler.rb [close #1327] Fix double port bind in Rails 2017-08-02 14:28:39 -05:00
test_rack_server.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_tcp_logger.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_tcp_rack.rb Require puma/events in test helper (#1418) 2017-09-23 05:44:21 +09:00
test_thread_pool.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_unix_socket.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00
test_web_server.rb make test_helper no longer be loaded as a test (#1283) 2017-05-12 12:16:55 -07:00