| 618 | } |
| 619 | |
| 620 | void HTTPReqHandler::HandleUpstreamSocksProxyConnect(const boost::system::error_code & ec) |
| 621 | { |
| 622 | if(!ec) |
| 623 | { |
| 624 | if(m_RequestURL.host.size() > 255) |
| 625 | { |
| 626 | GenericProxyError(tr("Hostname is too long"), m_RequestURL.host); |
| 627 | return; |
| 628 | } |
| 629 | uint16_t port = m_RequestURL.port; |
| 630 | if(!port) port = 80; |
| 631 | LogPrint(eLogDebug, "HTTPProxy: Connected to SOCKS upstream"); |
| 632 | std::string host = m_RequestURL.host; |
| 633 | auto s = shared_from_this (); |
| 634 | i2p::transport::Socks5Handshake (*m_proxysock, std::make_pair(host, port), |
| 635 | [s](const boost::system::error_code& ec) |
| 636 | { |
| 637 | if (!ec) |
| 638 | s->SocksProxySuccess(); |
| 639 | else |
| 640 | s->GenericProxyError(tr("SOCKS proxy error"), ec.message ()); |
| 641 | }); |
| 642 | |
| 643 | } |
| 644 | else |
| 645 | GenericProxyError(tr("Cannot connect to upstream SOCKS proxy"), ec.message()); |
| 646 | } |
| 647 | |
| 648 | void HTTPReqHandler::HandoverToUpstreamProxy() |
| 649 | { |
nothing calls this directly
no test coverage detected