Skip to content

Commit

Permalink
Merge pull request #369 from ffurano/master
Browse files Browse the repository at this point in the history
XrdHttp: Sanitize the resource string, removing double slashes
  • Loading branch information
abh3 committed May 23, 2016
2 parents 707f518 + 691d0b0 commit c68aa51
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/XrdHttp/XrdHttpReq.cc
Expand Up @@ -638,10 +638,19 @@ void XrdHttpReq::appendOpaque(XrdOucString &s, XrdSecEntity *secent, char *hash,
void XrdHttpReq::parseResource(char *res) {
// Look for the first '?'
char *p = strchr(res, '?');

// Not found, then it's just a filename
if (!p) {
resource.assign(res, 0);

// Sanitize the resource string, removing double slashes
int pos;
do {
pos = resource.find("//", pos);
if (pos != STR_NPOS)
resource.erase(pos, 1);
} while (pos != STR_NPOS);

return;
}

Expand All @@ -653,7 +662,15 @@ void XrdHttpReq::parseResource(char *res) {
// Whatever comes after is opaque data to be parsed
if (strlen(p) > 1)
opaque = new XrdOucEnv(p + 1);


// Sanitize the resource string, removing double slashes
int pos;
do {
pos = resource.find("//", pos);
if (pos != STR_NPOS)
resource.erase(pos, 1);
} while (pos != STR_NPOS);

}

int XrdHttpReq::ProcessHTTPReq() {
Expand Down

0 comments on commit c68aa51

Please sign in to comment.