Skip to content
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

Add proxy mapper hook. #9372

Merged
merged 5 commits into from
Jan 25, 2017
Merged

Add proxy mapper hook. #9372

merged 5 commits into from
Jan 25, 2017

Conversation

markdroth
Copy link
Member

I believe that this is the last piece we need before getting rid of the initial_connect_string hack.

Copy link
Contributor

@jboeuf jboeuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks much for the PR.

When this is integrated with #9383, I think that we should update the comments to indicate which channel args to use in the mapper (if we have to live with the fact that the proxy mapper cannot return a handshaker object which would be conceptually cleaner IMO.

bool grpc_proxy_mapper_map(grpc_exec_ctx* exec_ctx, grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about returning a (http_connect) handshaker object here?
It is unclear to me how the CONNECT request is going to be built after this call (based on which channel_args for example)? Returning a handshaker object would make the implementer of this API choose the shape of the CONNECT request (host + other headers).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, maybe at the time where this function is called, it is too late (or impractical) to insert a handshaker which would call indeed for the use for channel args.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent here is that the proxy mapper will set the channel args introduced in #9383 to trigger the use of HTTP CONNECT.

The main reason I didn't have the proxy mapper return a new handshaker is that it seemed redundant to have two different mechanisms to trigger the creation of handshakers. We've already got the handshaker factory mechanism to take care of that, and I think that mechanism is a more general solution, because there are cases where handshakers need to be added that having nothing to do with proxies (such as the security handshaker).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough.

/// Registers a new proxy mapper. Takes ownership.
/// If \a at_start is true, the new mapper will be at the beginning of
/// the list. Otherwise, it will be added to the end.
void grpc_proxy_mapper_register(bool at_start, grpc_proxy_mapper* mapper);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a strong use case for multiple proxy mappers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of a concrete use-case, but it's conceivable that someone could have a client that wants to talk to two different environments similar to cases 2 or 3 in the gRFC. It that case, it would make sense to have a different proxy mapper for each environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. OK that seems reasonable to me.

grpc_arg new_arg = grpc_create_subchannel_address_arg(addr);
grpc_resolved_address *new_address = NULL;
grpc_channel_args *new_args = NULL;
if (grpc_proxy_mappers_map(exec_ctx, addr, args->args, &new_address,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to insert an http connect handshaker here? It would basically avoid the manual parsing of HTTP CONNECT headers from channel args (see #9383).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my response above.

@markdroth
Copy link
Member Author

Known failures: #9124

@markdroth markdroth merged commit 6f690f3 into grpc:master Jan 25, 2017
@markdroth markdroth deleted the proxy_mapper branch January 25, 2017 18:42
@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants