aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)Author
2025-04-09Catch post-handshake TLS 1.3 alertsLoïc Hoguin
When TLS 1.3 is used and `fail_if_no_peer_cert` (or equivalent) is configured on the server, such as in mTLS scenarios, and the client certificate is missing or invalid, the TLS 1.3 alert will be sent after the handshake has completed. The same is true for post-handshake authentication in TLS 1.3 which Erlang/OTP doesn't yet support, but will at some point in the future. Due to the asynchronous nature of some `ssl` socket operations, such as sending, the alert may not always be returned from a socket call. When the ssl socket is active we would receive it as a message instead, so when Gun gets `{error,closed}` it must look for the active message and see if an alert occurred. When the ssl socket is passive we don't, so we must query the socket for it (trying to set the socket active at that point gets us the alert in the return value). There is a span between handshake and the initial active mode set where the socket is passive and may send data (the HTTP/2 preface) so we must account for both cases. Because we sometimes have to wait for the alert as a message, and we don't want to wait for a very long time (200ms), we sometimes may lose the alert. Perhaps in the future this wait time can be made configurable for users that really require getting the alert. The tests are only enabled on Linux because other OSes have intermittent failures (likely due to timing).
2025-03-28Reject Websocket frames sent over HTTPLoïc Hoguin
2025-03-26Default the origin authority to "localhost" for unix socketsLoïc Hoguin
Otherwise garbage gets sent.
2025-03-26Remove copyright years from all files except LICENSELoïc Hoguin
2025-03-26Better identify ping errors and test the HTTP/1.1 oneLoïc Hoguin
2025-03-26Implement user pings for tunnelsLoïc Hoguin
2025-03-21Add gun:ping/2,3 for user-initiated ping for HTTP/2Viktor Söderqvist
Signed-off-by: Viktor Söderqvist <[email protected]>
2025-03-21Respect remote concurrency limit for headers/connect/ws_upgraderespect-remote-concurrency-limitLoïc Hoguin
In order to simplify the implementation the CookieStore is given to the connect function now, even though it's not currently used.
2025-03-18HTTP/2: Respect remote MAX_CONCURRENT_STREAMSViktor Söderqvist
If the limit has been reached, new requests are failed immediately, so that the application can retry them on a different connection. Co-authored-by: Björn Svensson <[email protected]>
2025-02-27Do not ignore data received immediately after switching to rawDenys Knertser
LH: Minor tweaks.
2025-02-26Allow specifying functions for reply_toViktor Söderqvist
LH: I have fixed types, extended tests and tweaked a bit.
2025-02-25Improve graceful_shutdown_goaway_no_error test reliabilityLoïc Hoguin
2025-02-25Send NO_ERROR in client-initiated graceful shutdownViktor Söderqvist
2025-02-25Add state_name field to gun:info/1Viktor Söderqvist
2025-01-13Increase the ping loop in send_errors_SUITELoïc Hoguin
2025-01-13Increase another send_errors timeoutLoïc Hoguin
2025-01-13Increase a send_errors test timeoutLoïc Hoguin
Depending on the environment the send buffer may not be configured as low as we want, so the test will take longer.
2024-03-14Use public_key:cacerts_get/0 when possibleLoïc Hoguin
Also "fix" many TLS test failures due to yet more changes in the default options for TLS. Also small changes to make Dialyzer happy.
2023-06-05Fix crash when TLS connection closes very earlyLoïc Hoguin
And ensure that we don't infinite loop when retries are enabled, by decrementing the retry count instead of using a new one. Also check for ssl:negotiated_protocol {error,closed} which was possible but was not documented in OTP before this change. Thanks @voluntas for the help.
2023-01-23Update copyright lines in preparation for releaseLoïc Hoguin
2023-01-23Fix intermittent error in stream_info_http testLoïc Hoguin
2023-01-23Selective receive in test to avoid receiving wrong messageLoïc Hoguin
2023-01-23Linger a little at the end of a shutdown test connectionLoïc Hoguin
This is to avoid the TCP close eating data.
2023-01-23Increase times by factor 10 to fix timing issueViktor Söderqvist
2023-01-09Tweak some test outputsLoïc Hoguin
2023-01-09Skip degraded configuration test on WindowsLoïc Hoguin
2022-12-06Add keepalive_tolerance http2 optionViktor Söderqvist
The number of unacknowledged pings that can be tolerated before the connection is forcefully closed. When a keepalive ping is sent to the peer, a counter is incremented and if this counter exceeds the tolerance limit, the connection is forcefully closed. The counter is decremented whenever a ping ack is received from the peer. By default, the mechanism for closing the connection based on ping and ping ack is disabled. Loïc Hoguin: I have edited a lot of the code and renamed a few things as well as simplified the docs and increased test timeouts to avoid race conditions.
2022-12-05Add tests for ws subprotocol negotiationViktor Söderqvist
2022-11-21Don't infinite loop gun_pool on bad configurationLoïc Hoguin
We leave the pool in a degraded state if the configuration given is invalid and a lookup/connect can't be made.
2022-11-21Support positive HTTP/1.0 responses to CONNECT requestsLoïc Hoguin
2022-11-14Implement gun_raw:down/1, gun_raw:update_flow/4Denys Knertser
Loïc: I have reworded a couple things and reordered the tests. It would be great to also test these things over proxies.
2022-11-08Include Websocket StreamRef in gun_down messagesWei Huang
2022-10-24Handle send errorsViktor Söderqvist
2022-10-11Update tests for OTP-25+Loïc Hoguin
2022-09-12Silence certs related ssl warnings in test suitesLoïc Hoguin
2022-09-12Update cookie tests against latest WPTLoïc Hoguin
The http-state tests were removed and replaced with tests in HTML pages. I have devised a way to semi- automatically import them and test them. Additional fixes were made following changes in the rfc6265bis draft.
2022-08-30Add tests for the SSE handlerBenedikt Reinartz
2022-03-08Add a test for HTTP/2 empty DATA frame with fin setLoïc Hoguin
2022-03-08Handle any zero-sized Data in http:data with finMartin Björklund
Amended to make the test case hit the problem.
2022-03-08Add tests for SNILoïc Hoguin
2021-02-09Fix gun_pool:stop_pool/2,3 with default portLoïc Hoguin
2021-02-08No longer use ssl:ssl_accept/2Loïc Hoguin
2021-02-07Initial commit for Gun poolsLoïc Hoguin
The approach taken here is very similar to what browsers are doing. A separate pool is created for each host/port/scope. The authority (host header) is used to determine which pool will execute requests. A connection process is semi-randomly chosen, from the connections that have capacity. Maximum capacity is determined by the protocol (the HTTP/2 setting set by the server is used, for example). Multiple processes can process requests/responses on the same connection concurrently. There is no need to "give back" the response to the pool, the number of ongoing streams is maintained via an event handler. The implementation is currently not strict, there may be more attempts to create requests than there is capacity. I'm not sure if it should be made strict or if Gun should just wait before sending requests (it only matters in the HTTP/2 case at the moment). When there is no connection with capacity available in the pool (because they have too many streams, or are reconnecting, or any other reason), checking out fails. There is no timeout to wait for a connection to be available. On the other hand the checkout_retry option allows setting multiple timeouts to retry checking out a connection. Each retry attempt's wait time can have a different value. The initial implementation of this work was sponsored by Kobil and made at the suggestion of Ilya Khaprov.
2020-11-12Reset host/port/scheme/transport/intermediaries on disconnectLoïc Hoguin
I've made some more test timeouts infinity in order to fix additional intermittent issues that popped up.
2020-11-12Return 'undefined' for raw|socks origin_scheme where applicableLoïc Hoguin
2020-11-12Fail fast while closing if reconnect is offViktor Söderqvist
If a request/headers/connect/ws_upgrade is created when a connection is in state 'closing', such as after receiving an HTTP/2 GOAWAY frame or an HTTP/1.1 "Connection: close" header, an error message is sent back to the caller immediately, if reconnect is off (that is if the option retry is set to 0). This allows an application to retry the request on another connection without waiting for all streams on the current connection to complete.
2020-11-12Update copyright yearsLoïc Hoguin
2020-11-12Replace gun:ws_send/2 with gun:ws_send/3Loïc Hoguin
Switching from /2 to /3 should be easy enough. Also update the documentation about HTTP/2 Websocket support.
2020-11-12Add more new keys to gun:info and gun:stream_info manualsLoïc Hoguin
2020-11-09Update source path for test tool h2specdBjorn Svensson
The main source file for the test tool h2specd was moved a time ago, but correct one is used now. Also make sure that gun sends the GOAWAY directly to avoid timing issues in test 6.9.1 in h2specd_SUITE.