aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-09-23Set server_name_indication for TLS handshakesLoïc Hoguin
This essentially reverts to the old behavior for initial TLS handshakes, and improves TLS support for the Socks/HTTP proxy cases.
2019-09-23Use the proper options type for socks/ws statesLoïc Hoguin
2019-09-23Accept all cow_http2_machine optionsLoïc Hoguin
2019-09-23Reduce the #http_state sizeLoïc Hoguin
The version is still kept in the state even if it's an option because it's useful to have there and it's just a tiny atom.
2019-09-23Remove 'protocol' option from connect_destination()Loïc Hoguin
It was deprecated and replaced by 'protocols' in a previous version.
2019-09-23Document sending N Websocket frames in the guideLoïc Hoguin
2019-09-22Account for Windows' 3-connect pattern in shutdown_SUITELoïc Hoguin
When Windows can't connect it retries 2 more times with 500ms wait in-between by default.
2019-09-22Increase a timeout to avoid an intermittent test failureLoïc Hoguin
I'm not exactly sure why it works but it seems to be solid now. I think the issue is around timeouts in the test and handler being too close to one another.
2019-09-22Remove the old eunit HTTP/2 testLoïc Hoguin
It is better covered by the shutdown_SUITE.
2019-09-22Cancel the existing keepalive when switching protocolsLoïc Hoguin
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-22Add CONNECT->Socks5->HTTP testsLoïc Hoguin
Also fix the multiple TLS proxies tests from the previous commit.
2019-09-22Add more tests with two Socks5 proxiesLoïc Hoguin
We now properly support TCP across two TLS proxies, and TLS across two TCP/TLS proxies.
2019-09-22Always switch_protocolLoïc Hoguin
When doing a CONNECT from http to http or from socks to socks we may want to use different configuration options. Switching the protocol explicitly helps us achieve that. It will also signal through events that a protocol switch occurred.
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-22Add Socks5->HTTP/2 testsLoïc Hoguin
Also consolidate the ALPN code in the tls_handshake state rather than doing it in CONNECT/Socks separately. Also improves the origin tests by sending a message once the handshake is completed instead of having timeouts.
2019-09-22Add tests for TLS proxy and TCP/TLS serverLoïc Hoguin
2019-09-22Support connecting to HTTPS server via TCP Socks5Loïc Hoguin
2019-09-22Further consolidation of TLS handshakesLoïc Hoguin
2019-09-22Simplify HandshakeEventLoïc Hoguin
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-22Add test for username_password authLoïc Hoguin
2019-09-22Initial support for Socks5Loïc Hoguin
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-07Enable nodelay to a test failing intermittentlyLoïc Hoguin
2019-08-07Timeout options tests taking long is not a failureLoïc Hoguin
2019-08-06Make gun_SUITE parallel and add retries on WindowsLoïc Hoguin
On Windows the timings can be flaky. It's better to retry a few times rather than fail immediately.
2019-08-06Increase the accept timeouts in proxy testsLoïc Hoguin
Should improve test success rates on Windows.
2019-08-05Improve the test proxy loop to avoid a badmatchLoïc Hoguin
2019-08-05Don't link gun_tls_proxy process to the ssl processLoïc Hoguin
It is ignored by ssl for the purpose we want, and causes problems in the other direction. Also use a normal shutdown when TLS handshake errors occur.
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-27Fix ssl and other typesLoïc Hoguin
2019-07-27Add the retry_fun option for different backoff strategiesLoïc Hoguin
2019-07-27Postpone operations until connectedTony Han
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-26Data received after RST_STREAM counts toward windowTony Han
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-25Rename ws_echo test handler to ws_echo_hLoïc Hoguin
2019-07-25Fix missing response_end event for HTTP/1.0 body_closeLoï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