linkerd2/proxy/tests/support
Sean McArthur c52385dd42
proxy: add HTTP/1.1 Upgrade support automatically (#1126)
Any HTTP/1.1 requests seen by the proxy will automatically set up
to prepare such that if the proxied responses agree to an upgrade,
the two connections will converted into a standard TCP proxy duplex.

Implementation
-----------------

This adds a new type, `transparency::Http11Upgrade`, which is a sort of rendezvous type for triggering HTTP/1.1 upgrades. In the h1 server service, if a request looks like an upgrade (`h1::wants_upgrade`), the request body is decorated with this new `Http11Upgrade` type. It is actually a pair, and so the second half is put into the request extensions, so that the h1 client service may look for it right before serialization. If it finds the half in the extensions, it decorates the *response* body with that half (if it looks like a response upgrade (`h1::is_upgrade`)).

The `HttpBody` type now has a `Drop` impl, which will look to see if its been decorated with an `Http11Upgrade` half. If so, it will check for hyper's new `Body::on_upgrade()` future, and insert that into the half. 

When both `Http11Upgrade` halves are dropped, its internal `Drop` will look to if both halves have supplied an upgrade. If so, the two `OnUpgrade` futures from hyper are joined on, and when they succeed, a `transparency::tcp::duplex()` future is created. This chain is spawned into the default executor.

The `drain::Watch` signal is carried along, to ensure upgraded connections still count towards active connections when the proxy wants to shutdown.

Closes #195
2018-06-20 16:41:43 -07:00
..
client.rs proxy: Upgrade Conduit to use the new version of Tokio (#944) 2018-05-17 16:38:15 -07:00
controller.rs proto: Add TLS identity to WeightedAddr message (#1041) 2018-05-31 11:48:25 -07:00
mod.rs proxy: add HTTP/1.1 Upgrade support automatically (#1126) 2018-06-20 16:41:43 -07:00
proxy.rs Abstract I/O interface into a trait. (#1020) 2018-05-26 10:04:31 -10:00
server.rs proxy: Upgrade Conduit to use the new version of Tokio (#944) 2018-05-17 16:38:15 -07:00
tcp.rs proxy: Upgrade Conduit to use the new version of Tokio (#944) 2018-05-17 16:38:15 -07:00