Age | Commit message (Collapse) | Author |
|
|
|
The number of unacknowledged pings that can be tolerated
before the connection is forcefully closed.
When a keepalive ping is sent to the peer, a counter is
incremented and if this counter exceeds the tolerance limit,
the connection is forcefully closed. The counter is
decremented whenever a ping ack is received from the peer.
By default, the mechanism for closing the connection based
on ping and ping ack is disabled.
Loïc Hoguin: I have edited a lot of the code and renamed
a few things as well as simplified the docs and increased
test timeouts to avoid race conditions.
|
|
|
|
When no TCP options are provided, Gun will enable send
timeouts at 15s. The value was chosen large enough to
be safe while still allowing Gun to detect send errors
eventually. Different applications may need to tweak
and lower this value.
|
|
|
|
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.
|
|
|
|
Also contains a few small changes and Dialyzer fixes.
|
|
The details are not given for now. The best would be to
document them in Cowlib and refer to that documentation
instead of duplicating the information in both the Gun
and Cowboy manuals.
|
|
While at it the gun:info/1 function has been fixed to work
even when we are in the not_connected state, and the owner
is now also returned.
|
|
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.
|
|
Also correct various Socks related types. This commit also
adds a new gun:protocols/0 type as a simpler way of describing
preferred protocols. The protocol/opts tuple is also documented.
This commit also fixes an issue with the default value for the
preferred protocols when using CONNECT over TLS. It was
mistakenly not enabling http2 by default.
|
|
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.
|
|
|
|
|
|
This changes the way we connect to servers entirely. We now have
three states when connecting (domain_lookup, connect and
tls_handshake when applicable) and as a result three corresponding
timeout options. Each state has a start/end event associated and
the event data was tweaked to best match each event. Since the
TLS handshake is separate, the transport_opts option was also
split into two: tcp_opts and tls_opts.
|
|
|
|
|
|
Header names can now be provided as binary, string or atom
and Gun no longer requires them to be in lowercase. The list
of headers can also be provided as a map as well.
|
|
This is safer as servers may reject too many extra empty lines.
|
|
This cleaner separation gets rid of the implicit body check
that was causing issues for many users. Now the body is
either given explicitly or it is expected via future
gun:data/3 calls.
|
|
|
|
|
|
This fixes HTTP/2 over TLS connections.
The protocol destination option has been deprecated in favor
of a protocols option.
|
|
|
|
|
|
|
|
We instead of two new modules, gun_tcp and gun_tls.
They only have 6 functions so far, much less than
what Ranch provided before.
Also renames ssl to tls where applicable. It's still
possible to use the ssl transport option but it's now
undocumented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This disables the keepalive mechanism entirely.
|
|
|
|
I just replaced "SPDY" with "HTTP/2" in the documentation.
I suspect that's all that's needed, but if there's something
off we can fix it later.
|
|
|
|
|
|
|
|
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.
|
|
The type option has been removed. The transport and protocols
options can be used in its place.
The transport_opts option can be used to specify transport
options.
The http_opts and spdy_opts options can be used to specify
protocol specific options.
The keepalive option is now a protocol specific option.
Defaults depending on the port number have changed. Now only
port 443 uses ssl by default, other ports use tcp.
|
|
A number of @todo also remain in this document.
The manual pages have been converted to Asciidoc and they
can be installed system-wide using make install-docs.
The asciidoc rules will be converted into an erlang.mk plugin
in the near future.
|