aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2024-03-26Initial HTTP/3 implementationHEADmasterhttp3Loïc Hoguin
Since quicer, which provides the QUIC implementation, is a NIF, Gun cannot depend directly on it. In order to enable QUIC and HTTP/3, users have to set the GUN_QUICER environment variable: export GUN_QUICER=1 Gun is now tested using GitHub Actions. As a result OTP-24+ is now required. In addition, the number of OTP releases tested has been reduced; only the latest of each major version is now tested. This also updates Erlang.mk.
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.
2024-03-14Remove client_preferred_next_protocolsViktor Söderqvist
2024-03-14Update Cowlib to 2.13.0Loïc Hoguin
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 public domain suffix listLoïc Hoguin
2023-01-23Update copyright lines in preparation for releaseLoïc Hoguin
2022-12-12macOS: Error out on eaddrnotavail instead of retryingLoïc Hoguin
This is to avoid reconnecting forever in a loop on bad configuration (such as IP in a different subnet).
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-05Document Websocket subprotocol negotiationLoïc Hoguin
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-21Enable send timeouts by defaultLoïc Hoguin
When no TCP options are provided, Gun will enable send timeouts at 15s. The value was chosen large enough to be safe while still allowing Gun to detect send errors eventually. Different applications may need to tweak and lower this value.
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-24Cookies: default SameSite is now "Default", not "None"Loïc Hoguin
2022-10-24Also flush gun_tunnel_upLed
2022-10-24Handle send errorsViktor Söderqvist
2022-10-11Make many gun_http2 functions return state or error tupleViktor Söderqvist
The following functions used to return a state, but now return {state, State} or {error, Reason}: * frame/5 * update_window/1,2 * maybe_ack_or_notify/2 * reset_stream/3 * push_promise_frame/7 * goaway/2 * maybe_send_data/6 * send_data/4 * send_data/6 * send_data_frame/4 Dialyzer will temporarily fail until functions start to return error tuples.
2022-09-19Handle of HTTP/2 tunnel errorsLoïc Hoguin
2022-09-12Add close/1 to gun_tls_proxy_cb to avoid undef crashesLoï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-30Ignore parameters for text/event-streamBenedikt Reinartz
2022-08-30Make Protocol:init/4 return an ok-tupleViktor Söderqvist
This is a preparation for allowing init/4 to return an ok or an error tuple.
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-08Don't add default SNI if already setJohan Bevemyr
2022-03-08gun_pool Dialyzer fixesSergei Shuvatov
2022-03-08Fix flushing by stream referenceSergei Shuvatov
2022-03-08Make the stream_error_* functions return 'ok'Viktor Söderqvist
This will make it more obvious what callbacks return.
2022-03-08Return commands instead of state in remaining callbacksViktor Söderqvist
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-08Fix type that breaks gun_pool compilationLoï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-12Fix a low hanging fruit todoLoï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-12Review and remove many todosLoïc Hoguin
HTTP/1.1 Upgrade to HTTP/2 will not be implemented. There are discussions for this functionality to be removed from the HTTP/2 spec. HTTP/1.1 Upgrade to TLS will most likely not be implemented.
2020-11-12Remove an unused key from the internal tunnel_info()Loïc Hoguin
2020-11-12Use gun:stream_ref() where applicableLoïc Hoguin
2020-11-12Enable optional0042 cookie testLoïc Hoguin
Cowlib master has the fix for this test. Temporarily depend on Cowlib master until a release is made.
2020-11-09Add the gun_event manualLoïc Hoguin
2020-11-06Make CONNECT responses produce a response_end eventLoïc Hoguin
While the stream has not ended, the response has.
2020-11-06Fix IsFin mismatch in HTTP/2 CONNECT responseLoïc Hoguin
The response ends when the tunnel is established, even if the stream itself does not. The data coming in on the stream after is not part of the response. This makes both HTTP/1.1 and HTTP/2 send 'fin' to successful CONNECT responses.
2020-11-02Initial implementation of Websocket over HTTP/2http2-websocketLoïc Hoguin
2020-10-21Fix cookie handling when tunnel and origin schemes mismatchLoïc Hoguin
The cookie_ignore_informational has been moved to http_opts and http2_opts. Also fix an issue when using 'protocols' in gun:open. When connecting via TLS the protocol's options were discarded.
2020-10-20Disconnect when setopts returns an errorViktor Söderqvist
There is a race condition: After receiving data, before setting the socket back to {active, once}, the server may have closed the socket or an error may have occurred. Since the socket was in passive mode, no message is received. Handling the return value of setopts solves the issue. Amended by Loïc Hoguin to handle the return value from the active/1 function call.