diff --git a/connection.cc b/connection.cc index 1e19768..2de81f2 100644 --- a/connection.cc +++ b/connection.cc @@ -9,10 +9,9 @@ namespace firecgi { -Connection::Connection(int sock, const sockaddr_in6& client_addr, const std::function& callback, const std::unordered_set& headers, int max_request_len) +Connection::Connection(int sock, const sockaddr_in6& client_addr, const std::function& callback, int max_request_len) : sock_(sock), callback_(callback), - headers_(headers), buf_(sock, max_request_len), request_(this) { char client_addr_str[INET6_ADDRSTRLEN]; @@ -104,9 +103,7 @@ int Connection::Read() { } std::string_view value(value_buf, param_header->value_length); - if (headers_.find(key) != headers_.end()) { - request_.AddParam(key, value); - } + request_.AddParam(key, value); } } break; diff --git a/connection.h b/connection.h index 2fd869e..46978b9 100644 --- a/connection.h +++ b/connection.h @@ -13,7 +13,7 @@ namespace firecgi { class Connection { public: - Connection(int sock, const sockaddr_in6& client_addr, const std::function& callback, const std::unordered_set& headers, int max_request_len); + Connection(int sock, const sockaddr_in6& client_addr, const std::function& callback, int max_request_len); ~Connection(); [[nodiscard]] int Read(); @@ -24,7 +24,6 @@ class Connection { private: const int sock_; const std::function& callback_; - const std::unordered_set& headers_; firebuf::StreamBuffer buf_; Request request_; diff --git a/fireusage b/fireusage index 5fea6af..7972d25 160000 --- a/fireusage +++ b/fireusage @@ -1 +1 @@ -Subproject commit 5fea6af3c32f9f26ecc58040e3b4895eaf7bd1f7 +Subproject commit 7972d253ab3b7f1eb11383bf4e0c4958c4ad6606 diff --git a/server.cc b/server.cc index 3808c75..96d44d4 100644 --- a/server.cc +++ b/server.cc @@ -16,11 +16,10 @@ namespace firecgi { -Server::Server(int port, const std::function& callback, int threads, const std::unordered_set& headers, int max_request_len) +Server::Server(int port, const std::function& callback, int threads, int max_request_len) : port_(port), callback_(callback), threads_(threads), - headers_(headers), max_request_len_(max_request_len), close_fd_(eventfd(0, 0)) { CHECK_GE(close_fd_, 0); @@ -140,7 +139,7 @@ Connection* Server::NewConn(int listen_sock, int epoll_fd) { int flags = 1; PCHECK(setsockopt(client_sock, SOL_TCP, TCP_NODELAY, &flags, sizeof(flags)) == 0); - auto *conn = new Connection(client_sock, client_addr, callback_, headers_, max_request_len_); + auto *conn = new Connection(client_sock, client_addr, callback_, max_request_len_); { struct epoll_event ev{ .events = EPOLLIN, diff --git a/server.h b/server.h index 42dec9b..4959831 100644 --- a/server.h +++ b/server.h @@ -10,7 +10,7 @@ namespace firecgi { class Server { public: - Server(int port, const std::function& callback, int threads=1, const std::unordered_set& headers={}, int max_request_len=(16*1024)); + Server(int port, const std::function& callback, int threads=1, int max_request_len=(16*1024)); void Serve(); void Shutdown(); void RegisterSignalHandlers(); @@ -23,7 +23,6 @@ class Server { const int port_; const std::function callback_; const int threads_; - const std::unordered_set headers_; const int max_request_len_; int close_fd_;