aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_event.erl
AgeCommit message (Collapse)Author
2019-09-22Document Socks supportLoïc Hoguin
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.
2019-09-05Implement graceful shutdownLoïc Hoguin
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.
2019-07-27Fix ssl and other typesLoïc Hoguin
2019-07-26Add the origin_changed eventLoïc Hoguin
2019-07-26Add the transport_changed eventLoïc Hoguin
Also test protocol_changed over CONNECT.
2019-07-26Add tls_handshake events for CONNECT through TLS proxiesLoïc Hoguin
2019-07-25Add tls_handshake events for CONNECT through TCP proxiesLoïc Hoguin
2019-07-24Add the cancel event for local/remote stream cancellationLoïc Hoguin
2019-07-24Add push_promise_start/push_promise_end eventsLoïc Hoguin
2019-07-22Split domain lookup/connect/TLS handshake and add eventsLoïc Hoguin
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.
2019-07-15Add Websocket frames related eventsLoïc Hoguin
2019-07-13Add ws_upgrade/protocol_changed eventsLoïc Hoguin
And ensure that Websocket triggers all the request/response events.
2019-07-03Add the response_trailers eventLoïc Hoguin
2019-07-03Add the response_start eventLoïc Hoguin
Thought it needed cow_http2_machine changes but everything was available. For HTTP/1.1 it is triggered when receiving data while expecting headers. For HTTP/2 it is triggered after we have received a HEADERS frame for streams in idle state.
2019-07-02Add response_inform/response_headers/response_end eventsLoïc Hoguin
This covers many scenarios but more need to be added.
2019-06-02Add request_start, request_headers and request_end eventsLoïc Hoguin
2019-05-13Add the terminate eventLoïc Hoguin
2019-05-13Add the disconnect event callbackLoïc Hoguin
2019-05-08Add event_handler with init/connect_start/connect_endLoïc Hoguin