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

Pass along opaque info for TPC. #934

Merged
merged 1 commit into from
Mar 18, 2019
Merged
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
19 changes: 17 additions & 2 deletions src/XrdTpc/XrdTpcTPC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ XrdSysMutex TPCHandler::m_monid_mutex;
XrdVERSIONINFO(XrdHttpGetExtHandler, HttpTPC);


static std::string prepareURL(const XrdHttpExtReq &req) {
std::map<std::string, std::string>::const_iterator iter = req.headers.find("xrd-http-query");
if (iter == req.headers.end() || iter->second.empty()) {return req.resource;}

std::string query = iter->second;
if (query[0] == '&') {
query = query.substr(1);
}
return req.resource + "?" + query;
}


static char *quote(const char *str) {
int l = strlen(str);
char *r = (char *) malloc(l*3 + 1);
Expand Down Expand Up @@ -417,7 +429,9 @@ int TPCHandler::ProcessPushReq(const std::string & resource, XrdHttpExtReq &req)
}
std::string authz = GetAuthz(req);

int open_results = OpenWaitStall(*fh, req.resource, SFS_O_RDONLY, 0644,
std::string full_url = prepareURL(req);

int open_results = OpenWaitStall(*fh, full_url, SFS_O_RDONLY, 0644,
req.GetSecEntity(), authz);
if (SFS_REDIRECT == open_results) {
return RedirectTransfer(req, fh->error);
Expand Down Expand Up @@ -485,8 +499,9 @@ int TPCHandler::ProcessPullReq(const std::string &resource, XrdHttpExtReq &req)
streams = streams == 0 ? 1 : stream_req;
}
}
std::string full_url = prepareURL(req);

int open_result = OpenWaitStall(*fh, req.resource, mode|SFS_O_WRONLY, 0644,
int open_result = OpenWaitStall(*fh, full_url, mode|SFS_O_WRONLY, 0644,
req.GetSecEntity(), authz);
if (SFS_REDIRECT == open_result) {
return RedirectTransfer(req, fh->error);
Expand Down