mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Switch cowboy_http2 to the new cow_http2_machine
The new module is a merge of the Cowboy and Gun HTTP/2 state machines. Using a common code will help future developments rather than duplicating the work. A notable change is in how streams are terminated when the handler stops before the body is sent. The cowboy_stream:terminate function is now called only after the body has been sent fully (or the stream is reset in-between), not when the stop command is returned. This will most likely have an impact on metrics but will be closer to reality. I had to comment a broken test in rfc7231_SUITE that was cheating, cheating is no longer possible. This depends on Cowlib master for the time being. A new Cowlib version will be released once both Cowboy and Gun are ported to use cow_http2_machine and I'm satisfied with it.
This commit is contained in:
parent
3310849115
commit
e1d970b5eb
4 changed files with 507 additions and 1068 deletions
2
Makefile
2
Makefile
|
@ -15,7 +15,7 @@ CT_OPTS += -ct_hooks cowboy_ct_hook [] # -boot start_sasl
|
||||||
LOCAL_DEPS = crypto
|
LOCAL_DEPS = crypto
|
||||||
|
|
||||||
DEPS = cowlib ranch
|
DEPS = cowlib ranch
|
||||||
dep_cowlib = git https://github.com/ninenines/cowlib 2.6.0
|
dep_cowlib = git https://github.com/ninenines/cowlib master
|
||||||
dep_ranch = git https://github.com/ninenines/ranch 1.6.2
|
dep_ranch = git https://github.com/ninenines/ranch 1.6.2
|
||||||
|
|
||||||
DOC_DEPS = asciideck
|
DOC_DEPS = asciideck
|
||||||
|
|
1552
src/cowboy_http2.erl
1552
src/cowboy_http2.erl
File diff suppressed because it is too large
Load diff
|
@ -71,8 +71,7 @@
|
||||||
%% Start/end of the processing of the request.
|
%% Start/end of the processing of the request.
|
||||||
%%
|
%%
|
||||||
%% This represents the time from this stream handler's init
|
%% This represents the time from this stream handler's init
|
||||||
%% to terminate. Note that this doesn't indicate the response
|
%% to terminate.
|
||||||
%% has been sent fully, it still may be queued up in a buffer.
|
|
||||||
req_start => integer(),
|
req_start => integer(),
|
||||||
req_end => integer(),
|
req_end => integer(),
|
||||||
|
|
||||||
|
|
|
@ -150,14 +150,16 @@ method_delete(Config) ->
|
||||||
{ok, <<"DELETE">>} = gun:await_body(ConnPid, Ref),
|
{ok, <<"DELETE">>} = gun:await_body(ConnPid, Ref),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
method_connect(Config) ->
|
%% @todo This test is currently broken because Gun does not
|
||||||
doc("The CONNECT method is currently not implemented. (RFC7231 4.3.6)"),
|
%% send a proper CONNECT request.
|
||||||
ConnPid = gun_open(Config),
|
%method_connect(Config) ->
|
||||||
Ref = gun:request(ConnPid, <<"CONNECT">>, "localhost:8080", [
|
% doc("The CONNECT method is currently not implemented. (RFC7231 4.3.6)"),
|
||||||
{<<"accept-encoding">>, <<"gzip">>}
|
% ConnPid = gun_open(Config),
|
||||||
]),
|
% Ref = gun:request(ConnPid, <<"CONNECT">>, "localhost:8080", [
|
||||||
{response, fin, 501, _} = gun:await(ConnPid, Ref),
|
% {<<"accept-encoding">>, <<"gzip">>}
|
||||||
ok.
|
% ]),
|
||||||
|
% {response, fin, 501, _} = gun:await(ConnPid, Ref),
|
||||||
|
% ok.
|
||||||
|
|
||||||
% A client sending a CONNECT request MUST send the authority form of
|
% A client sending a CONNECT request MUST send the authority form of
|
||||||
% request-target (Section 5.3 of [RFC7230]); i.e., the request-target
|
% request-target (Section 5.3 of [RFC7230]); i.e., the request-target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue