#include <Downloader.h>

Inheritance diagram for Downloader:
Collaboration diagram for Downloader:


class  CbDialer
 Callback data to use with Downloader callbacks. More...

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Downloader (SBuf &url, AsyncCall::Pointer &aCallback, const XactionInitiator initiator, unsigned int level=0)
virtual ~Downloader ()
virtual void swanSong ()
void downloadFinished ()
 delays destruction to protect doCallouts() More...
unsigned int nestedLevel () const
 The nested level of Downloader object (downloads inside downloads). More...
void handleReply (clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer)
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 bool doneAll () const
 whether positive goal has been reached More...
virtual void start ()
 called by AsyncStart; do not call directly More...
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual const char * status () const
 internal cleanup; do not call directly 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 (Downloader)
bool buildRequest ()
 Initializes and starts the HTTP GET request to the remote server. More...
void callBack (Http::StatusCode const status)

Private Attributes

SBuf url_
 the url to download More...
AsyncCall::Pointer callback_
 callback to call when download finishes More...
SBuf object_
 the object body data More...
const unsigned int level_
XactionInitiator initiator_
 The initiator of the download request. More...
DownloaderContextPointer context_
 Pointer to an object that stores the clientStream required info. More...

Static Private Attributes

static const size_t MaxObjectSize = 1*1024*1024
 The maximum allowed object size. More...

Detailed Description

The Downloader class fetches SBuf-storable things for other Squid components/transactions using internal requests. For example, it is used to fetch missing intermediate certificates when validating origin server certificate chains.

Definition at line 29 of file Downloader.h.

Member Typedef Documentation

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

Downloader::Downloader ( SBuf url,
AsyncCall::Pointer aCallback,
const XactionInitiator  initiator,
unsigned int  level = 0 

Definition at line 66 of file Downloader.cc.

Downloader::~Downloader ( )

Definition at line 75 of file Downloader.cc.

References debugs.

Member Function Documentation

void Downloader::callBack ( Http::StatusCode const  statusCode)

Schedules for execution the "callback" with parameters the status and object.

Definition at line 254 of file Downloader.cc.

References callback_, CallJobHere, downloadFinished(), AsyncCall::getDialer(), Must, Downloader::CbDialer::object, object_, ScheduleCallHere, Http::scOkay, and Downloader::CbDialer::status.

Referenced by handleReply(), and start().

void AsyncJob::callEnd ( )
void AsyncJob::callStart ( AsyncCall call)
bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file AsyncJob.cc.

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

Downloader::CBDATA_CLASS ( Downloader  )
void AsyncJob::deleteThis ( const char *  aReason)
bool AsyncJob::done ( ) const

Definition at line 90 of file AsyncJob.cc.

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and downloadFinished().

bool Downloader::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 91 of file Downloader.cc.

References callback_, AsyncCall::canceled(), and AsyncJob::doneAll().

void Downloader::downloadFinished ( )

Definition at line 245 of file Downloader.cc.

References debugs, AsyncJob::done(), and Must.

Referenced by callBack().

unsigned int Downloader::nestedLevel ( ) const
void Downloader::start ( )

Reimplemented from AsyncJob.

Definition at line 179 of file Downloader.cc.

References buildRequest(), callBack(), and Http::scInternalServerError.

void Downloader::swanSong ( )

Reimplemented from AsyncJob.

Definition at line 81 of file Downloader.cc.

References context_, debugs, and DownloaderContext::finished().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

AsyncCall::Pointer Downloader::callback_

Definition at line 76 of file Downloader.h.

Referenced by callBack(), and doneAll().

DownloaderContextPointer Downloader::context_

Definition at line 83 of file Downloader.h.

Referenced by buildRequest(), handleReply(), and swanSong().

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
XactionInitiator Downloader::initiator_

Definition at line 80 of file Downloader.h.

Referenced by buildRequest().

const unsigned int Downloader::level_

holds the nested downloads level

Definition at line 78 of file Downloader.h.

Referenced by nestedLevel().

const size_t Downloader::MaxObjectSize = 1*1024*1024

Definition at line 73 of file Downloader.h.

Referenced by handleReply().

SBuf Downloader::object_

Definition at line 77 of file Downloader.h.

Referenced by callBack(), and handleReply().

const char* AsyncJob::stopReason
SBuf Downloader::url_

Definition at line 75 of file Downloader.h.

Referenced by buildRequest().

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






Web Site Translations