Skip to content

Commit

Permalink
use fs path
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Dec 15, 2023
1 parent 9ae8f00 commit d0bbeaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/ylt/thirdparty/cinatra/coro_http_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ class coro_http_server {
if (size_t pos = relative_path.find('\\') != std::string::npos) {
replace_all(relative_path, "\\", "/");
}
uri = std::string("/")
uri = fs::path("/")
.append(static_dir_router_path_)
.append(relative_path);
.append(relative_path)
.string();

set_http_handler<cinatra::GET>(
uri,
Expand Down
1 change: 1 addition & 0 deletions src/coro_http/examples/chat_room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async_simple::coro::Lazy<void> broadcast(auto &conn_map,

int main() {
coro_http::coro_http_server server(1, 9001);
server.set_static_res_handler("", "");
std::mutex mtx;
std::unordered_map<intptr_t, std::string> conn_map;
server.set_http_handler<cinatra::GET>(
Expand Down

0 comments on commit d0bbeaf

Please sign in to comment.