Skip to content

Commit

Permalink
Sanitize path by removing repeated slashes, which would confuse
Browse files Browse the repository at this point in the history
the browser when used in the html rendering
  • Loading branch information
ffurano committed May 20, 2016
1 parent e989e0b commit 691d0b0
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 691d0b0

Please sign in to comment.