-
Notifications
You must be signed in to change notification settings - Fork 55
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
chore: gcp code bugs #384
Conversation
romange
commented
Feb 24, 2025
•
edited
Loading
edited
- Invalid release up of the pool client handle.
- add a missing header for gcp metadata request.
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.
LGTM but I'm not sure which headers are fixed by this? (from PR desc)
util/cloud/gcp/gcs.cc
Outdated
@@ -144,9 +144,11 @@ io::Result<TokenTtl> ParseTokenResponse(std::string&& response) { | |||
return result; | |||
} | |||
|
|||
static const char kMetaDataHost[] = "metadata.google.internal"; |
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.
static const char kMetaDataHost[] = "metadata.google.internal"; | |
static constexpr string_view kMetaDataHost = "metadata.google.internal"sv; |
Just a nit, doesn't really matter
util/cloud/gcp/gcs.cc
Outdated
@@ -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); |
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.
@chakaz these headers :) host was missing so the requests were rejected
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.
oh lol, I was thinking of C++ headers 🤦
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.
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>
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.
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