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

chore: gcp code bugs #384

Merged
merged 1 commit into from
Feb 25, 2025
Merged

chore: gcp code bugs #384

merged 1 commit into from
Feb 25, 2025

Conversation

romange
Copy link
Owner

@romange romange commented Feb 24, 2025

  1. Invalid release up of the pool client handle.
  2. add a missing header for gcp metadata request.

@romange romange requested a review from chakaz February 24, 2025 16:58
chakaz
chakaz previously approved these changes Feb 24, 2025
Copy link
Collaborator

@chakaz chakaz left a comment

Choose a reason for hiding this comment

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

LGTM but I'm not sure which headers are fixed by this? (from PR desc)

@@ -144,9 +144,11 @@ io::Result<TokenTtl> ParseTokenResponse(std::string&& response) {
return result;
}

static const char kMetaDataHost[] = "metadata.google.internal";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
static const char kMetaDataHost[] = "metadata.google.internal";
static constexpr string_view kMetaDataHost = "metadata.google.internal"sv;

Just a nit, doesn't really matter

@@ -158,6 +160,7 @@ error_code ReadGCPConfigFromMetadata(fb2::ProactorBase* pb, string* account_id,
const char kEmailUrl[] = "/computeMetadata/v1/instance/service-accounts/default/email";
h2::request<h2::empty_body> req{h2::verb::get, kEmailUrl, 11};
req.set("Metadata-Flavor", "Google");
req.set(h2::field::host, kMetaDataHost);
Copy link
Owner Author

Choose a reason for hiding this comment

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

@chakaz these headers :) host was missing so the requests were rejected

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh lol, I was thinking of C++ headers 🤦

Copy link
Owner Author

Choose a reason for hiding this comment

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

fixed the PR description

1. Invalid release up of the pool client handle.
2. add a missing header for gcp metadata request.

Signed-off-by: Roman Gershman <romange@gmail.com>
@romange romange changed the title chore: fix headers for gcp metadata requests chore: gcp code bugs Feb 24, 2025
Copy link
Collaborator

@chakaz chakaz left a comment

Choose a reason for hiding this comment

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

Now that I see that req.set() accepts a const char*, I had to verify that string_view literals ("..."sv) are null-terminated.
I looks like it is:
https://stackoverflow.com/questions/57250440/is-a-stdstring-view-literal-guaranteed-to-be-null-terminated
But still, it seems to have been a not-so-great advice on my behalf :|

Anyway, LG, do whatever you prefer

@romange romange merged commit 3079d0e into master Feb 25, 2025
8 checks passed
@romange romange deleted the Pr1 branch February 25, 2025 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants