diff options
author | Loïc Hoguin <[email protected]> | 2020-10-22 18:48:06 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-11-02 17:16:57 +0100 |
commit | d5f1a47e9ab758a51b23440eb72a0251527f3f7b (patch) | |
tree | e7c27355da10d89483394314a25cd5307ccc7da6 /src/gun.erl | |
parent | 465d072abf4a76104d4562ed15345b27fe9a0cff (diff) | |
download | gun-d5f1a47e9ab758a51b23440eb72a0251527f3f7b.tar.gz gun-d5f1a47e9ab758a51b23440eb72a0251527f3f7b.tar.bz2 gun-d5f1a47e9ab758a51b23440eb72a0251527f3f7b.zip |
Initial implementation of Websocket over HTTP/2http2-websocket
Diffstat (limited to 'src/gun.erl')
-rw-r--r-- | src/gun.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gun.erl b/src/gun.erl index 69dbb6b..e441e52 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -229,6 +229,7 @@ cookie_ignore_informational => boolean(), flow => pos_integer(), keepalive => timeout(), + notify_settings_changed => boolean(), %% Options copied from cow_http2_machine. connection_window_margin_size => 0..16#7fffffff, @@ -708,6 +709,8 @@ connect(ServerPid, Destination, Headers, ReqOpts) -> | {push, stream_ref(), binary(), binary(), resp_headers()} | {upgrade, [binary()], resp_headers()} | {ws, ws_frame()} + | {up, http | http2 | raw | socks} + | {notify, settings_changed, map()} | {error, {stream_error | connection_error | down, any()} | timeout}. -spec await(pid(), stream_ref()) -> await_result(). @@ -747,6 +750,8 @@ await(ServerPid, StreamRef, Timeout, MRef) -> {ws, Frame}; {gun_tunnel_up, ServerPid, StreamRef, Protocol} -> {up, Protocol}; + {gun_notify, ServerPid, Type, Info} -> + {notify, Type, Info}; {gun_error, ServerPid, StreamRef, Reason} -> {error, {stream_error, Reason}}; {gun_error, ServerPid, Reason} -> @@ -1223,7 +1228,8 @@ connected_ws_only(cast, {ws_send, ReplyTo, StreamRef, Frames}, State=#state{ protocol=Protocol=gun_ws, protocol_state=ProtoState, event_handler=EvHandler, event_handler_state=EvHandlerState0}) -> {Commands, EvHandlerState} = Protocol:ws_send(Frames, - ProtoState, StreamRef, ReplyTo, EvHandler, EvHandlerState0), + ProtoState, dereference_stream_ref(StreamRef, State), + ReplyTo, EvHandler, EvHandlerState0), commands(Commands, State#state{event_handler_state=EvHandlerState}); connected_ws_only(cast, {ws_send, ReplyTo, Frames}, State=#state{ protocol=Protocol=gun_ws, protocol_state=ProtoState, @@ -1312,10 +1318,10 @@ connected(cast, {ws_upgrade, ReplyTo, StreamRef, Path, Headers, WsOpts}, %% @todo Maybe better standardize the protocol callbacks argument orders. connected(cast, {ws_send, ReplyTo, StreamRef, Frames}, State=#state{ protocol=Protocol, protocol_state=ProtoState, - event_handler=EvHandler, event_handler_state=EvHandlerState0}) - when is_list(StreamRef) -> + event_handler=EvHandler, event_handler_state=EvHandlerState0}) -> {Commands, EvHandlerState} = Protocol:ws_send(Frames, - ProtoState, StreamRef, ReplyTo, EvHandler, EvHandlerState0), + ProtoState, dereference_stream_ref(StreamRef, State), + ReplyTo, EvHandler, EvHandlerState0), commands(Commands, State#state{event_handler_state=EvHandlerState}); %% Catch-all for the StreamRef-free variant. connected(cast, {ws_send, ReplyTo, _}, _) -> |