Conversation
Signed-off-by: Jose Nino <jnino@lyft.com>
Signed-off-by: Jose Nino <jnino@lyft.com>
| const std::string BaseCluster = "base"; | ||
| const std::string BaseWlanCluster = "base_wlan"; | ||
| const std::string BaseWwanCluster = "base_wwan"; | ||
| const LowerCaseString H2UpstreamHeader{"x-envoy-mobile-upstream-protocol"}; |
There was a problem hiding this comment.
I propose simplifying this with a x-envoy-mobile-force-h2 header. If a header with this name is present assume inferred h2 support, if not, default to h1.
| enum class UpstreamHttpProtocol(internal val stringValue: String) { | ||
| HTTP1("http1"), | ||
| HTTP2("http2"), | ||
| } |
There was a problem hiding this comment.
Can drop this enum if we just use a single header to force h2 (which is sort of non-standard anyways and only works with known destinations).
goaway
left a comment
There was a problem hiding this comment.
Nice work! Some suggestions to simplify this a bit.
|
Another approach would be to have an engine-level configuration option that allows you to specify authorities for which you know you can force h2. In some ways I like that better than a per-request approach, since support for this functionality is non-standard and relatively uncommon, and it avoids inadvertently dispatching requests to destinations that don't support it. It's more a property of the destination ( That said, I'm okay with the per-request approach as well (it just means the application will have to implement its own whitelist). |
|
@goaway thanks for all the comments. I am answering to all of them in aggregate because I think they are all related. I had originally written this PR with that approach, and actually with something similar to what you suggest below re: central configuration. However, I moved to this approach for a few reasons:
Right now absence of the header defaults us to http1 per the implementation in the Http::Dispatcher::setDestinationCluster. I can do:
per your suggestion make this setting a less strong requirement. I think this brings us closer to the sentiment of making this engine-level configuration without having to wire more configuration through. lmk what you think. |
Signed-off-by: Jose Nino <jnino@lyft.com>
library/kotlin/test/io/envoyproxy/envoymobile/RequestMapperTest.kt
Outdated
Show resolved
Hide resolved
|
A couple comments based on the discussions above: 1 (enum vs bool): If http2 were to be the only protocol we need to differentiate going forward, I think a boolean would be fine. However, since http3 is coming in the near future and we probably don't want to make protocol negotiation a hard blocker or to make breaking changes to the interfaces being introduced here, an enum seems like it'd probably make sense. 2 (engine versus request): Adding this information on a per-request basis is a bit more in line with how other configurations are set up now in Envoy Mobile. We moved to the dynamic forward proxy so that we no longer have to specify a fixed set of domains when starting the library, and requiring an http2 whitelist up front when starting up seems like a step backwards as it doesn't allow for new http2 domains to be discovered without restarting the library (not currently supported). Allowing this information to be specified per-request as a builder seems reasonable, especially considering @junr03 is stripping all |
library/kotlin/test/io/envoyproxy/envoymobile/RequestBuilderTest.kt
Outdated
Show resolved
Hide resolved
|
@rebello95 sorry wasn't ready for a pass. I think I hit all your comments. Let me take a look |
Signed-off-by: Jose Nino <jnino@lyft.com>
|
|
||
| val result = mutableMapOf<String, List<String>>() | ||
| result.putAll(headers.filter { entry -> !entry.key.startsWith(":") }) | ||
| result.putAll(headers.filter { entry -> !(entry.key.startsWith(":") || entry.key.startsWith("x-envoy-mobile"))}) |
There was a problem hiding this comment.
Up to you but using this might be more readable: !entry.key.startsWith(":") && !entry.key.startsWith("x-envoy-mobile")
There was a problem hiding this comment.
I am always ambivalent about which one is more readable. I'll change to kick CI... 💩
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Description: this PR adds the ability to decide what protocol to use for upstream requests. Note that this will be unnecessary once ALPN works for upstream requests (#502)
Risk Level: low
Testing: updated unit tests
Docs Changes: updated docs
Fixes #679
Signed-off-by: Jose Nino jnino@lyft.com