| 692 | } |
| 693 | |
| 694 | void HTTPReqHandler::SocksProxySuccess() |
| 695 | { |
| 696 | if(m_ClientRequest.method == "CONNECT") { |
| 697 | m_ClientResponse.code = 200; |
| 698 | m_send_buf = m_ClientResponse.to_string(); |
| 699 | 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) |
| 700 | { |
| 701 | if(ec) GenericProxyError(tr("SOCKS proxy error"), ec.message()); |
| 702 | else HandoverToUpstreamProxy(); |
| 703 | }); |
| 704 | } else { |
| 705 | m_send_buf = m_ClientRequestBuffer.str(); |
| 706 | LogPrint(eLogDebug, "HTTPProxy: Send ", m_send_buf.size(), " bytes"); |
| 707 | boost::asio::async_write(*m_proxysock, boost::asio::buffer(m_send_buf), boost::asio::transfer_all(), [&](const boost::system::error_code & ec, std::size_t transferred) |
| 708 | { |
| 709 | if(ec) GenericProxyError(tr("Failed to send request to upstream"), ec.message()); |
| 710 | else HandoverToUpstreamProxy(); |
| 711 | }); |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | void HTTPReqHandler::HandleUpstreamHTTPProxyConnect(const boost::system::error_code & ec) |
| 716 | { |
no test coverage detected