-
Notifications
You must be signed in to change notification settings - Fork 182
feat: volo grpc https rpc ep #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What output can we expect to verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these all removed? I think it will break the previous normal usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary to_string()?
Motivation
Wrapper for core volo-grpc transport to use original endpoint directly, HTTPS ALPN rustls, example
Solution