#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/AsyncCallbacks.h"
#include "base/CbcPointer.h"
#include "base/JobWait.h"
#include "base/Raw.h"
#include "CachePeer.h"
#include "cbdata.h"
#include "client_side.h"
#include "client_side_request.h"
#include "clients/HttpTunneler.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/ConnOpener.h"
#include "comm/Read.h"
#include "comm/Write.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "FwdState.h"
#include "globals.h"
#include "HappyConnOpener.h"
#include "http.h"
#include "http/StatusCode.h"
#include "http/Stream.h"
#include "HttpRequest.h"
#include "icmp/net_db.h"
#include "ip/QosConfig.h"
#include "LogTags.h"
#include "MemBuf.h"
#include "neighbors.h"
#include "PeerSelectState.h"
#include "ResolvedPeers.h"
#include "sbuf/SBuf.h"
#include "security/BlindPeerConnector.h"
#include "SquidConfig.h"
#include "StatCounters.h"
#include "ssl/bio.h"
#include "ssl/ServerBump.h"
#include "tools.h"
#include "tunnel.h"
#include "DelayId.h"
#include <climits>
#include <cerrno>
Go to the source code of this file.
Classes | |
class | TunnelStateData |
class | TunnelStateData::Connection |
Functions | |
static void | tunnelServerClosed (const CommCloseCbParams ¶ms) |
TunnelStateData::serverClosed() wrapper. More... | |
static void | tunnelClientClosed (const CommCloseCbParams ¶ms) |
TunnelStateData::clientClosed() wrapper. More... | |
static void | tunnelTimeout (const CommTimeoutCbParams &io) |
static void | tunnelDelayedClientRead (void *data) |
static void | tunnelDelayedServerRead (void *data) |
static void | tunnelStartShoveling (TunnelStateData *tunnelState) |
static void | tunnelConnectedWriteDone (const Comm::ConnectionPointer &conn, char *, size_t len, Comm::Flag flag, int, void *data) |
static void | tunnelErrorComplete (int fd, void *data, size_t) |
void | tunnelStart (ClientHttpRequest *http) |
void | switchToTunnel (HttpRequest *request, const Comm::ConnectionPointer &clientConn, const Comm::ConnectionPointer &srvConn, const SBuf &preReadServerData) |
Variables | |
static ERCB | tunnelErrorComplete |
static CLCB | tunnelServerClosed |
static CLCB | tunnelClientClosed |
static CTCB | tunnelTimeout |
static EVH | tunnelDelayedClientRead |
static EVH | tunnelDelayedServerRead |
Function Documentation
◆ switchToTunnel()
void switchToTunnel | ( | HttpRequest * | request, |
const Comm::ConnectionPointer & | clientConn, | ||
const Comm::ConnectionPointer & | srvConn, | ||
const SBuf & | preReadServerData | ||
) |
Sets up a TCP tunnel through Squid and starts shoveling traffic.
- Parameters
-
request the request that initiated/caused this tunnel clientConn the already accepted client-to-Squid TCP connection srvConn the already established Squid-to-server TCP connection preReadServerData server-sent bytes to be forwarded to the client
Definition at line 1488 of file tunnel.cc.
References TunnelStateData::TunnelStateData(), StatCounters::all, HttpRequest::clientConnectionManager, TunnelStateData::commitToServer(), conn, debugs, DelayId::DelayClient(), Comm::Connection::fd, CbcPointer< Cbc >::get(), TunnelStateData::getHost(), Comm::Connection::getPeer(), HttpRequest::hier, CachePeer::host, Http::Message::http_ver, Comm::IsConnOpen(), HttpRequest::method, Must, CachePeer::no_delay, CachePeer::options, StatCounters::other, HttpRequest::peer_host, HttpRequest::prepForDirect(), HttpRequest::prepForPeering(), TunnelStateData::preReadServerData, TunnelStateData::request, StatCounters::requests, HierarchyLogEntry::resetPeerNotes(), StatCounters::server, TunnelStateData::server, TunnelStateData::Connection::setDelayId(), statCounter, and tunnelStartShoveling().
Referenced by Http::One::Server::noteTakeServerConnectionControl(), and Ssl::PeekingPeerConnector::startTunneling().
◆ tunnelClientClosed()
|
static |
Definition at line 317 of file tunnel.cc.
References TunnelStateData::clientClosed(), and CommCommonCbParams::data.
◆ tunnelConnectedWriteDone()
|
static |
All the pieces we need to write to client and/or server connection have been written. Call the tunnelStartShoveling to start the blind pump.
Definition at line 958 of file tunnel.cc.
References TunnelStateData::client, conn, debugs, CbcPointer< Cbc >::get(), ClientHttpRequest::Out::headers_sz, TunnelStateData::http, Comm::OK, ClientHttpRequest::out, Http::scInternalServerError, ClientHttpRequest::Out::size, TunnelStateData::status_ptr, tunnelErrorComplete, tunnelStartShoveling(), and TunnelStateData::Connection::writer.
Referenced by TunnelStateData::notePeerReadyToShovel().
◆ tunnelDelayedClientRead()
|
static |
Definition at line 834 of file tunnel.cc.
References TunnelStateData::client, TunnelStateData::codeContext, TunnelStateData::copyRead(), CodeContext::Current(), debugs, TunnelStateData::ReadClient(), TunnelStateData::Connection::readPending, and CodeContext::Reset().
◆ tunnelDelayedServerRead()
|
static |
Definition at line 850 of file tunnel.cc.
References TunnelStateData::codeContext, TunnelStateData::copyRead(), CodeContext::Current(), debugs, TunnelStateData::Connection::readPending, TunnelStateData::ReadServer(), CodeContext::Reset(), and TunnelStateData::server.
◆ tunnelErrorComplete()
Definition at line 1050 of file tunnel.cc.
References assert, TunnelStateData::client, Comm::Connection::close(), TunnelStateData::Connection::conn, debugs, Comm::IsConnOpen(), and TunnelStateData::server.
◆ tunnelServerClosed()
|
static |
Definition at line 301 of file tunnel.cc.
References CommCommonCbParams::data, and TunnelStateData::serverClosed().
◆ tunnelStart()
void tunnelStart | ( | ClientHttpRequest * | http | ) |
Definition at line 1139 of file tunnel.cc.
References TunnelStateData::TunnelStateData(), SquidConfig::accessList, ACLFilledChecklist::al, ClientHttpRequest::al, StatCounters::all, HttpRequest::client_addr, Server::clientConnection, AccessLogEntry::HttpDetails::code, Config, debugs, DelayId::DelayClient(), Acl::Answer::denied(), ERR_FORWARDING_DENIED, errorSend(), ACLChecklist::fastCheck(), ClientHttpRequest::getConn(), AccessLogEntry::http, TunnelStateData::http, Http::Message::http_ver, Ip::Address::isNoAddr(), LOG_TCP_TUNNEL, ClientHttpRequest::log_uri, HttpRequest::method, SquidConfig::miss, ACLFilledChecklist::my_addr, HttpRequest::my_addr, MYNAME, StatCounters::other, ClientHttpRequest::request, TunnelStateData::request, StatCounters::requests, Http::scForbidden, StatCounters::server, TunnelStateData::server, TunnelStateData::Connection::setDelayId(), ACLFilledChecklist::src_addr, PeerSelectionInitiator::startSelectingDestinations(), statCounter, ACLFilledChecklist::syncAle(), ClientHttpRequest::updateLoggingTags(), ClientHttpRequest::uri, and TunnelStateData::url.
Referenced by ClientHttpRequest::processRequest().
◆ tunnelStartShoveling()
|
static |
Set the HTTP status for this request and sets the read handlers for client and server side connections.
Definition at line 920 of file tunnel.cc.
References SBuf::append(), assert, TunnelStateData::Connection::buf, cbdataReferenceValid(), TunnelStateData::client, commCbCall(), commSetConnTimeout(), Config, TunnelStateData::Connection::conn, SBuf::consume(), TunnelStateData::copy(), TunnelStateData::copyClientBytes(), TunnelStateData::copyServerBytes(), DBG_DATA, debugs, TunnelStateData::encryptionWait, ClientHttpRequest::getConn(), TunnelStateData::http, Server::inBuf, SBuf::isEmpty(), TunnelStateData::Connection::len, TunnelStateData::peerWait, TunnelStateData::preReadClientData, SquidConfig::read, Http::scOkay, TunnelStateData::server, TunnelStateData::status_ptr, SquidConfig::Timeout, TunnelStateData::transportWait, tunnelTimeout, CbcPointer< Cbc >::valid(), and TunnelStateData::WriteClientDone().
Referenced by TunnelStateData::notePeerReadyToShovel(), switchToTunnel(), and tunnelConnectedWriteDone().
◆ tunnelTimeout()
|
static |
Definition at line 805 of file tunnel.cc.
References TunnelStateData::closeConnections(), CommCommonCbParams::conn, CommCommonCbParams::data, and debugs.
Variable Documentation
◆ tunnelClientClosed
|
static |
Definition at line 294 of file tunnel.cc.
Referenced by TunnelStateData::TunnelStateData().
◆ tunnelDelayedClientRead
|
static |
Definition at line 296 of file tunnel.cc.
Referenced by TunnelStateData::TunnelStateData().
◆ tunnelDelayedServerRead
|
static |
Definition at line 297 of file tunnel.cc.
Referenced by TunnelStateData::TunnelStateData().
◆ tunnelErrorComplete
|
static |
Definition at line 292 of file tunnel.cc.
Referenced by TunnelStateData::sendError(), and tunnelConnectedWriteDone().
◆ tunnelServerClosed
|
static |
Definition at line 293 of file tunnel.cc.
Referenced by TunnelStateData::commitToServer().
◆ tunnelTimeout
|
static |
Definition at line 295 of file tunnel.cc.
Referenced by TunnelStateData::TunnelStateData(), TunnelStateData::keepGoingAfterRead(), and tunnelStartShoveling().