From d6f907a05beec157f895fdfe8e166d06f9841745 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 3 Sep 2017 11:13:43 -0400 Subject: [PATCH] make it work --- libi2pd_client/HTTPProxy.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/libi2pd_client/HTTPProxy.cpp b/libi2pd_client/HTTPProxy.cpp index 42014467..526e779e 100644 --- a/libi2pd_client/HTTPProxy.cpp +++ b/libi2pd_client/HTTPProxy.cpp @@ -456,6 +456,7 @@ namespace proxy { void HTTPReqHandler::HTTPConnect(const std::string & host, uint16_t port) { + LogPrint(eLogDebug, "HTTPProxy: CONNECT ",host, ":", port); std::string hostname(host); if(str_rmatch(hostname, ".i2p")) GetOwner()->CreateStream (std::bind (&HTTPReqHandler::HandleHTTPConnectStreamRequestComplete, @@ -468,22 +469,15 @@ namespace proxy { { if(stream) { - m_ClientResponse.code = 101; - m_ClientResponse.status = "Switching Protocols"; + m_ClientResponse.code = 200; + m_ClientResponse.status = "OK"; m_send_buf = m_ClientResponse.to_string(); - boost::asio::async_write(*m_sock, boost::asio::buffer(m_send_buf), boost::asio::transfer_all(), [&] (const boost::system::error_code & ec, std::size_t transferred) { - if(ec) - { - LogPrint(eLogError, "HTTPProxy: failed to send reply: ", ec.message()); - } - else - { - auto connection = std::make_shared(GetOwner(), m_sock, stream); - GetOwner()->AddHandler(connection); - connection->I2PConnect(); - } - Done(shared_from_this()); - }); + m_sock->send(boost::asio::buffer(m_send_buf)); + auto connection = std::make_shared(GetOwner(), m_sock, stream); + GetOwner()->AddHandler(connection); + connection->I2PConnect(); + m_sock = nullptr; + Terminate(); } else {