#include <HttpTunneler.h>

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

Classes

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...
 

Public Attributes

bool noteFwdPconnUse
 hack: whether the connection requires fwdPconnPool->noteUses() 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 handleTimeout (const CommTimeoutCbParams &)
 The connection read timeout callback handler. More...
 
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 *)
 sends the given error to the initiator More...
 
void sendSuccess ()
 sends the ready-to-use tunnel to the initiator More...
 
void callBack ()
 a bailWith(), sendSuccess() helper: sends results to the initiator More...
 
void disconnect ()
 a bailWith(), sendSuccess() helper: stops monitoring the connection More...
 
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 read More...
 
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

Negotiates an HTTP CONNECT tunnel through a forward proxy using a given (open and, if needed, encrypted) TCP connection to that proxy. Owns the connection during these negotiations. The caller receives TunnelerAnswer.

Definition at line 32 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 )
delete

◆ ~Tunneler()

Http::Tunneler::~Tunneler ( )
protectedvirtual

Definition at line 50 of file HttpTunneler.cc.

References debugs.

Member Function Documentation

◆ answer()

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

Definition at line 63 of file HttpTunneler.cc.

References callback, and Must.

◆ bailOnResponseError()

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

Definition at line 343 of file HttpTunneler.cc.

References debugs, ERR_CONNECT_FAIL, error(), request(), and Http::scBadGateway.

◆ bailWith()

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

◆ callBack()

void Http::Tunneler::callBack ( )
protected

Definition at line 402 of file HttpTunneler.cc.

References callback, debugs, and ScheduleCallHere.

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

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

◆ CBDATA_CLASS()

Http::Tunneler::CBDATA_CLASS ( Tunneler  )
private

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ disconnect()

void Http::Tunneler::disconnect ( )
protected

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Http::Tunneler::doneAll ( ) const
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 56 of file HttpTunneler.cc.

References callback.

◆ handleConnectionClosure()

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

Definition at line 101 of file HttpTunneler.cc.

References ERR_CONNECT_FAIL, request(), and Http::scBadGateway.

Referenced by watchForClosures().

◆ handleReadyRead()

◆ handleResponse()

◆ handleTimeout()

void Http::Tunneler::handleTimeout ( const CommTimeoutCbParams )
protected

Definition at line 124 of file HttpTunneler.cc.

References ERR_CONNECT_FAIL, request(), and Http::scGatewayTimeout.

Referenced by readMore().

◆ handleWrittenRequest()

◆ mustStop()

◆ operator=()

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

◆ readMore()

void Http::Tunneler::readMore ( )
protected

◆ sendSuccess()

void Http::Tunneler::sendSuccess ( )
protected

Definition at line 377 of file HttpTunneler.cc.

References assert.

◆ setDelayId()

void Http::Tunneler::setDelayId ( DelayId  delay_id)
inline

Definition at line 65 of file HttpTunneler.h.

References delayId.

◆ start()

void Http::Tunneler::start ( )
protectedvirtual

◆ Start()

◆ startReadingResponse()

void Http::Tunneler::startReadingResponse ( )
protected

Definition at line 130 of file HttpTunneler.cc.

References debugs.

◆ status()

const char * Http::Tunneler::status ( ) const
protectedvirtual

for debugging, starts with space

Reimplemented from AsyncJob.

Definition at line 430 of file HttpTunneler.cc.

References buf, and callback.

◆ swanSong()

void Http::Tunneler::swanSong ( )
protectedvirtual

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ watchForClosures()

void Http::Tunneler::watchForClosures ( )
protected

◆ writeRequest()

Member Data Documentation

◆ al

AccessLogEntryPointer Http::Tunneler::al
private

Definition at line 114 of file HttpTunneler.h.

◆ callback

AsyncCall::Pointer Http::Tunneler::callback
private

Definition at line 111 of file HttpTunneler.h.

Referenced by Tunneler().

◆ closer

AsyncCall::Pointer Http::Tunneler::closer
private

Definition at line 107 of file HttpTunneler.h.

◆ connection

Comm::ConnectionPointer Http::Tunneler::connection
private

Definition at line 109 of file HttpTunneler.h.

Referenced by Tunneler().

◆ delayId

DelayId Http::Tunneler::delayId
private

Definition at line 116 of file HttpTunneler.h.

Referenced by setDelayId().

◆ hp

Http1::ResponseParserPointer Http::Tunneler::hp
private

Definition at line 121 of file HttpTunneler.h.

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ lifetimeLimit

time_t Http::Tunneler::lifetimeLimit
private

Definition at line 113 of file HttpTunneler.h.

◆ noteFwdPconnUse

bool Http::Tunneler::noteFwdPconnUse

Definition at line 69 of file HttpTunneler.h.

◆ readBuf

SBuf Http::Tunneler::readBuf
private

either unparsed response or post-response bytes

Definition at line 119 of file HttpTunneler.h.

◆ reader

AsyncCall::Pointer Http::Tunneler::reader
private

Definition at line 106 of file HttpTunneler.h.

◆ request

HttpRequestPointer Http::Tunneler::request
private

Definition at line 110 of file HttpTunneler.h.

Referenced by Tunneler().

◆ requestWritten

bool Http::Tunneler::requestWritten
private

Definition at line 125 of file HttpTunneler.h.

◆ startTime

const time_t Http::Tunneler::startTime
private

Definition at line 123 of file HttpTunneler.h.

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ tunnelEstablished

bool Http::Tunneler::tunnelEstablished
private

Definition at line 126 of file HttpTunneler.h.

◆ typeName

◆ url

SBuf Http::Tunneler::url
private

Definition at line 112 of file HttpTunneler.h.

Referenced by Tunneler().

◆ writer

AsyncCall::Pointer Http::Tunneler::writer
private

Definition at line 105 of file HttpTunneler.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors