Skip to content

Commit 97cb3fd

Browse files
authored
fix: resolve undefined variable 'svr' compilation error (ggml-org#17348)
1 parent ffa277a commit 97cb3fd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/server/server-http.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,26 @@ bool server_http_context::init(const common_params & params) {
4646
port = params.port;
4747
hostname = params.hostname;
4848

49+
auto & srv = pimpl->srv;
50+
4951
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
5052
if (params.ssl_file_key != "" && params.ssl_file_cert != "") {
5153
LOG_INF("Running with SSL: key = %s, cert = %s\n", params.ssl_file_key.c_str(), params.ssl_file_cert.c_str());
52-
svr.reset(
54+
srv.reset(
5355
new httplib::SSLServer(params.ssl_file_cert.c_str(), params.ssl_file_key.c_str())
5456
);
5557
} else {
5658
LOG_INF("Running without SSL\n");
57-
svr.reset(new httplib::Server());
59+
srv.reset(new httplib::Server());
5860
}
5961
#else
6062
if (params.ssl_file_key != "" && params.ssl_file_cert != "") {
6163
LOG_ERR("Server is built without SSL support\n");
6264
return false;
6365
}
64-
pimpl->srv.reset(new httplib::Server());
66+
srv.reset(new httplib::Server());
6567
#endif
6668

67-
auto & srv = pimpl->srv;
6869
srv->set_default_headers({{"Server", "llama.cpp"}});
6970
srv->set_logger(log_server_request);
7071
srv->set_exception_handler([](const httplib::Request &, httplib::Response & res, const std::exception_ptr & ep) {

0 commit comments

Comments
 (0)