aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_http2.erl
AgeCommit message (Collapse)Author
2019-09-26Don't send duplicate gun_error messages to the same processLoïc Hoguin
2019-09-26Remove UnprocessedStreams from the gun_down messageLoïc Hoguin
2019-09-26Add reply_to option to ws_upgrade; remove notowner entirelyLoïc Hoguin
The reply_to option is also propagated when we switch protocols.
2019-09-24Add auto-ping to Websocket and a silence_pings optionLoïc Hoguin
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.
2019-09-23Accept all cow_http2_machine optionsLoïc Hoguin
2019-09-22Rework state transitions resulting from from protocol changesLoïc Hoguin
2019-09-22Improve retrieval of keepalive optionLoïc Hoguin
2019-09-22Supports going through multiple Socks proxiesLoïc Hoguin
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.
2019-09-22Move and merge all TLS handshakes to the main Gun codeLoïc Hoguin
There's now an initial_tls_handshake state for the initial connection with handshake, and tls_handshake state for any subsequent TLS handshakes. The Socks5 code will be able to reuse this tls_handshake state to perform its own transport switches.
2019-09-13Use cow_http2_machine:ensure_windowLoïc Hoguin
Gun was very inefficient at receiving HTTP/2 bodies. Switching to ensure_window and increasing the default window sizes brings the response body reading performance at least on par with the one for HTTP/1.1. This has a small negative impact on message flow control because we stop updating the window later than we did before, increasing the number of extra messages we may send. The exact amount depends on configuration and the exact moment flow control kicks in.
2019-09-06Fix failing tests caused by DATA no longer being sentLoïc Hoguin
2019-09-06Don't send a DATA frame when there is no request bodyLoïc Hoguin
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-08-05Add flow controlLoïc Hoguin
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.
2019-07-26Data received after RST_STREAM counts toward windowTony Han
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-15Add Websocket frames related eventsLoïc Hoguin
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-04-22Make gun_tls_proxy work for HTTP/2 connectionsLoïc Hoguin
2019-01-09Add function gun:stream_info/2Loïc Hoguin
2019-01-05Clarify option errors in the manual for gun:open/open_unixLoïc Hoguin
Also fix an http into http2 for one option.
2019-01-03Update copyright yearsLoïc Hoguin
2019-01-02Don't send the default port in the host header for HTTP/2Loïc Hoguin
2018-12-31Separate request/4,5,6 into headers/4,5 and request/5,6Loïc Hoguin
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.
2018-12-19Convert the gun process to gen_statemLoïc Hoguin
2018-10-31The method must be a binary in cow_http2_machineLoïc Hoguin
2018-10-31Fix the error sent when we receive an RST_STREAMLoïc Hoguin
2018-10-30Switch to cow_http2_machine for HTTP/2Loïc Hoguin
A common state machine for Gun and Cowboy will be easier to maintain. This fixes numerous issues including some test failures that were hidden because the h2specd_SUITE was flawed. We temporarily depend on Cowlib master until a new version is released.
2018-10-01Remove unreachable clauses pointed out by DialyzerLoïc Hoguin
2018-10-01Fix the remaining h2specd test failuresLoïc Hoguin
2018-10-01Handle HTTP/2 continuation framesLoïc Hoguin
Fixes most h2specd tests.
2018-09-28Ignore HTTP/2 frames of unknown typesLoïc Hoguin
2018-09-26Don't crash on HEADERS frames with PRIORITY flag setLoïc Hoguin
2018-09-17Add HTTP/1.1 CONNECT supportLoïc Hoguin
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.
2018-08-06Fix the status code passed to content handlersLoïc Hoguin
The integer form is expected, not the binary.
2018-08-06Fix some types that were referring to CowboyLoïc Hoguin
2018-06-04Support Unix domain sockets when building host headersSimon Thörnqvist
2018-06-04Update copyright yearsLoïc Hoguin
2018-06-04Add some todos for laterLoïc Hoguin
2018-06-04Remove the dependency on RanchLoïc Hoguin
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.
2018-06-03Rename gun_data and gun_sse to gun_data_h and gun_sse_hLoïc Hoguin
2018-06-03Reorder the option checksLoïc Hoguin
2018-05-15Allow IP tuple for host #152Seudin Kasumovic
2018-05-07Import the HTTP/2 send_data function from CowboyLoïc Hoguin
Few changes were required so that's pretty good. It will be split off in a separate common module at a later time.
2017-11-15Add preliminary support for trailersLoïc Hoguin
The code is definitely not the best, but as long as it doesn't break anything it should be OK for now.
2017-10-29Add support for informational responsesLoïc Hoguin