Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tools/server/server-http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ bool server_http_context::init(const common_params & params) {
srv.reset(
new httplib::SSLServer(params.ssl_file_cert.c_str(), params.ssl_file_key.c_str())
);
is_ssl = true;
} else {
SRV_INF("%s", "running without SSL\n");
srv.reset(new httplib::Server());
Expand Down Expand Up @@ -378,8 +379,8 @@ bool server_http_context::start() {
thread = std::thread([this]() { pimpl->srv->listen_after_bind(); });
srv->wait_until_ready();

listening_address = is_sock ? string_format("unix://%s", hostname.c_str())
: string_format("http://%s:%d", hostname.c_str(), port);
listening_address = is_sock ? string_format("unix://%s", hostname.c_str())
: string_format("%s://%s:%d", is_ssl ? "https" : "http", hostname.c_str(), port);
return true;
}

Expand Down
1 change: 1 addition & 0 deletions tools/server/server-http.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct server_http_context {
std::string path_prefix;
std::string hostname;
int port;
bool is_ssl = false;

server_http_context();
~server_http_context();
Expand Down