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

rgw_log, rgw_file: account for new required envvars #18572

Merged
merged 1 commit into from Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/rgw/librgw.cc
Expand Up @@ -240,6 +240,11 @@ namespace rgw {
goto done;
}

/* now expected by rgw_log_op() */
rgw_env.set("REQUEST_METHOD", s->info.method);
rgw_env.set("REQUEST_URI", s->info.request_uri);
rgw_env.set("QUERY_STRING", "");

/* XXX authorize does less here then in the REST path, e.g.,
* the user's info is cached, but still incomplete */
req->log(s, "authorizing");
Expand Down
32 changes: 21 additions & 11 deletions src/rgw/rgw_log.cc
Expand Up @@ -357,19 +357,29 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s,
else
set_param_str(s, "HTTP_REFERER", entry.referrer);

std::string uri(s->info.env->get("REQUEST_METHOD"));
uri.append(" ");

uri.append(s->info.env->get("REQUEST_URI"));
const char* qs = s->info.env->get("QUERY_STRING");
if(qs && (*qs != '\0')) {
uri.append("?");
uri.append(qs);
std::string uri;
if (s->info.env->exists("REQUEST_METHOD")) {
uri.append(s->info.env->get("REQUEST_METHOD"));
uri.append(" ");
}

uri.append(" ");
uri.append("HTTP/");
uri.append(s->info.env->get("HTTP_VERSION"));
if (s->info.env->exists("REQUEST_URI")) {
uri.append(s->info.env->get("REQUEST_URI"));
}

if (s->info.env->exists("QUERY_STRING")) {
const char* qs = s->info.env->get("QUERY_STRING");
if(qs && (*qs != '\0')) {
uri.append("?");
uri.append(qs);
}
}

if (s->info.env->exists("HTTP_VERSION")) {
uri.append(" ");
uri.append("HTTP/");
uri.append(s->info.env->get("HTTP_VERSION"));
}

entry.uri = std::move(uri);

Expand Down