Remove header filtering, since it's fully configurable in nginx
This commit is contained in:
@@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
namespace firecgi {
|
namespace firecgi {
|
||||||
|
|
||||||
Connection::Connection(int sock, const sockaddr_in6& client_addr, const std::function<void(Request*)>& callback, const std::unordered_set<std::string_view>& headers, int max_request_len)
|
Connection::Connection(int sock, const sockaddr_in6& client_addr, const std::function<void(Request*)>& callback, int max_request_len)
|
||||||
: sock_(sock),
|
: sock_(sock),
|
||||||
callback_(callback),
|
callback_(callback),
|
||||||
headers_(headers),
|
|
||||||
buf_(sock, max_request_len),
|
buf_(sock, max_request_len),
|
||||||
request_(this) {
|
request_(this) {
|
||||||
char client_addr_str[INET6_ADDRSTRLEN];
|
char client_addr_str[INET6_ADDRSTRLEN];
|
||||||
@@ -104,9 +103,7 @@ int Connection::Read() {
|
|||||||
}
|
}
|
||||||
std::string_view value(value_buf, param_header->value_length);
|
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;
|
break;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace firecgi {
|
|||||||
|
|
||||||
class Connection {
|
class Connection {
|
||||||
public:
|
public:
|
||||||
Connection(int sock, const sockaddr_in6& client_addr, const std::function<void(Request*)>& callback, const std::unordered_set<std::string_view>& headers, int max_request_len);
|
Connection(int sock, const sockaddr_in6& client_addr, const std::function<void(Request*)>& callback, int max_request_len);
|
||||||
~Connection();
|
~Connection();
|
||||||
|
|
||||||
[[nodiscard]] int Read();
|
[[nodiscard]] int Read();
|
||||||
@@ -24,7 +24,6 @@ class Connection {
|
|||||||
private:
|
private:
|
||||||
const int sock_;
|
const int sock_;
|
||||||
const std::function<void(Request*)>& callback_;
|
const std::function<void(Request*)>& callback_;
|
||||||
const std::unordered_set<std::string_view>& headers_;
|
|
||||||
firebuf::StreamBuffer buf_;
|
firebuf::StreamBuffer buf_;
|
||||||
Request request_;
|
Request request_;
|
||||||
|
|
||||||
|
|||||||
Submodule fireusage updated: 5fea6af3c3...7972d253ab
@@ -16,11 +16,10 @@
|
|||||||
|
|
||||||
namespace firecgi {
|
namespace firecgi {
|
||||||
|
|
||||||
Server::Server(int port, const std::function<void(Request*)>& callback, int threads, const std::unordered_set<std::string_view>& headers, int max_request_len)
|
Server::Server(int port, const std::function<void(Request*)>& callback, int threads, int max_request_len)
|
||||||
: port_(port),
|
: port_(port),
|
||||||
callback_(callback),
|
callback_(callback),
|
||||||
threads_(threads),
|
threads_(threads),
|
||||||
headers_(headers),
|
|
||||||
max_request_len_(max_request_len),
|
max_request_len_(max_request_len),
|
||||||
close_fd_(eventfd(0, 0)) {
|
close_fd_(eventfd(0, 0)) {
|
||||||
CHECK_GE(close_fd_, 0);
|
CHECK_GE(close_fd_, 0);
|
||||||
@@ -140,7 +139,7 @@ Connection* Server::NewConn(int listen_sock, int epoll_fd) {
|
|||||||
int flags = 1;
|
int flags = 1;
|
||||||
PCHECK(setsockopt(client_sock, SOL_TCP, TCP_NODELAY, &flags, sizeof(flags)) == 0);
|
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{
|
struct epoll_event ev{
|
||||||
.events = EPOLLIN,
|
.events = EPOLLIN,
|
||||||
|
|||||||
3
server.h
3
server.h
@@ -10,7 +10,7 @@ namespace firecgi {
|
|||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
public:
|
public:
|
||||||
Server(int port, const std::function<void(Request*)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={}, int max_request_len=(16*1024));
|
Server(int port, const std::function<void(Request*)>& callback, int threads=1, int max_request_len=(16*1024));
|
||||||
void Serve();
|
void Serve();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void RegisterSignalHandlers();
|
void RegisterSignalHandlers();
|
||||||
@@ -23,7 +23,6 @@ class Server {
|
|||||||
const int port_;
|
const int port_;
|
||||||
const std::function<void(Request*)> callback_;
|
const std::function<void(Request*)> callback_;
|
||||||
const int threads_;
|
const int threads_;
|
||||||
const std::unordered_set<std::string_view> headers_;
|
|
||||||
const int max_request_len_;
|
const int max_request_len_;
|
||||||
|
|
||||||
int close_fd_;
|
int close_fd_;
|
||||||
|
|||||||
Reference in New Issue
Block a user