Add period at end of metadata.google.internal to prevent unnecessary DNS lookups.

pull/17598/head
Chris Wilcox 6 years ago
parent fc7d0911a3
commit df6cf7c741
  1. 2
      src/core/lib/security/credentials/alts/alts_credentials.cc
  2. 2
      src/core/lib/security/credentials/credentials.h
  3. 2
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  4. 6
      test/core/security/credentials_test.cc

@ -31,7 +31,7 @@
#include "src/core/lib/security/security_connector/alts/alts_security_connector.h"
#define GRPC_CREDENTIALS_TYPE_ALTS "Alts"
#define GRPC_ALTS_HANDSHAKER_SERVICE_URL "metadata.google.internal:8080"
#define GRPC_ALTS_HANDSHAKER_SERVICE_URL "metadata.google.internal.:8080"
grpc_alts_credentials::grpc_alts_credentials(
const grpc_alts_credentials_options* options,

@ -60,7 +60,7 @@ typedef enum {
#define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60
#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal"
#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal."
#define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
"/computeMetadata/v1/instance/service-accounts/default/token"

@ -46,7 +46,7 @@
/* -- Constants. -- */
#define GRPC_COMPUTE_ENGINE_DETECTION_HOST "metadata.google.internal"
#define GRPC_COMPUTE_ENGINE_DETECTION_HOST "metadata.google.internal."
/* -- Default credentials. -- */

@ -534,7 +534,7 @@ static void test_channel_oauth2_google_iam_composite_creds(void) {
static void validate_compute_engine_http_request(
const grpc_httpcli_request* request) {
GPR_ASSERT(request->handshaker != &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal.") == 0);
GPR_ASSERT(
strcmp(request->http.path,
"/computeMetadata/v1/instance/service-accounts/default/token") ==
@ -930,7 +930,7 @@ static int default_creds_metadata_server_detection_httpcli_get_success_override(
response->hdr_count = 1;
response->hdrs = headers;
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal.") == 0);
GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;
}
@ -1020,7 +1020,7 @@ static int default_creds_gce_detection_httpcli_get_failure_override(
grpc_closure* on_done, grpc_httpcli_response* response) {
/* No magic header. */
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal.") == 0);
*response = http_response(200, "");
GRPC_CLOSURE_SCHED(on_done, GRPC_ERROR_NONE);
return 1;

Loading…
Cancel
Save