Age | Commit message (Collapse) | Author |
|
|
|
|
|
Switching from /2 to /3 should be easy enough.
Also update the documentation about HTTP/2 Websocket support.
|
|
|
|
The cookie_ignore_informational has been moved to http_opts and
http2_opts.
Also fix an issue when using 'protocols' in gun:open.
When connecting via TLS the protocol's options were
discarded.
|
|
|
|
For HTTP/2 some servers are not fond of receiving pings,
especially if there's no stream at the time. (particularly
gRPC servers). This is an odd decision for sure. Rather
than trying to accomodate for their logic the ping is no
longer sent by default.
For Websocket sending a ping is a new feature in Gun 2.0
so I'm just being conservative there.
|
|
|
|
|
|
The reply_to option is also propagated when we switch protocols.
|
|
The auto-ping will at regular interval send a ping frame.
The silence_pings option defaults to true. It can be set
to false when the user needs to receive ping/pong frames.
|
|
|
|
|
|
|
|
This commit also reworks the switch_protocol command.
The `P | {P, Opts}` type is used here as well. This
allows us to remove the code specific to Websocket.
In addition a few new protocol functions allow us
to declare what's the name of the options key for
the protocol and what the capabilities are with
regard to keepalive.
|
|
The graceful shutdown is implemented through a new 'closing'
state. This state is entered under different circumstances
depending on the protocol.
The gun:shutdown/1 function is now implemented and documented.
It allows shutting down the connection gracefully regardless
of the current state of the connection and for all protocols.
The behavior is entirely dependent on the protocol.
For HTTP/1.1 the connection stays up only until after the
current stream is complete; other streams are immediately
canceled.
For HTTP/2 a GOAWAY frame is sent and existing streams
continue to be processed. The connection is closed after
all streams are processed and the server's GOAWAY frame
is received.
For Websocket a close frame is sent. The connection is
closed when receiving the server's close frame.
In all cases the closing_timeout option defines how long
we wait, as a maximum, before closing the connection after
the graceful shutdown was started.
The graceful shutdown is also initiated when the owner
process goes away; when sending an HTTP/1.1 request
with the connection: close header; when receiving an
HTTP/1.1 response with the connection: close header;
when receiving an HTTP/1.0 response without a connection
header; when the server sends a GOAWAY HTTP/2 frame;
or when we send or receive a Websocket close frame.
Along with these changes, the gun:ws_send/2 function
now accepts a list of frames as argument. Those frames
may include a close frame that initiates the graceful
shutdown.
|
|
Flow control is disabled by default. The initial flow value
must be set to enable it (either for the entire connection
or on a per-request basis). Flow applies to all HTTP streams
as well as Websocket. HTTP/2 pushed streams receive the same
value as their originating stream.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gun can now be used to connect through TCP HTTP/1.1 proxies
using all supported protocols. It is also possible to create
a tunnel through multiple proxies.
Also updates Cowlib to 2.6.0.
|
|
|
|
|
|
|
|
|
|
|
|
This functionality can be used to implement custom protocols
on top of Websocket, but may also be used to decode frame
contents on the fly if necessary.
The default_protocol option defines what module should be
used when no protocol was selected.
The protocols option is a list of key/value pairs used to
select the handler depending on the protocol that the server
accepted.
The feature is currently experimental.
|
|
Also improves the code and documentation about this message.
It was incorrectly specified that a gun_ws_upgrade message
could be sent on error; instead a gun_response is sent.
|
|
Allow passing Websocket options through either open or ws_upgrade.
Document ws_upgrade/4.
|
|
|
|
The flush(Pid) function was enhanced to also discard Websocket
messages and the new up/down messages.
|
|
All autobahntestsuite tests pass including the permessage-deflate
compression tests.
Some of the tests pass in a non-strict fashion. They are testing
for protocol errors and expect events to happen in a particular
order, which is not respected by Gun. Gun fails earlier than is
expected due to concurrent processing of frames.
The implementation when error occurs during handshake is probably
a bit rough at this point. The documentation is also incomplete
and/or wrong at this time, though this is the general state of
the Gun documentation and will be resolved in a separate commit.
|