aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
AgeCommit message (Collapse)Author
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.
2020-10-19Fix cookies for tunnelsLoïc Hoguin
There are still small issues left to fix. In particular the set_cookie command should be replaced with doing the same in the protocol itself so that the scheme is correct. So CookieStore must be propagated to all callbacks.
2020-10-16Remove commented codeLoïc Hoguin
2020-10-16Remove the transport_changed eventLoïc Hoguin
It doesn't provide any new information compared to the other events.
2020-10-16Add or fix events inside or related to CONNECT tunnelsLoïc Hoguin
2020-10-07Include content_handlers in optsTomas Abrahamsson
2020-10-07Normalize headers in ws_upgraderinpatch
In the documentation headers passed to ws_upgrade are typed as gun:req_headers(), however if a map of headers is passed (which is allowed by the type), the gun process will crash when trying to operate on it as if it were a list.
2020-10-03Fix Dialyzer warningsLoïc Hoguin
2020-10-03Fix test suites failing due to previous breaking changesLoïc Hoguin
2020-10-03Add tunnel_SUITE testing all 3-layer combinationsLoïc Hoguin
The test suite is 216 tests with a tunnel created via two proxies leading to one origin server. The tests are for example socks5_h2_https where socks5 identifies the first SOCKS5 proxy, h2 the second HTTP/2 CONNECT proxy and https the secure HTTP/1.1 origin server. The test not only sets up the tunnel and does a request (or sends/receives data in the case of raw origin servers) but also confirms that the stream_info and info data is correct.
2020-09-21Fix compilation and Dialyzer warningsLoïc Hoguin
2020-09-21Initial success for h2 CONNECT -> https CONNECT -> httpsLoïc Hoguin
2020-09-21Add a gun:stream_ref() type and fix DialyzerLoïc Hoguin
2020-09-21Refactor protocol handling via gun_protocolsLoïc Hoguin
2020-09-21Replace gun_tunnel_up/3 message with /4 variantLoïc Hoguin
Also fixes all the tests. Lots of work remain around protocols (how best to pass the base stream_ref to them? maybe the current solution, maybe a new argument to Protocol:init) and strengthen the concept of stream_ref, at least with its own type.
2020-09-21Rename the 3-arity gun_socks_up to gun_tunnel_upLoïc Hoguin
2020-09-21Add gun_tunnel_up message to HTTP/2 CONNECTLoïc Hoguin
2020-09-21First working HTTPS over secure HTTP/2Loïc Hoguin
Has a timer:sleep/1 though because there is currently no way to wait for the TLS handshake to complete.
2020-09-21Make gun_socks_up stream-specific for HTTP/2 CONNECTLoïc Hoguin
2020-09-21Make HTTP/2 CONNECT to a SOCKS server workLoïc Hoguin
2020-09-21Add HTTP/2 CONNECT tests with Cowboy as originLoïc Hoguin
2020-09-21Add the base_stream_ref to gun_http/gun_http2Loïc Hoguin
2020-09-21Make gun:stream_info/2 return intermediaries for HTTP/2 CONNECTLoïc Hoguin
2020-09-21Initial HTTP/2 CONNECT implementationLoïc Hoguin
2020-04-16Add tests for cookie_ignore_informational optionLoïc Hoguin
2020-03-28Fix a Dialyzer warning introduced in the previous commitLoï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-25Fix crash in gun:info/1 when socket is closedLoïc Hoguin
The call to Transport:sockname/1 can return an error if the socket was closed as we were gathering info. In that case we simply do not fill in the address and port information.
2020-03-15Document the cookie store option and related modulesLoïc Hoguin
Also contains a few small changes and Dialyzer fixes.
2020-03-12Make Gun use the cookie store when configured toLoïc Hoguin
2020-02-10Handle cow_http2_machine timeoutsLoïc Hoguin
2019-10-08Fix retrying on disconnect with retry=1Loïc Hoguin
2019-09-26Document the cow_http2_machine optionsLoïc Hoguin
The details are not given for now. The best would be to document them in Cowlib and refer to that documentation instead of duplicating the information in both the Gun and Cowboy manuals.
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-23Set server_name_indication for TLS handshakesLoïc Hoguin
This essentially reverts to the old behavior for initial TLS handshakes, and improves TLS support for the Socks/HTTP proxy cases.
2019-09-23Accept all cow_http2_machine optionsLoïc Hoguin
2019-09-23Remove 'protocol' option from connect_destination()Loïc Hoguin
It was deprecated and replaced by 'protocols' in a previous version.
2019-09-22Cancel the existing keepalive when switching protocolsLoïc Hoguin
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-22Always switch_protocolLoïc Hoguin
When doing a CONNECT from http to http or from socks to socks we may want to use different configuration options. Switching the protocol explicitly helps us achieve that. It will also signal through events that a protocol switch occurred.
2019-09-22Rework state transitions resulting from from protocol changesLoïc Hoguin