summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2021-11-18 00:19:49 +0100
committerJoel Klinghed <the_jk@spawned.biz>2021-11-18 00:24:41 +0100
commit33405111d53ac0288adbd2881f3e5a7c1cacc999 (patch)
tree49570e9cb08f2184c7e143a5c124307e23c2a505 /src
parent0277b7075475326f2c39fe09b4d7424b6f9111a0 (diff)
send_file: Make sure send file header value contains the right amount of slashes
Diffstat (limited to 'src')
-rw-r--r--src/send_file.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/send_file.cc b/src/send_file.cc
index 8611b6f..e5bf92b 100644
--- a/src/send_file.cc
+++ b/src/send_file.cc
@@ -29,7 +29,11 @@ public:
}
auto resp = transport->create_ok_data("");
- resp->add_header(header_, path_ + std::string(relative_path));
+ std::string value = path_;
+ if (relative_path.empty() || relative_path.front() != '/')
+ value.push_back('/');
+ value.append(relative_path);
+ resp->add_header(header_, std::move(value));
return resp;
}