aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2019-10-08Fix retrying on disconnect with retry=1Loï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-26Add a function to change the connection ownerLoïc Hoguin
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.
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-24Reject requests/data when using WebsocketLoïc Hoguin
2019-09-24Initial support for raw send/recv operationsLoïc Hoguin
Gun can now be used to send or receive arbitrary data in the following scenarios: * Directly after connecting to a server (this is not terribly useful but it works nevertheless due to the Gun architecture) * After connecting through one or more Socks and/or HTTP proxies. This allows using Gun's proxy capabilities to access servers located beyond firewalls. * After performing an HTTP/1.1 Upgrade. This allows using Gun to implement custom protocols that require upgrading from an HTTP/1.1 connection. As there is still no support for HTTP/2 CONNECT for the time being, there are no relevant streams attached to those use cases and therefore the raw protocol currently expects users to use 'undefined' as the StreamRef value. This is not a final decision and will most likely produce a Dialyzer warning at this time.
2019-09-23Properly error out on HTTP/1.0 Websocket upgrade attemptsLoï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-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-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-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-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-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-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
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-04Fix the HTTP/2 eunit testLoïc Hoguin
That test will need to be converted to CT and improved.
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