aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
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-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-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-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
2019-05-08Add event_handler with init/connect_start/connect_endLoïc Hoguin
2019-04-26Add upgrade/ws tuples to gun:await/2,3,4Loïc Hoguin
2019-04-26Add specs to await functions, document error type betterLoïc Hoguin
2019-04-26Distinguish between error types in await functionsLoïc Hoguin
2019-04-26Rename owner_gone into owner_downLoïc Hoguin
2019-04-26Add the supervise option to start without supervisorLoïc Hoguin
2019-04-26No longer error out when the owner exitsLoïc Hoguin
No need to have the error repeated in the logs by the Gun process.
2019-04-25Fix Websocket upgrade host header when it's an IP addressSergey Tupchiy
2019-04-25Remove explicit call to dbg:start/0Alexander Mihajlovic
This fixes a bug in `gun` when trying to open 2 connections with tracing enabled. You can recreate it like so: > application:ensure_all_started(gun). > gun:open("localhost", 80, #{trace => true}). > gun:open("localhost", 80, #{trace => true}). The second call fails with a cause clause exception. You'll observe the same exception by: > dbg:start(). > dbg:start(). Ultimately this may be a bug in OTP, but since `dbg:start/0` is undocumented I'm inclined to give it the benefit of the doubt. Regardless, since the docs[1] clearly state that calling `dbg:tracer/0` is the proper way to start the default tracer message receiver, I argue that calling `dbg:start/0` is a bug in `gun`. [1]: http://erlang.org/doc/man/dbg.html
2019-04-24Fix Dialyzer warningsLoïc Hoguin
2019-04-24Prevent ssl:setopts from blocking gun_tls_proxyLoïc Hoguin
2019-04-22Use ssl:ssl_accept/2 in tests to support OTP 20+Loïc Hoguin
ssl:handshake/2 was introduced in OTP 21.
2019-04-22Add origin_scheme checks to testsLoïc Hoguin
2019-04-22Make gun_tls_proxy work for HTTP/2 connectionsLoïc Hoguin
2019-04-22Make gun_tls_proxy a gen_statemLoïc Hoguin
There is now a not_connected state that is used to postpone events that can't be processed when the proxy socket is not ready.
2019-04-19Integrate gun_tls_proxy into gun properLoïc Hoguin
Still need to add ALPN support and to wait before trying to send data on a proxied TLS connection that didn't complete its handshake.
2019-03-25Add the gun_tls_proxy transport for TLS over TLS supportLoïc Hoguin
2019-01-09Add function gun:stream_info/2Loïc Hoguin
2019-01-06Lowercase header names automatically and accept more typesLoïc Hoguin
Header names can now be provided as binary, string or atom and Gun no longer requires them to be in lowercase. The list of headers can also be provided as a map as well.
2019-01-06Fix KilledStreams value for HTTP for connection: close responsesLoïc Hoguin
2019-01-05Fix atom hostnamesLoïc Hoguin
2019-01-05Fix transfer-encoding precedence over content-lengthLoïc Hoguin