diff --git a/main.cpp b/main.cpp index 6313aa7..f019591 100755 --- a/main.cpp +++ b/main.cpp @@ -136,6 +136,8 @@ private: } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } @@ -180,11 +182,15 @@ private: } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } }); @@ -211,6 +217,8 @@ private: } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } }); @@ -237,7 +245,10 @@ private: } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); + } }); } @@ -275,11 +286,15 @@ private: } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } } else { + std::string msg = ec.message(); + std::cout << msg << std::endl; lowerSocket().close(); } }); @@ -610,6 +625,15 @@ private: } }); } + else if (ec == boost::asio::error::eof) + { + std::cout << "transferDataForward read end of file" << std::endl; + if (length > 0) + { + std::cout << "but length is positive" << std::endl; + } + return; + } else { std::string msg = ec.message(); @@ -654,6 +678,15 @@ private: } }); } + else if (ec == boost::asio::error::eof) + { + std::cout << "transferDataBackward read end of file" << std::endl; + if (length > 0) + { + std::cout << "but length is positive" << std::endl; + } + return; + } else { std::string msg = ec.message(); @@ -682,10 +715,11 @@ class ProxyServer public: ProxyServer(boost::asio::io_service& inIoService, const boost::asio::ip::tcp::endpoint& endpoint, - boost::asio::ssl::context& sslContext) + boost::asio::ssl::context& inSslContext) : ioService(inIoService) , acceptor(inIoService, endpoint) - , socket(std::make_shared(inIoService, sslContext)) + , socket(std::make_shared(inIoService, inSslContext)) + , sslContext(inSslContext) { doAccept(); } @@ -703,6 +737,8 @@ private: counter++; + socket = std::make_shared(ioService, sslContext); + doAccept(); }); } @@ -712,6 +748,8 @@ private: boost::asio::ip::tcp::acceptor acceptor; std::shared_ptr socket; + boost::asio::ssl::context& sslContext; + //std::map proxySessionMap; size_t counter = 0; @@ -728,7 +766,6 @@ int main() boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), 8043); - boost::asio::ssl::context sslContext(boost::asio::ssl::context::sslv23); sslContext.set_options(