memgraph/speedy/http/httpconnection.hpp

44 lines
732 B
C++
Raw Normal View History

#ifndef MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
#define MEMGRAPH_SERVER_HTTP_CONNECTION_HPP
2015-09-20 20:30:26 +08:00
#include "io/uv/uv.hpp"
#include "httpparser.hpp"
#include "request.hpp"
#include "response.hpp"
namespace http
{
2015-10-09 07:24:12 +08:00
template <class Req, class Res>
class HttpServer;
2015-10-09 07:24:12 +08:00
template <class Req, class Res>
class HttpConnection
{
2015-10-09 07:24:12 +08:00
friend class HttpServer<Req, Res>;
using server_t = HttpServer<Req, Res>;
using connection_t = HttpConnection<Req, Res>;
using parser_t = HttpParser<Req, Res>;
public:
2015-10-09 07:24:12 +08:00
HttpConnection(uv::UvLoop& loop, HttpServer<Req, Res>& server);
void close();
2015-10-09 07:24:12 +08:00
server_t& server;
uv::TcpStream client;
2015-10-09 07:24:12 +08:00
parser_t parser;
2015-10-09 07:24:12 +08:00
Req request;
Res response;
bool keep_alive;
};
}
#endif