Files
mirall/fastcgi.h

24 lines
590 B
C
Raw Normal View History

2019-04-28 00:17:32 +00:00
#pragma once
2019-04-28 06:47:30 +00:00
#include <functional>
#include <memory>
2019-04-30 02:07:48 +00:00
#include <unordered_set>
2019-04-28 06:47:30 +00:00
#include "fastcgi_request.h"
2019-04-28 00:17:32 +00:00
class FastCGIServer {
public:
2019-05-04 12:16:31 -07:00
FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={});
2019-04-28 00:17:32 +00:00
void Serve();
private:
2019-05-04 12:16:31 -07:00
void NewConn(int listen_sock, int epoll_fd);
int NewListenSock();
void ServeInt();
2019-05-04 12:16:31 -07:00
const int port_;
2019-04-30 02:07:48 +00:00
const std::function<void(std::unique_ptr<FastCGIRequest>)> callback_;
2019-05-04 12:16:31 -07:00
const int threads_;
2019-04-30 02:07:48 +00:00
const std::unordered_set<std::string_view> headers_;
2019-04-28 00:17:32 +00:00
};