mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 04:10:24 +00:00
Fix signal int sizes
This commit is contained in:
parent
8c2bdb1e22
commit
2fe2edf4ff
2 changed files with 8 additions and 22 deletions
|
@ -556,8 +556,8 @@ early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer},
|
|||
%% Datagrams.
|
||||
|
||||
parse_datagram(State, Data) ->
|
||||
case parse_var_int(Data) of
|
||||
{ok, QuarterID, Rest} ->
|
||||
case cow_http3:parse_int(Data) of
|
||||
{QuarterID, Rest} ->
|
||||
SessionID = QuarterID * 4,
|
||||
case stream_get(State, SessionID) of
|
||||
#stream{status=webtransport_session} ->
|
||||
|
@ -571,18 +571,6 @@ parse_datagram(State, Data) ->
|
|||
loop(State)
|
||||
end.
|
||||
|
||||
%% @todo Move to Cowlib and use in cow_http3.
|
||||
parse_var_int(<<0:2, Int:6, Rest/bits>>) ->
|
||||
{ok, Int, Rest};
|
||||
parse_var_int(<<1:2, Int:14, Rest/bits>>) ->
|
||||
{ok, Int, Rest};
|
||||
parse_var_int(<<2:2, Int:30, Rest/bits>>) ->
|
||||
{ok, Int, Rest};
|
||||
parse_var_int(<<3:2, Int:62, Rest/bits>>) ->
|
||||
{ok, Int, Rest};
|
||||
parse_var_int(_) ->
|
||||
more.
|
||||
|
||||
%% Erlang messages.
|
||||
|
||||
down(State0=#state{opts=Opts, children=Children0}, Pid, Msg) ->
|
||||
|
|
|
@ -115,7 +115,7 @@ accept_session_when_enabled(Config) ->
|
|||
} = do_webtransport_connect(Config),
|
||||
%% Create a bidi stream, send Hello, get Hello back.
|
||||
{ok, BidiStreamRef} = quicer:start_stream(Conn, #{}),
|
||||
{ok, _} = quicer:send(BidiStreamRef, <<16#41, 0:2, SessionID:6, "Hello">>),
|
||||
{ok, _} = quicer:send(BidiStreamRef, <<1:2, 16#41:14, 0:2, SessionID:6, "Hello">>),
|
||||
{ok, <<"Hello">>} = rfc9114_SUITE:do_receive_data(BidiStreamRef),
|
||||
ok.
|
||||
|
||||
|
@ -125,8 +125,6 @@ accept_session_when_enabled(Config) ->
|
|||
|
||||
%% 3.4. Application Protocol Negotiation
|
||||
|
||||
%% The user agent MAY include a WT-Available-Protocols header field in the CONNECT request. The WT-Available-Protocols enumerates the possible protocols in preference order. If the server receives such a header, it MAY include a WT-Protocol field in a successful (2xx) response. If it does, the server SHALL include a single choice from the client's list in that field. Servers MAY reject the request if the client did not include a suitable protocol. (3.4)
|
||||
|
||||
application_protocol_negotiation(Config) ->
|
||||
doc("Applications can negotiate a protocol to use via WebTransport. "
|
||||
"(draft_webtrans_http3 3.4)"),
|
||||
|
@ -162,11 +160,11 @@ unidirectional_streams(Config) ->
|
|||
{ok, LocalStreamRef} = quicer:start_stream(Conn,
|
||||
#{open_flag => ?QUIC_STREAM_OPEN_FLAG_UNIDIRECTIONAL}),
|
||||
{ok, _} = quicer:send(LocalStreamRef,
|
||||
<<16#54, 0:2, SessionID:6, "Hello">>,
|
||||
<<1:2, 16#54:14, 0:2, SessionID:6, "Hello">>,
|
||||
?QUIC_SEND_FLAG_FIN),
|
||||
%% Accept an identical unidi stream.
|
||||
{unidi, RemoteStreamRef} = do_receive_new_stream(),
|
||||
{nofin, <<16#54, 0:2, SessionID:6>>} = do_receive_data(RemoteStreamRef),
|
||||
{nofin, <<1:2, 16#54:14, 0:2, SessionID:6>>} = do_receive_data(RemoteStreamRef),
|
||||
{fin, <<"Hello">>} = do_receive_data(RemoteStreamRef),
|
||||
ok.
|
||||
|
||||
|
@ -182,7 +180,7 @@ bidirectional_streams_client(Config) ->
|
|||
} = do_webtransport_connect(Config),
|
||||
%% Create a bidi stream, send Hello, get Hello back.
|
||||
{ok, LocalStreamRef} = quicer:start_stream(Conn, #{}),
|
||||
{ok, _} = quicer:send(LocalStreamRef, <<16#41, 0:2, SessionID:6, "Hello">>),
|
||||
{ok, _} = quicer:send(LocalStreamRef, <<1:2, 16#41:14, 0:2, SessionID:6, "Hello">>),
|
||||
%% @todo Use the local do_receive_data instead to have the fin flag.
|
||||
{ok, <<"Hello">>} = rfc9114_SUITE:do_receive_data(LocalStreamRef),
|
||||
ok.
|
||||
|
@ -197,10 +195,10 @@ bidirectional_streams_server(Config) ->
|
|||
} = do_webtransport_connect(Config),
|
||||
%% Create a bidi stream, send a special instruction to make it create a bidi stream.
|
||||
{ok, LocalStreamRef} = quicer:start_stream(Conn, #{}),
|
||||
{ok, _} = quicer:send(LocalStreamRef, <<16#41, 0:2, SessionID:6, "TEST:open_bidi">>),
|
||||
{ok, _} = quicer:send(LocalStreamRef, <<1:2, 16#41:14, 0:2, SessionID:6, "TEST:open_bidi">>),
|
||||
%% Accept the bidi stream and receive the data.
|
||||
{bidi, RemoteStreamRef} = do_receive_new_stream(),
|
||||
{nofin, <<16#41, 0:2, SessionID:6>>} = do_receive_data(RemoteStreamRef),
|
||||
{nofin, <<1:2, 16#41:14, 0:2, SessionID:6>>} = do_receive_data(RemoteStreamRef),
|
||||
{ok, _} = quicer:send(RemoteStreamRef, <<"Hello">>,
|
||||
?QUIC_SEND_FLAG_FIN),
|
||||
{fin, <<"Hello">>} = do_receive_data(RemoteStreamRef),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue