Static "Hello world" page

This commit is contained in:
Ian Gulliver
2019-04-28 06:47:30 +00:00
parent 8a2a19ac37
commit 9da4a994bd
11 changed files with 231 additions and 25 deletions

View File

@@ -6,7 +6,8 @@
#include "fastcgi.h"
#include "fastcgi_conn.h"
FastCGIServer::FastCGIServer(int port) {
FastCGIServer::FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback)
: callback_(callback) {
LOG(INFO) << "listening on [::1]:" << port;
listen_sock_ = socket(AF_INET6, SOCK_STREAM, 0);
@@ -38,7 +39,7 @@ void FastCGIServer::Serve() {
PCHECK(client_sock >= 0) << "accept()";
CHECK_EQ(client_addr.sin6_family, AF_INET6);
auto *conn = new FastCGIConn(client_sock, client_addr);
auto *conn = new FastCGIConn(client_sock, client_addr, callback_);
std::thread thread([conn]() { conn->Serve(); });
thread.detach();
}