Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2016, Google Inc. |
| 4 | * All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions are |
| 8 | * met: |
| 9 | * |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following disclaimer |
| 14 | * in the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * * Neither the name of Google Inc. nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | */ |
| 33 | |
Mark D. Roth | 0a05ab6 | 2016-08-04 13:10:13 -0700 | [diff] [blame] | 34 | #include "src/core/ext/client_config/http_connect_handshaker.h" |
| 35 | |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 36 | #include <string.h> |
| 37 | |
| 38 | #include <grpc/impl/codegen/alloc.h> |
| 39 | #include <grpc/impl/codegen/log.h> |
Mark D. Roth | 77613b2 | 2016-07-22 09:41:10 -0700 | [diff] [blame] | 40 | #include <grpc/impl/codegen/slice_buffer.h> |
| 41 | #include <grpc/support/string_util.h> |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 42 | |
Mark D. Roth | 39b5871 | 2016-09-06 12:50:42 -0700 | [diff] [blame^] | 43 | #include "src/core/ext/client_config/uri_parser.h" |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 44 | #include "src/core/lib/http/format_request.h" |
| 45 | #include "src/core/lib/http/parser.h" |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 46 | #include "src/core/lib/iomgr/timer.h" |
Mark D. Roth | 39b5871 | 2016-09-06 12:50:42 -0700 | [diff] [blame^] | 47 | #include "src/core/lib/support/env.h" |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 48 | |
| 49 | typedef struct http_connect_handshaker { |
| 50 | // Base class. Must be first. |
| 51 | grpc_handshaker base; |
| 52 | |
Mark D. Roth | 77613b2 | 2016-07-22 09:41:10 -0700 | [diff] [blame] | 53 | char* proxy_server; |
Mark D. Roth | e273b03 | 2016-07-22 13:24:21 -0700 | [diff] [blame] | 54 | char* server_name; |
Mark D. Roth | 77613b2 | 2016-07-22 09:41:10 -0700 | [diff] [blame] | 55 | |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 56 | // State saved while performing the handshake. |
| 57 | grpc_endpoint* endpoint; |
| 58 | grpc_channel_args* args; |
| 59 | grpc_handshaker_done_cb cb; |
| 60 | void* user_data; |
| 61 | |
| 62 | // Objects for processing the HTTP CONNECT request and response. |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 63 | gpr_slice_buffer write_buffer; |
Mark D. Roth | a47a246 | 2016-08-11 09:02:30 -0700 | [diff] [blame] | 64 | gpr_slice_buffer* read_buffer; // Ownership passes through this object. |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 65 | grpc_closure request_done_closure; |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 66 | grpc_closure response_read_closure; |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 67 | grpc_http_parser http_parser; |
| 68 | grpc_http_response http_response; |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 69 | grpc_timer timeout_timer; |
| 70 | |
| 71 | gpr_refcount refcount; |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 72 | } http_connect_handshaker; |
| 73 | |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 74 | // Unref and clean up handshaker. |
| 75 | static void http_connect_handshaker_unref(http_connect_handshaker* handshaker) { |
| 76 | if (gpr_unref(&handshaker->refcount)) { |
| 77 | gpr_free(handshaker->proxy_server); |
| 78 | gpr_free(handshaker->server_name); |
| 79 | gpr_slice_buffer_destroy(&handshaker->write_buffer); |
| 80 | grpc_http_parser_destroy(&handshaker->http_parser); |
| 81 | grpc_http_response_destroy(&handshaker->http_response); |
| 82 | gpr_free(handshaker); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // Callback invoked when deadline is exceeded. |
| 87 | static void on_timeout(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { |
| 88 | http_connect_handshaker* handshaker = arg; |
Mark D. Roth | a47a246 | 2016-08-11 09:02:30 -0700 | [diff] [blame] | 89 | if (error == GRPC_ERROR_NONE) { // Timer fired, rather than being cancelled. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 90 | grpc_endpoint_shutdown(exec_ctx, handshaker->endpoint); |
Mark D. Roth | a47a246 | 2016-08-11 09:02:30 -0700 | [diff] [blame] | 91 | } |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 92 | http_connect_handshaker_unref(handshaker); |
| 93 | } |
| 94 | |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 95 | // Callback invoked when finished writing HTTP CONNECT request. |
| 96 | static void on_write_done(grpc_exec_ctx* exec_ctx, void* arg, |
| 97 | grpc_error* error) { |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 98 | http_connect_handshaker* handshaker = arg; |
Mark D. Roth | 28ea7e2 | 2016-07-25 11:06:22 -0700 | [diff] [blame] | 99 | if (error != GRPC_ERROR_NONE) { |
| 100 | // If the write failed, invoke the callback immediately with the error. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 101 | handshaker->cb(exec_ctx, handshaker->endpoint, handshaker->args, |
| 102 | handshaker->read_buffer, handshaker->user_data, |
| 103 | GRPC_ERROR_REF(error)); |
Mark D. Roth | 28ea7e2 | 2016-07-25 11:06:22 -0700 | [diff] [blame] | 104 | } else { |
| 105 | // Otherwise, read the response. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 106 | grpc_endpoint_read(exec_ctx, handshaker->endpoint, handshaker->read_buffer, |
| 107 | &handshaker->response_read_closure); |
Mark D. Roth | 28ea7e2 | 2016-07-25 11:06:22 -0700 | [diff] [blame] | 108 | } |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 109 | } |
| 110 | |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 111 | // Callback invoked for reading HTTP CONNECT response. |
| 112 | static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg, |
| 113 | grpc_error* error) { |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 114 | http_connect_handshaker* handshaker = arg; |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 115 | if (error != GRPC_ERROR_NONE) { |
| 116 | GRPC_ERROR_REF(error); // Take ref to pass to the handshake-done callback. |
| 117 | goto done; |
| 118 | } |
| 119 | // Add buffer to parser. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 120 | for (size_t i = 0; i < handshaker->read_buffer->count; ++i) { |
| 121 | if (GPR_SLICE_LENGTH(handshaker->read_buffer->slices[i]) > 0) { |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 122 | size_t body_start_offset = 0; |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 123 | error = grpc_http_parser_parse(&handshaker->http_parser, |
| 124 | handshaker->read_buffer->slices[i], |
Mark D. Roth | 0a05ab6 | 2016-08-04 13:10:13 -0700 | [diff] [blame] | 125 | &body_start_offset); |
| 126 | if (error != GRPC_ERROR_NONE) goto done; |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 127 | if (handshaker->http_parser.state == GRPC_HTTP_BODY) { |
| 128 | // We've gotten back a successul response, so stop the timeout timer. |
| 129 | grpc_timer_cancel(exec_ctx, &handshaker->timeout_timer); |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 130 | // Remove the data we've already read from the read buffer, |
| 131 | // leaving only the leftover bytes (if any). |
| 132 | gpr_slice_buffer tmp_buffer; |
| 133 | gpr_slice_buffer_init(&tmp_buffer); |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 134 | if (body_start_offset < |
| 135 | GPR_SLICE_LENGTH(handshaker->read_buffer->slices[i])) { |
| 136 | gpr_slice_buffer_add( |
| 137 | &tmp_buffer, |
| 138 | gpr_slice_split_tail(&handshaker->read_buffer->slices[i], |
| 139 | body_start_offset)); |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 140 | } |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 141 | gpr_slice_buffer_addn(&tmp_buffer, |
| 142 | &handshaker->read_buffer->slices[i + 1], |
| 143 | handshaker->read_buffer->count - i - 1); |
| 144 | gpr_slice_buffer_swap(handshaker->read_buffer, &tmp_buffer); |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 145 | gpr_slice_buffer_destroy(&tmp_buffer); |
| 146 | break; |
| 147 | } |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 148 | } |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 149 | } |
| 150 | // If we're not done reading the response, read more data. |
| 151 | // TODO(roth): In practice, I suspect that the response to a CONNECT |
| 152 | // request will never include a body, in which case this check is |
| 153 | // sufficient. However, the language of RFC-2817 doesn't explicitly |
| 154 | // forbid the response from including a body. If there is a body, |
| 155 | // it's possible that we might have parsed part but not all of the |
| 156 | // body, in which case this check will cause us to fail to parse the |
| 157 | // remainder of the body. If that ever becomes an issue, we may |
| 158 | // need to fix the HTTP parser to understand when the body is |
| 159 | // complete (e.g., handling chunked transfer encoding or looking |
| 160 | // at the Content-Length: header). |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 161 | if (handshaker->http_parser.state != GRPC_HTTP_BODY) { |
| 162 | gpr_slice_buffer_reset_and_unref(handshaker->read_buffer); |
| 163 | grpc_endpoint_read(exec_ctx, handshaker->endpoint, handshaker->read_buffer, |
| 164 | &handshaker->response_read_closure); |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 165 | return; |
| 166 | } |
| 167 | // Make sure we got a 2xx response. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 168 | if (handshaker->http_response.status < 200 || |
| 169 | handshaker->http_response.status >= 300) { |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 170 | char* msg; |
| 171 | gpr_asprintf(&msg, "HTTP proxy returned response code %d", |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 172 | handshaker->http_response.status); |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 173 | error = GRPC_ERROR_CREATE(msg); |
| 174 | gpr_free(msg); |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 175 | } |
Mark D. Roth | 0a05ab6 | 2016-08-04 13:10:13 -0700 | [diff] [blame] | 176 | done: |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 177 | // Invoke handshake-done callback. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 178 | handshaker->cb(exec_ctx, handshaker->endpoint, handshaker->args, |
| 179 | handshaker->read_buffer, handshaker->user_data, error); |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 180 | } |
| 181 | |
Mark D. Roth | 9136bb1 | 2016-07-21 09:52:12 -0700 | [diff] [blame] | 182 | // |
| 183 | // Public handshaker methods |
| 184 | // |
| 185 | |
| 186 | static void http_connect_handshaker_destroy(grpc_exec_ctx* exec_ctx, |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 187 | grpc_handshaker* handshaker_in) { |
| 188 | http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in; |
| 189 | http_connect_handshaker_unref(handshaker); |
Mark D. Roth | 9136bb1 | 2016-07-21 09:52:12 -0700 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | static void http_connect_handshaker_shutdown(grpc_exec_ctx* exec_ctx, |
Mark D. Roth | 0a05ab6 | 2016-08-04 13:10:13 -0700 | [diff] [blame] | 193 | grpc_handshaker* handshaker) {} |
Mark D. Roth | 9136bb1 | 2016-07-21 09:52:12 -0700 | [diff] [blame] | 194 | |
| 195 | static void http_connect_handshaker_do_handshake( |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 196 | grpc_exec_ctx* exec_ctx, grpc_handshaker* handshaker_in, |
Mark D. Roth | 714c7ec | 2016-08-04 12:58:16 -0700 | [diff] [blame] | 197 | grpc_endpoint* endpoint, grpc_channel_args* args, |
| 198 | gpr_slice_buffer* read_buffer, gpr_timespec deadline, |
Mark D. Roth | 9136bb1 | 2016-07-21 09:52:12 -0700 | [diff] [blame] | 199 | grpc_tcp_server_acceptor* acceptor, grpc_handshaker_done_cb cb, |
| 200 | void* user_data) { |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 201 | http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in; |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 202 | // Save state in the handshaker object. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 203 | handshaker->endpoint = endpoint; |
| 204 | handshaker->args = args; |
| 205 | handshaker->cb = cb; |
| 206 | handshaker->user_data = user_data; |
| 207 | handshaker->read_buffer = read_buffer; |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 208 | // Send HTTP CONNECT request. |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 209 | gpr_log(GPR_INFO, "Connecting to server %s via HTTP proxy %s", |
| 210 | handshaker->server_name, handshaker->proxy_server); |
Mark D. Roth | f725019 | 2016-07-22 08:06:09 -0700 | [diff] [blame] | 211 | grpc_httpcli_request request; |
| 212 | memset(&request, 0, sizeof(request)); |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 213 | request.host = handshaker->proxy_server; |
Mark D. Roth | b954df1 | 2016-08-01 09:53:52 -0700 | [diff] [blame] | 214 | request.http.method = "CONNECT"; |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 215 | request.http.path = handshaker->server_name; |
Mark D. Roth | 77613b2 | 2016-07-22 09:41:10 -0700 | [diff] [blame] | 216 | request.handshaker = &grpc_httpcli_plaintext; |
| 217 | gpr_slice request_slice = grpc_httpcli_format_connect_request(&request); |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 218 | gpr_slice_buffer_add(&handshaker->write_buffer, request_slice); |
| 219 | grpc_endpoint_write(exec_ctx, endpoint, &handshaker->write_buffer, |
| 220 | &handshaker->request_done_closure); |
| 221 | // Set timeout timer. The timer gets a reference to the handshaker. |
| 222 | gpr_ref(&handshaker->refcount); |
| 223 | grpc_timer_init(exec_ctx, &handshaker->timeout_timer, |
| 224 | gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), |
| 225 | on_timeout, handshaker, gpr_now(GPR_CLOCK_MONOTONIC)); |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | static const struct grpc_handshaker_vtable http_connect_handshaker_vtable = { |
| 229 | http_connect_handshaker_destroy, http_connect_handshaker_shutdown, |
| 230 | http_connect_handshaker_do_handshake}; |
| 231 | |
Mark D. Roth | 28ea7e2 | 2016-07-25 11:06:22 -0700 | [diff] [blame] | 232 | grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server, |
| 233 | const char* server_name) { |
| 234 | GPR_ASSERT(proxy_server != NULL); |
| 235 | GPR_ASSERT(server_name != NULL); |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 236 | http_connect_handshaker* handshaker = |
| 237 | gpr_malloc(sizeof(http_connect_handshaker)); |
| 238 | memset(handshaker, 0, sizeof(*handshaker)); |
Mark D. Roth | 77613b2 | 2016-07-22 09:41:10 -0700 | [diff] [blame] | 239 | grpc_handshaker_init(&http_connect_handshaker_vtable, &handshaker->base); |
Mark D. Roth | 28ea7e2 | 2016-07-25 11:06:22 -0700 | [diff] [blame] | 240 | handshaker->proxy_server = gpr_strdup(proxy_server); |
| 241 | handshaker->server_name = gpr_strdup(server_name); |
Mark D. Roth | 5b4768f | 2016-08-04 13:41:46 -0700 | [diff] [blame] | 242 | gpr_slice_buffer_init(&handshaker->write_buffer); |
| 243 | grpc_closure_init(&handshaker->request_done_closure, on_write_done, |
| 244 | handshaker); |
| 245 | grpc_closure_init(&handshaker->response_read_closure, on_read_done, |
| 246 | handshaker); |
| 247 | grpc_http_parser_init(&handshaker->http_parser, GRPC_HTTP_RESPONSE, |
| 248 | &handshaker->http_response); |
| 249 | gpr_ref_init(&handshaker->refcount, 1); |
Mark D. Roth | a47a246 | 2016-08-11 09:02:30 -0700 | [diff] [blame] | 250 | return &handshaker->base; |
Mark D. Roth | 4623e1c | 2016-07-18 14:09:18 -0700 | [diff] [blame] | 251 | } |
Mark D. Roth | 39b5871 | 2016-09-06 12:50:42 -0700 | [diff] [blame^] | 252 | |
| 253 | char* grpc_get_http_proxy_server() { |
| 254 | char* uri_str = gpr_getenv("http_proxy"); |
| 255 | if (uri_str == NULL) return NULL; |
| 256 | grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */); |
| 257 | char* proxy_name = NULL; |
| 258 | if (uri == NULL || uri->authority == NULL) { |
| 259 | gpr_log(GPR_ERROR, "cannot parse value of 'http_proxy' env var"); |
| 260 | goto done; |
| 261 | } |
| 262 | if (strcmp(uri->scheme, "http") != 0) { |
| 263 | gpr_log(GPR_ERROR, "'%s' scheme not supported in proxy URI", uri->scheme); |
| 264 | goto done; |
| 265 | } |
| 266 | if (strchr(uri->authority, '@') != NULL) { |
| 267 | gpr_log(GPR_ERROR, "userinfo not supported in proxy URI"); |
| 268 | goto done; |
| 269 | } |
| 270 | proxy_name = gpr_strdup(uri->authority); |
| 271 | done: |
| 272 | grpc_uri_destroy(uri); |
| 273 | return proxy_name; |
| 274 | } |