i2pd/HTTPProxy.h

43 lines
776 B
C
Raw Normal View History

2014-03-17 22:31:29 +00:00
#ifndef HTTP_PROXY_H__
#define HTTP_PROXY_H__
#include <sstream>
#include <thread>
#include <boost/asio.hpp>
#include <boost/array.hpp>
#include "HTTPServer.h"
2014-03-17 22:31:29 +00:00
namespace i2p
{
namespace proxy
{
class HTTPProxyConnection : public i2p::util::HTTPConnection
2014-03-17 22:31:29 +00:00
{
public:
HTTPProxyConnection (boost::asio::ip::tcp::socket * socket): HTTPConnection(socket) { };
2014-03-17 22:31:29 +00:00
protected:
void RunRequest();
2014-03-17 22:31:29 +00:00
void parseHeaders(const std::string& h, std::vector<header>& hm);
void ExtractRequest(request &m_Request);
};
2014-03-17 22:31:29 +00:00
class HTTPProxy : public i2p::util::HTTPServer
2014-03-17 22:31:29 +00:00
{
public:
HTTPProxy (int port): HTTPServer(port) {};
2014-03-17 22:31:29 +00:00
private:
void CreateConnection(boost::asio::ip::tcp::socket * m_NewSocket)
{
new HTTPProxyConnection(m_NewSocket);
}
};
2014-03-17 22:31:29 +00:00
}
}
#endif