-
Notifications
You must be signed in to change notification settings - Fork 432
feat(storage): support AuthorityOption #8462
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
Conversation
If present, use the `AuthorityOption` to configure the `Host: ` header or the `.set_authority()` attribute in `grpc::ClientContext`. By default, configure `AuthorityOption` to be `storage.googleapis.com`, applications can override this when initializing the `storage::Client`. There is already an issue open to add per-call `Options` that would provide more fine-grained control of this field.
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Codecov Report
@@ Coverage Diff @@
## main #8462 +/- ##
=======================================
Coverage 93.88% 93.88%
=======================================
Files 1451 1451
Lines 125175 125231 +56
=======================================
+ Hits 117515 117569 +54
- Misses 7660 7662 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @coryan)
google/cloud/storage/internal/curl_client.cc, line 117 at r1 (raw file):
// or their own proxy, and need to provide the target's service host. if (!options.get<AuthorityOption>().empty()) { return absl::StrCat("Host: ", options.get<AuthorityOption>());
Consider:
if (options.has<AuthorityOption>()) {
auto const auth = options.get<AuthorityOption>();
if (!auth.empty()) return absl::StrCat("Host: ", auth);
}google/cloud/storage/internal/curl_client.cc, line 119 at r1 (raw file):
return absl::StrCat("Host: ", options.get<AuthorityOption>()); } auto const& endpoint = options.get<RestEndpointOption>();
Hmm... do you think we should add a note here saying that AuthorityOption takes precedence over storage::RestEndpointOption ?
| /// Configure the REST endpoint for the GCS client library. |
google/cloud/storage/internal/grpc_client_test.cc, line 354 at r1 (raw file):
EXPECT_CALL(*mock, WriteObject) .WillOnce([this](std::unique_ptr<grpc::ClientContext> context) { auto metadata = GetMetadata(*context);
Check AuthorityOption here?
EXPECT_EQ(CurrentOptions().get<AuthorityOption>(), kAuthority);
coryan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on @dbolduc)
google/cloud/storage/internal/curl_client.cc, line 117 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
Consider:
if (options.has<AuthorityOption>) { auto const auth = options.get<AuthorityOption>(); if (!auth.empty()) return absl::StrCat("Host: ", auth); }
Done. Though a slightly different implementation, note that not options.has<AuthorityOption>() implies options.get<AuthorityOption>().empty().
google/cloud/storage/internal/curl_client.cc, line 119 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
Hmm... do you think we should add a note here saying that
AuthorityOptiontakes precedence overstorage::RestEndpointOption?
/// Configure the REST endpoint for the GCS client library.
Done.
google/cloud/storage/internal/grpc_client_test.cc, line 354 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
Check
AuthorityOptionhere?EXPECT_EQ(CurrentOptions().get<AuthorityOption>(), kAuthority);
Done.
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
Part of the motivation for checking |
|
Google Cloud Build Logs
ℹ️ NOTE: Kokoro logs are linked from "Details" below. |
If present, use the
AuthorityOptionto configure theHost:headeror the
.set_authority()attribute ingrpc::ClientContext. Bydefault, configure
AuthorityOptionto bestorage.googleapis.com,applications can override this when initializing the
storage::Client.There is already an issue open to add per-call
Optionsthat wouldprovide more fine-grained control of this field.
Fixes #3317. I am adding a node to #8164 because we will need to undo some of this work to support per-call options.
This change is