[squid-dev] on_unsupported_protocol rewrite to support tcp connection relay

钱国正 richard.qian at magicwifi.com.cn
Fri Mar 24 10:54:28 UTC 2017


Hi gurus:
For below code in client_side.cc, I want to know what's the pinning.serverConnection mean? and what it is used for?


I want to rewrite the on_unsupported_protocol to support tcp connection (non-http protocol, called httpdns not readable, no http header) and relay it the server.
Except here, I need assign the server's address and port, where shold I moidify ? the receive part logic ?
could anyone give me some advisement, thanks.
bool ConnStateData::initiateTunneledRequest(HttpRequest::Pointer const &cause, Http::MethodType const method, const char *reason, const SBuf &payload) {     // fake a CONNECT request to force connState to tunnel     SBuf connectHost;     unsigned short connectPort = 0; 
     if (pinning.serverConnection != nullptr) {         static char ip[MAX_IPSTRLEN];         connectHost.assign(pinning.serverConnection->remote.toStr(ip, sizeof(ip)));         connectPort = pinning.serverConnection->remote.port();     } else if (cause && cause->method == Http::METHOD_CONNECT) {         // We are inside a (not fully established) CONNECT request         connectHost = cause->url.host();         connectPort = cause->url.port();     } else {         debugs(33, 2, "Not able to compute URL, abort request tunneling for " << reason);         return false;     } 
     debugs(33, 2, "Request tunneling for " << reason);     ClientHttpRequest *http = buildFakeRequest(method, connectHost, connectPort, payload);     HttpRequest::Pointer request = http->request;     request->flags.forceTunnel = true;     http->calloutContext = new ClientRequestContext(http);     http->doCallouts();     clientProcessRequestFinished(this, request);     return true; }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20170324/6186df89/attachment.html>


More information about the squid-dev mailing list