mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 04:10:24 +00:00
Fix h2spec "invalid preface sequence" test
Introduce a currently undocumented option to allow disabling cowboy_http when using a clear listener.
This commit is contained in:
parent
bcef70818b
commit
a8a2689727
2 changed files with 12 additions and 1 deletions
|
@ -41,7 +41,16 @@ connection_process(Parent, Ref, Transport, Opts) ->
|
|||
undefined
|
||||
end,
|
||||
{ok, Socket} = ranch:handshake(Ref),
|
||||
init(Parent, Ref, Socket, Transport, ProxyInfo, Opts, cowboy_http).
|
||||
%% Use cowboy_http2 directly only when 'http' is missing.
|
||||
%% Otherwise switch to cowboy_http2 from cowboy_http.
|
||||
%%
|
||||
%% @todo Extend this option to cowboy_tls and allow disabling
|
||||
%% the switch to cowboy_http2 in cowboy_http. Also document it.
|
||||
Protocol = case maps:get(protocols, Opts, [http2, http]) of
|
||||
[http2] -> cowboy_http2;
|
||||
[_|_] -> cowboy_http
|
||||
end,
|
||||
init(Parent, Ref, Socket, Transport, ProxyInfo, Opts, Protocol).
|
||||
|
||||
init(Parent, Ref, Socket, Transport, ProxyInfo, Opts, Protocol) ->
|
||||
_ = case maps:get(connection_type, Opts, supervisor) of
|
||||
|
|
|
@ -36,6 +36,8 @@ init_per_suite(Config) ->
|
|||
cowboy_test:init_http(h2spec, #{
|
||||
env => #{dispatch => init_dispatch()},
|
||||
max_concurrent_streams => 100,
|
||||
%% This test suite expects an HTTP/2-only connection.
|
||||
protocols => [http2],
|
||||
%% Disable the DATA threshold for this test suite.
|
||||
stream_window_data_threshold => 0
|
||||
}, Config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue