avantgardnerio commented on code in PR #2309:
URL: https://github.com/apache/arrow-rs/pull/2309#discussion_r937163249
##########
arrow-flight/src/sql/server.rs:
##########
@@ -285,31 +289,38 @@ where
async fn get_flight_info(
&self,
- request: Request<FlightDescriptor>,
+ tonic_request: Request<FlightDescriptor>,
) -> Result<Response<FlightInfo>, Status> {
- let request = request.into_inner();
+ println!("--- get_flight_info ---");
+ for md in tonic_request.metadata().iter() {
+ println!("{:?}", md);
+ }
+ let mut auth = None;
+ if let Some(md) = tonic_request.metadata().get("authorization") {
+ if let Ok(str) = md.to_str() {
+ let authorization = str.to_string();
+ let bearer = "Bearer ";
+ if authorization.starts_with(bearer) {
+ let authorization =
authorization[bearer.len()..].to_string();
+ auth = Some(authorization)
+ }
+ }
+ };
+ let request = tonic_request.into_inner();
let any: prost_types::Any =
prost::Message::decode(&*request.cmd).map_err(decode_error_to_status)?;
if any.is::<CommandStatementQuery>() {
- return self
- .get_flight_info_statement(
- any.unpack()
- .map_err(arrow_error_to_status)?
- .expect("unreachable"),
- request,
- )
- .await;
+ let token = any.unpack()
+ .map_err(arrow_error_to_status)?
+ .expect("unreachable");
Review Comment:
> passed the entire tonic metadata
I'm so glad you said that. It seems better to transparently proxy more of
this up... especially with how low-level the arrow-rs project is. It makes it
very hard to change things that span all three repos and release them in a
timely manner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]