MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / HandleUpstreamSocksProxyConnect

Method HandleUpstreamSocksProxyConnect

libi2pd_client/HTTPProxy.cpp:620–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

trFunction · 0.85
LogPrintFunction · 0.85
Socks5HandshakeFunction · 0.85
SocksProxySuccessMethod · 0.80
GenericProxyErrorMethod · 0.80

Tested by

no test coverage detected