45 debugs(33, 6,
"DownloaderContext constructed, this=" << (
void*)
this);
50 debugs(33, 6,
"DownloaderContext destructed, this=" << (
void*)
this);
65 os <<
"outcome=" << answer.
outcome;
148 request->client_addr.setNoAddr();
149#if FOLLOW_X_FORWARDED_FOR
150 request->indirect_client_addr.setNoAddr();
152 request->my_addr.setNoAddr();
153 request->my_addr.port(0);
154 request->downloader =
this;
156 debugs(11, 2,
"HTTP Client Downloader " <<
this <<
"/" <<
id);
157 debugs(11, 2,
"HTTP Client REQUEST:\n---------\n" <<
158 request->method <<
" " <<
url_ <<
" " << request->http_ver <<
"\n" <<
199 " object data, offset: " << receivedData.
offset <<
208 const int64_t existingContent = reply ? reply->
content_length : 0;
210 const bool tooLarge = (existingContent > -1 && existingContent >
static_cast<int64_t
>(maxSize)) ||
225 debugs(33, 3,
"Get more data");
234 debugs(33, 3,
"Object data transfer successfully complete");
238 debugs(33, 3,
"Object data transfer failed: STREAM_UNPLANNED_COMPLETE");
242 debugs(33, 3,
"Object data transfer failed: STREAM_FAILED");
246 fatal(
"unreachable code");
264 answer.outcome = statusCode;
#define ScheduleCallHere(call)
#define CallJobHere(debugSection, debugLevel, job, Class, method)
static void downloaderDetach(clientStreamNode *node, ClientHttpRequest *http)
std::ostream & operator<<(std::ostream &os, const DownloaderAnswer &answer)
static void downloaderRecipient(clientStreamNode *node, ClientHttpRequest *http, HttpReply *rep, StoreIOBuffer receivedData)
#define RefCountable
The locking interface for use on Reference-Counted classes.
int cbdataReferenceValid(const void *p)
#define CBDATA_CLASS_INIT(type)
a smart AsyncCall pointer for delivery of future results
virtual bool doneAll() const
whether positive goal has been reached
bool done() const
the job is destroyed in callEnd() when done()
Cbc * valid() const
was set and is valid
struct ClientHttpRequest::Out out
void initRequest(HttpRequest *)
size_t req_sz
raw request size on input, not current request size
ClientRequestContext * calloutContext
MEMPROXY_CLASS(DownloaderContext)
DownloaderContext(Downloader *dl, ClientHttpRequest *h)
char requestBuffer[HTTP_REQBUF_SZ]
~DownloaderContext() override
CbcPointer< Downloader > downloader
RefCount< DownloaderContext > Pointer
void callBack(Http::StatusCode const status)
AsyncCallback< Answer > callback_
answer destination
void downloadFinished()
delays destruction to protect doCallouts()
bool doneAll() const override
whether positive goal has been reached
void start() override
called by AsyncStart; do not call directly
SBuf url_
the url to download
static const size_t MaxObjectSize
The maximum allowed object size.
Downloader(const SBuf &url, const AsyncCallback< Answer > &, const MasterXactionPointer &, unsigned int level=0)
DownloaderContextPointer context_
Pointer to an object that stores the clientStream required info.
MasterXactionPointer masterXaction_
download transaction context
bool buildRequest()
Initializes and starts the HTTP GET request to the remote server.
SBuf object_
the object body data
void handleReply(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer)
static HttpRequest * FromUrl(const SBuf &url, const MasterXaction::Pointer &, const HttpRequestMethod &method=Http::METHOD_GET)
size_type length() const
Returns the number of bytes stored in SBuf.
SBuf & append(const SBuf &S)
static const size_type maxSize
Maximum size of a SBuf. By design it MUST be < MAX(size_type)/2. Currently 256Mb.
struct StoreIOBuffer::@123 flags
#define debugs(SECTION, LEVEL, CONTENT)
@ STREAM_UNPLANNED_COMPLETE
void fatal(const char *message)
clientStream_status_t clientStreamStatus(clientStreamNode *thisObject, ClientHttpRequest *http)
void clientStreamRead(clientStreamNode *thisObject, ClientHttpRequest *http, StoreIOBuffer readBuffer)
void clientStreamInit(dlink_list *list, CSR *func, CSD *rdetach, CSS *readstatus, const ClientStreamData &readdata, CSCB *callback, CSD *cdetach, const ClientStreamData &callbackdata, StoreIOBuffer tailBuffer)
void clientStreamDetach(clientStreamNode *thisObject, ClientHttpRequest *http)
AnyP::ProtocolVersion ProtocolVersion()
uint64_t size
Response header and body bytes written to the client connection.