Whitelist for storing request headers

This commit is contained in:
Ian Gulliver
2019-04-30 02:07:48 +00:00
parent 205b8253b2
commit 87bc2c1611
6 changed files with 23 additions and 13 deletions

View File

@@ -7,8 +7,9 @@
#include "fastcgi.h"
#include "fastcgi_conn.h"
FastCGIServer::FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback)
: callback_(callback) {
FastCGIServer::FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback, const std::unordered_set<std::string_view>& headers)
: callback_(callback),
headers_(headers) {
LOG(INFO) << "listening on [::1]:" << port;
signal(SIGPIPE, SIG_IGN);
@@ -42,7 +43,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, callback_);
auto *conn = new FastCGIConn(client_sock, client_addr, callback_, headers_);
std::thread thread([conn]() { conn->Serve(); });
thread.detach();
}