2015-08-30 07:12:46 +08:00
|
|
|
#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"
|
2015-08-30 07:12:46 +08:00
|
|
|
|
|
|
|
#include "httpparser.hpp"
|
|
|
|
#include "request.hpp"
|
|
|
|
#include "response.hpp"
|
|
|
|
|
|
|
|
namespace http
|
|
|
|
{
|
|
|
|
|
2015-10-09 07:24:12 +08:00
|
|
|
template <class Req, class Res>
|
2015-08-30 07:12:46 +08:00
|
|
|
class HttpServer;
|
|
|
|
|
2015-10-09 07:24:12 +08:00
|
|
|
template <class Req, class Res>
|
2015-08-30 07:12:46 +08:00
|
|
|
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>;
|
|
|
|
|
2015-08-30 07:12:46 +08:00
|
|
|
public:
|
2015-10-09 07:24:12 +08:00
|
|
|
HttpConnection(uv::UvLoop& loop, HttpServer<Req, Res>& server);
|
2015-08-30 07:12:46 +08:00
|
|
|
|
|
|
|
void close();
|
|
|
|
|
2015-10-09 07:24:12 +08:00
|
|
|
server_t& server;
|
2015-08-30 07:12:46 +08:00
|
|
|
uv::TcpStream client;
|
|
|
|
|
2015-10-09 07:24:12 +08:00
|
|
|
parser_t parser;
|
2015-08-30 07:12:46 +08:00
|
|
|
|
2015-10-09 07:24:12 +08:00
|
|
|
Req request;
|
|
|
|
Res response;
|
2015-08-30 07:12:46 +08:00
|
|
|
|
|
|
|
bool keep_alive;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|