-
Notifications
You must be signed in to change notification settings - Fork 73
Pass TLS connection context into Request #67
Comments
any consensus on how that should be implemented? i would prefer a service wouldn't be Cloned but instead reconstructed on every incoming connection with the connection passed as argument. impl server::Greeter<C> for Greet<C> {
pub fn new(c: C) -> Self
//..
let c: C = whateverYouWant();
let serve = h2.serve(sock, c); |
In general, this is what the extensions field on While manual for now, you should be able to do what you want by calling Does this work? |
Here's an example where we do something similar in Conduit: |
I'm going to close this, but feel free to post additional questions or let me know if you think there are remaining actionable items (and I can open it again). |
this sounds great, but tower_grpc::Request does not contain the http::Request so there's no way to get the extensions out |
I think it would be fine to include the extensions as part of the grpc request type. @olix0r @seanmonstar Thoughts? |
Yep, seems simple enough to stick them inside |
So, we're suggesting that |
@aep is this something you want to contribute? |
can do later :) |
possibly related: hyperium/hyper#1594 |
Relates to: tower-rs/tower#108 |
@carllerche @aep is this something being worked on? It's not clear to me if the recommended implementation is supposed to get the http::Request's extensions into the tower_grpc::Request or somehow wraps up the MakeService functionality in hyper. I was using grpc-rs for some prototyping but given the recent blog post about a possible switch to tower-grpc I'm interested in experimenting with tower. I too need the TLS client certificate information available to my grpc services. An older implementation using Cap'n Proto is here. I'm still wrapping my head around tower-grpc/h2's design but I believe I could contribute the changes necessary to support my use case; I just need some guidance. |
I implemented an example of what I wanted to do but I didn't need to modify tower-grpc to do it. However, there's a significant difference in how I create a Server per-connection instead of using one server for all connections. Maybe that's what I'm supposed to be doing here though? It does make sense to me to put the client session information into the Server instance instead of passing it into each request as was suggested. I can clean up my TLS example if you think it's a good starting point for showing how to get TLS session information into the GRPC request handing. |
currently in the connection handler we just call tower_h2::Server::serve(socket)
it would be useful if there was a way to pass metadata to that call that is later available in Request
specifically i'd like to give it the client certificate
The text was updated successfully, but these errors were encountered: