mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-01 13:20:38 +00:00
Fix #1768
This commit is contained in:
1 parent
82a90a2325
commit
762024b890
2 files changed
+7
No files matched your search
@@ -2418,6 +2418,7 @@ inline bool is_valid_path(const std::string &path) {
|
|||||||
auto beg = i;
|
auto beg = i;
|
||||||
while (i < path.size() && path[i] != '/') {
|
while (i < path.size() && path[i] != '/') {
|
||||||
if (path[i] == '\0') { return false; }
|
if (path[i] == '\0') { return false; }
|
||||||
|
else if (path[i] == '\\') { return false; }
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2509,6 +2509,12 @@ TEST_F(ServerTest, GetMethodOutOfBaseDirMount2) {
|
|||||||
EXPECT_EQ(StatusCode::NotFound_404, res->status);
|
EXPECT_EQ(StatusCode::NotFound_404, res->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ServerTest, GetMethodOutOfBaseDirMountWithBackslash) {
|
||||||
|
auto res = cli_.Get("/mount/%2e%2e%5c/www2/dir/test.html");
|
||||||
|
ASSERT_TRUE(res);
|
||||||
|
EXPECT_EQ(StatusCode::NotFound_404, res->status);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(ServerTest, PostMethod303) {
|
TEST_F(ServerTest, PostMethod303) {
|
||||||
auto res = cli_.Post("/1", "body", "text/plain");
|
auto res = cli_.Post("/1", "body", "text/plain");
|
||||||
ASSERT_TRUE(res);
|
ASSERT_TRUE(res);
|
||||||
|
|||||||
Reference in new issue
Block a user