Conversation
feat: volo-grpc transport uri extension
|
Flocky volo-http test result fail due to HTTPBIN responded with HTML |
| }); | ||
|
|
||
| let resp = client.list_app_gateways(req).await; | ||
| println!("resp = {:#?}", resp); |
There was a problem hiding this comment.
What output can we expect to verify?
There was a problem hiding this comment.
This one expect a gRPC status application level error, unauthorized - but that passes the gRPC deserialization
| req.headers_mut() | ||
| .insert(ACCEPT, HeaderValue::from_static("application/grpc")); |
There was a problem hiding this comment.
Implementation specific, I think it can be optional
| let authority = uri.authority().expect("authority required").as_str(); | ||
| let target: Address = match uri.scheme_str() { | ||
| Some("http") => Address::Ip(authority.parse::<SocketAddr>().map_err(|_| { | ||
| io::Error::new( | ||
| io::ErrorKind::InvalidInput, | ||
| "authority must be valid SocketAddr", | ||
| ) | ||
| })?), | ||
| #[cfg(target_family = "unix")] | ||
| Some("http+unix") => { | ||
| use hex::FromHex; | ||
|
|
||
| let bytes = Vec::from_hex(authority).map_err(|_| { | ||
| io::Error::new( | ||
| io::ErrorKind::InvalidInput, | ||
| "authority must be hex-encoded path", | ||
| ) | ||
| })?; | ||
| Address::Unix(UnixSocketAddr::from_pathname( | ||
| String::from_utf8(bytes).map_err(|_| { | ||
| io::Error::new( | ||
| io::ErrorKind::InvalidInput, | ||
| "authority must be valid UTF-8", | ||
| ) | ||
| })?, | ||
| )?) | ||
| } | ||
| _ => unimplemented!(), | ||
| }; | ||
|
|
There was a problem hiding this comment.
Why are these all removed? I think it will break the previous normal usage.
There was a problem hiding this comment.
Given that the connect transport is not exported, I'd say that nobody uses it besides volo-grpc client transport https://github.com/ii64/volo/blob/e4730223f692fdcd8a7b9c487fa9739378c125c3/volo-grpc/src/transport/mod.rs#L7
I understand that we need to encode the Address as hyper compatible connector only support http::Uri param, but since this connector never gets exported and that directly used by the volo-grpc client transport I think it is safe to assume that passing the Address via Future task local would work, that also eliminate the need to reencode Address on transport inter-call (Address -> http::Uri -> Address)
There was a problem hiding this comment.
Get it, but we can still keep it as fallback if we don't get it from ADDRESS_HINT? we still have the Address -> http::Uri cost right now?
There was a problem hiding this comment.
I think maybe we can add some comments here to explain the reason, or we may not remember the reason in the future.
| let scheme = if self.tls { "https" } else { "http" }; | ||
| let authority = match (scheme, self.port) { | ||
| ("https", 443) | ("http", 80) => self.host.to_string(), | ||
| _ => format!("{}:{}", self.host.to_string(), self.port), |
Motivation
Wrapper for core volo-grpc transport to use original endpoint directly, HTTPS ALPN rustls, example
Solution