linkerd2-proxy/proxy
Eliza Weisman d2c8d588e6 Enforce that requests are mapped to connections for each Host: header values (#492)
This PR ensures that the mapping of requests to outbound connections is segregated by `Host:` header values. In most cases, the desired behavior is provided by Hyper's connection pooling. However, Hyper does not handle the case where a request had no `Host:` header and the request URI had no authority part, and the request was routed based on the SO_ORIGINAL_DST in the desired manner. We would like these requests to each have their own outbound connection, but Hyper will reuse the same connection for such requests. 

Therefore, I have modified `conduit_proxy_router::Recognize` to allow implementations of `Recognize` to indicate whether the service for a given key can be cached, and to only cache the service when it is marked as cachable. I've also changed the `reconstruct_uri` function, which rewrites HTTP/1 requests, to mark when a request had no authority and no `Host:` header, and the authority was rewritten to be the request's ORIGINAL_DST. When this is the case, the `Recognize` implementations for `Inbound` and `Outbound` will mark these requests as non-cachable.

I've also added unit tests ensuring that A, connections are created per `Host:` header, and B, that requests with no `Host:` header each create a new connection. The first test passes without any additional changes, but the second only passes on this branch. The tests were added in PR #489, but this branch supersedes that branch.

Fixes #415. Closes #489.
2018-03-06 16:44:14 -08:00
..
convert Prepare for the v0.3.0 release (#406) 2018-02-21 11:14:11 -08:00
futures-mpsc-lossy Prepare for the v0.3.0 release (#406) 2018-02-21 11:14:11 -08:00
router Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00
src Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00
tests Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00
Cargo.toml Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00