aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2020-03-28Make the stream_info tests more reliableLoïc Hoguin
2020-03-28Improve the flow_SUITE:flow_ws test caseLoïc Hoguin
Make sure we don't queue too much on the socket because in that case Gun will just consume everything it's already got.
2020-03-28Use gun_test:init_origin/3 in the gun_SUITE:reply_to_* testsLoïc Hoguin
2020-03-28Make gun_SUITE:shutdown_reason test more reliableLoïc Hoguin
2020-03-28Make intermediaries return tls not tls_proxyLoïc Hoguin
Also add a test for CONNECT to TLS via 2 TLS proxies.
2020-03-28Use timetrap instead of normal timeouts in shutdown_SUITELoïc Hoguin
2020-03-28In gun_SUITE shutdown_reason case, don't match in receiveLoïc Hoguin
Match inside the clause instead. This should make clearer the occasional failure.
2020-03-27Use infinity timeout for gun:await in reply_to testsLoïc Hoguin
2020-03-27Don't explictly wait for the message in reply_to testsLoïc Hoguin
2020-03-27Split the gun_SUITE:reply_to test in two casesLoïc Hoguin
To attempt to fix a timetrap_timeout issue occuring sometimes. I have little confidence about this fixing anything but it will not hurt either.
2020-03-27Improve test timeout handling in gun_SUITELoïc Hoguin
Instead of timeouts, favor receiving events from the event handler gun_test_event_h. Remove most other timeouts in particular receive timeouts in favor of a Common Test timetrap timeout global to this test suite of 30 seconds.
2020-03-26Don't make the rfc6265bis test giver time outLoïc Hoguin
2020-03-26Fix IPv6 related changes to testsLoïc Hoguin
Turns out we can't rely on IPv4 being available if we set the socket in IPv6 mode. Instead the origin is modified to either setup IPv4 or IPv6 depending on the test's needs.
2020-03-25Fix host/:authority header when connecting to an IPv6 addressLoïc Hoguin
2020-03-23Tweak connection timeouts tests for WindowsLoïc Hoguin
It seems that the retry behavior changed recently. It would be better to retrieve the exact values and calculate how much time we want to wait but that will do for now.
2020-03-23Fix flow control test since it's more strict nowLoïc Hoguin
2020-03-12Make Gun use the cookie store when configured toLoïc Hoguin
2020-03-04Initial implementation of the gun_cookies cookie storeLoïc Hoguin
2020-02-27Use specific error when HTTP/2 receives HTTP/1 responseLoïc Hoguin
2020-02-27Add a test getting preface errors in the 'DOWN' reasonLoïc Hoguin
2020-02-27Detect invalid HTTP/2 preface errorsLoïc Hoguin
And make sure all HTTP/2 connection_error(s) result in a gun_down message containing the error. In the preface case we do not send a gun_error message (because there's no stream open yet) and gun_down was always saying normal. Also make sure the human readable reason is included in the gun_error message, if any.
2020-02-10Handle cow_http2_machine timeoutsLoïc Hoguin
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