Skip to content

Commit

Permalink
Merge pull request #694 from klickverbot/url-colon-crash
Browse files Browse the repository at this point in the history
Fix assertion when requesting URL containing ':' from serveStaticFiles.
  • Loading branch information
s-ludwig committed Jun 19, 2014
2 parents 2a57cdf + 1151de3 commit e9365ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/vibe/http/fileserver.d
Expand Up @@ -45,11 +45,15 @@ HTTPServerRequestDelegate serveStaticFiles(Path local_path, HTTPFileServerSettin
auto rel_path = srv_path[settings.serverPathPrefix.length .. $];
auto rpath = Path(rel_path);
logTrace("Processing '%s'", srv_path);

rpath.normalize();
logDebug("Path '%s' -> '%s'", rel_path, rpath.toNativeString());
if (rpath.empty) {
// TODO: support searching for an index file
return;
} else if (rpath.absolute) {
logDebug("Path is absolute, not responding");
return;
} else if (rpath[0] == "..") return; // don't respond to relative paths outside of the root path

sendFile(req, res, local_path ~ rpath, settings);
Expand Down

0 comments on commit e9365ca

Please sign in to comment.