#include <HttpTunneler.h>

Inheritance diagram for Http::Tunneler:
Collaboration diagram for Http::Tunneler:


class  CbDialer
 Callback dialer API to allow Tunneler to set the answer. More...

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Tunneler (const Comm::ConnectionPointer &conn, const HttpRequestPointer &req, AsyncCall::Pointer &aCallback, time_t timeout, const AccessLogEntryPointer &alp)
 Tunneler (const Tunneler &)=delete
Tunneleroperator= (const Tunneler &)=delete
void setDelayId (DelayId delay_id)
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
void callStart (AsyncCall &call)
virtual void callEnd ()
 called right after the called job method More...
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
virtual void * toCbdata ()=0

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Protected Member Functions

virtual ~Tunneler ()
virtual void start ()
 called by AsyncStart; do not call directly More...
virtual bool doneAll () const
 whether positive goal has been reached More...
virtual void swanSong ()
virtual const char * status () const
 internal cleanup; do not call directly More...
void handleConnectionClosure (const CommCloseCbParams &)
void watchForClosures ()
 make sure we quit if/when the connection is gone More...
void handleException (const std::exception &)
void startReadingResponse ()
void writeRequest ()
void handleWrittenRequest (const CommIoCbParams &)
 Called when we are done writing a CONNECT request header to a peer. More...
void handleReadyRead (const CommIoCbParams &)
 Called when we read [a part of] CONNECT response from the peer. More...
void readMore ()
void handleResponse (const bool eof)
 Parses [possibly incomplete] CONNECT response and reacts to it. More...
void bailOnResponseError (const char *error, HttpReply *)
void bailWith (ErrorState *)
void callBack ()
TunnelerAnsweranswer ()
 convenience method to get to the answer fields More...
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...

Protected Attributes

const char * stopReason
 reason for forcing done() to be true More...
const char * typeName
 kid (leaf) class name, for debugging More...
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
const InstanceId< AsyncJobid
 job identifier More...

Private Member Functions

 CBDATA_CLASS (Tunneler)

Private Attributes

AsyncCall::Pointer writer
 called when the request has been written More...
AsyncCall::Pointer reader
 called when the response should be
AsyncCall::Pointer closer
 called when the connection is being closed More...
Comm::ConnectionPointer connection
 TCP connection to the cache_peer. More...
HttpRequestPointer request
 peer connection trigger or cause More...
AsyncCall::Pointer callback
 we call this with the results More...
SBuf url
 request-target for the CONNECT request More...
time_t lifetimeLimit
 do not run longer than this More...
AccessLogEntryPointer al
 info for the future access.log entry More...
DelayId delayId
SBuf readBuf
Http1::ResponseParserPointer hp
 Parser being used at present to parse the HTTP peer response. More...
const time_t startTime
 when the tunnel establishment started More...
bool requestWritten
 whether we successfully wrote the request More...
bool tunnelEstablished
 whether we got a 200 OK response More...

Detailed Description

Establishes an HTTP CONNECT tunnel through a forward proxy.

The caller receives a call back with Http::TunnelerAnswer.

The caller must monitor the connection for closure because this job will not inform the caller about such events.

This job never closes the connection, even on errors. If a 3rd-party closes the connection, this job simply quits without informing the caller.

Definition at line 38 of file HttpTunneler.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Tunneler() [1/2]

Http::Tunneler::Tunneler ( const Comm::ConnectionPointer conn,
const HttpRequestPointer req,
AsyncCall::Pointer aCallback,
time_t  timeout,
const AccessLogEntryPointer alp 

◆ Tunneler() [2/2]

Http::Tunneler::Tunneler ( const Tunneler )

◆ ~Tunneler()

Http::Tunneler::~Tunneler ( )

Definition at line 46 of file HttpTunneler.cc.

References debugs.

Referenced by setDelayId().

Member Function Documentation

◆ answer()

Http::TunnelerAnswer & Http::Tunneler::answer ( )

Definition at line 59 of file HttpTunneler.cc.

References callback, AsyncCall::getDialer(), and Must.

Referenced by bailWith(), handleResponse(), setDelayId(), and swanSong().

◆ bailOnResponseError()

void Http::Tunneler::bailOnResponseError ( const char *  error,
HttpReply errorReply 

◆ bailWith()

void Http::Tunneler::bailWith ( ErrorState error)

◆ callBack()

void Http::Tunneler::callBack ( )

Definition at line 336 of file HttpTunneler.cc.

References callback, connection, debugs, ScheduleCallHere, and status().

Referenced by bailWith(), setDelayId(), and swanSong().

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().


Http::Tunneler::CBDATA_CLASS ( Tunneler  )

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

◆ doneAll()

bool Http::Tunneler::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 52 of file HttpTunneler.cc.

References callback, requestWritten, and tunnelEstablished.

Referenced by setDelayId().

◆ handleConnectionClosure()

void Http::Tunneler::handleConnectionClosure ( const CommCloseCbParams params)

Definition at line 86 of file HttpTunneler.cc.

References callback, and AsyncJob::mustStop().

Referenced by setDelayId(), and watchForClosures().

◆ handleException()

void Http::Tunneler::handleException ( const std::exception &  e)

◆ handleReadyRead()

◆ handleResponse()

◆ handleWrittenRequest()

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), handleConnectionClosure(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ operator=()

Tunneler& Http::Tunneler::operator= ( const Tunneler )

◆ readMore()

◆ setDelayId()

◆ Start()

◆ start()

void Http::Tunneler::start ( )

◆ startReadingResponse()

void Http::Tunneler::startReadingResponse ( )

Definition at line 116 of file HttpTunneler.cc.

References connection, debugs, readBuf, readMore(), SBuf::reserveCapacity(), and status().

Referenced by setDelayId(), and start().

◆ status()

◆ swanSong()

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ watchForClosures()

void Http::Tunneler::watchForClosures ( )

◆ writeRequest()

Member Data Documentation

◆ al

◆ callback

AsyncCall::Pointer Http::Tunneler::callback

◆ closer

AsyncCall::Pointer Http::Tunneler::closer

Definition at line 100 of file HttpTunneler.h.

Referenced by swanSong(), and watchForClosures().

◆ connection

◆ delayId

DelayId Http::Tunneler::delayId

Definition at line 109 of file HttpTunneler.h.

Referenced by handleReadyRead(), and setDelayId().

◆ hp

Http1::ResponseParserPointer Http::Tunneler::hp

Definition at line 114 of file HttpTunneler.h.

Referenced by handleResponse().

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ lifetimeLimit

time_t Http::Tunneler::lifetimeLimit

Definition at line 106 of file HttpTunneler.h.

Referenced by readMore(), and start().

◆ readBuf

SBuf Http::Tunneler::readBuf

either unparsed response or post-response bytes

Definition at line 112 of file HttpTunneler.h.

Referenced by handleReadyRead(), handleResponse(), and startReadingResponse().

◆ reader

AsyncCall::Pointer Http::Tunneler::reader

Definition at line 99 of file HttpTunneler.h.

Referenced by handleReadyRead(), readMore(), and swanSong().

◆ request

◆ requestWritten

bool Http::Tunneler::requestWritten

Definition at line 118 of file HttpTunneler.h.

Referenced by doneAll(), handleWrittenRequest(), status(), and swanSong().

◆ startTime

const time_t Http::Tunneler::startTime

Definition at line 116 of file HttpTunneler.h.

Referenced by readMore().

◆ stopReason

const char* AsyncJob::stopReason

◆ tunnelEstablished

bool Http::Tunneler::tunnelEstablished

Definition at line 119 of file HttpTunneler.h.

Referenced by doneAll(), handleResponse(), status(), and swanSong().

◆ typeName

◆ url

SBuf Http::Tunneler::url

Definition at line 105 of file HttpTunneler.h.

Referenced by start(), Tunneler(), and writeRequest().

◆ writer

AsyncCall::Pointer Http::Tunneler::writer

Definition at line 98 of file HttpTunneler.h.

Referenced by handleWrittenRequest(), and writeRequest().

The documentation for this class was generated from the following files:






Web Site Translations