pica/request/request.h

41 lines
810 B
C
Raw Normal View History

2023-11-21 22:19:08 +00:00
#pragma once
#include <memory>
#include <stdexcept>
#include <string_view>
#include <fcgiapp.h>
#include "stream/ostream.h"
class Request {
public:
enum class State {
initial,
accepted,
responded
};
Request();
~Request();
Request(const Request& other) = delete;
Request(Request&& other) = delete;
Request& operator = (const Request& other) = delete;
Request& operator = (Request&& other) = delete;
bool wait(int socketDescriptor);
void terminate();
bool isGet() const;
OStream getOutputStream();
OStream getErrorStream();
std::string_view getPath(const std::string& serverName) const;
std::string getServerName() const;
void printEnvironment(std::ostream& out);
private:
State state;
FCGX_Request raw;
};