MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / proxyConnect

Method proxyConnect

base/poco/Net/src/HTTPClientSession.cpp:544–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542
543
544StreamSocket HTTPClientSession::proxyConnect()
545{
546 URI proxyUri;
547 proxyUri.setScheme(getProxyProtocol());
548 proxyUri.setHost(getProxyHost());
549 proxyUri.setPort(getProxyPort());
550
551 SharedPtr<HTTPClientSession> proxySession (_proxySessionFactory.createClientSession(proxyUri));
552
553 proxySession->setTimeout(getTimeout());
554 std::string targetAddress(_host);
555 targetAddress.append(":");
556 NumberFormatter::append(targetAddress, _port);
557 HTTPRequest proxyRequest(HTTPRequest::HTTP_CONNECT, targetAddress, HTTPMessage::HTTP_1_1);
558 HTTPResponse proxyResponse;
559 proxyRequest.set("Proxy-Connection", "keep-alive");
560 proxyRequest.set("Host", targetAddress);
561 proxyAuthenticateImpl(proxyRequest);
562 proxySession->setKeepAlive(true);
563 proxySession->sendRequest(proxyRequest);
564 proxySession->receiveResponse(proxyResponse);
565 if (proxyResponse.getStatus() != HTTPResponse::HTTP_OK)
566 throw HTTPException("Cannot establish proxy connection", proxyResponse.getReason());
567 return proxySession->detachSocket();
568}
569
570
571void HTTPClientSession::proxyTunnel()

Callers

nothing calls this directly

Calls 14

getProxyHostFunction · 0.85
HTTPExceptionClass · 0.85
appendFunction · 0.50
setSchemeMethod · 0.45
setHostMethod · 0.45
setPortMethod · 0.45
createClientSessionMethod · 0.45
setTimeoutMethod · 0.45
appendMethod · 0.45
setMethod · 0.45
setKeepAliveMethod · 0.45
sendRequestMethod · 0.45

Tested by

no test coverage detected