]> git.ipfire.org Git - thirdparty/squid.git/blame - src/Downloader.h
Restrict the number of downloaded certificates and the nested certificates
[thirdparty/squid.git] / src / Downloader.h
CommitLineData
55369ae6
AR
1#ifndef SQUID_DOWNLOADER_H
2#define SQUID_DOWNLOADER_H
3
4#include "client_side.h"
5#include "cbdata.h"
6
7class Downloader: public ConnStateData
8{
9 CBDATA_CLASS(Downloader);
10 // XXX CBDATA_CLASS expands to nonvirtual toCbdata, AsyncJob::toCbdata
11 // is pure virtual. breaks build on clang if override is used
12
13public:
14 class CbDialer {
15 public:
16 CbDialer(): status(Http::scNone) {}
17 virtual ~CbDialer() {}
18 SBuf object;
19 Http::StatusCode status;
20 };
21
4e526b93 22 explicit Downloader(SBuf &url, const MasterXaction::Pointer &xact, AsyncCall::Pointer &aCallback, unsigned int level = 0);
55369ae6
AR
23 virtual ~Downloader();
24 void downloadFinished();
4e526b93
CT
25
26 /// The nested level of Downloader object (downloads inside downloads)
27 unsigned int nestedLevel() const {return level_;}
55369ae6
AR
28
29 /* ConnStateData API */
30 virtual bool isOpen() const;
31
32 /* AsyncJob API */
33 virtual void callException(const std::exception &e);
34 virtual bool doneAll() const;
35
36 /*Bodypipe API*/
37 virtual void noteMoreBodySpaceAvailable(BodyPipe::Pointer);
38 virtual void noteBodyConsumerAborted(BodyPipe::Pointer);
39
40protected:
41 /* ConnStateData API */
42 virtual ClientSocketContext *parseOneRequest();
43 virtual void processParsedRequest(ClientSocketContext *context);
44 virtual time_t idleTimeout() const;
45 virtual void writeControlMsgAndCall(ClientSocketContext *context, HttpReply *rep, AsyncCall::Pointer &call);
46 virtual void handleReply(HttpReply *header, StoreIOBuffer receivedData);
47
48 /* AsyncJob API */
49 virtual void start();
50
51private:
52 void callBack();
53 SBuf url_;
54 AsyncCall::Pointer callback;
55 Http::StatusCode status;
56 SBuf object; //object data
57 size_t maxObjectSize;
4e526b93 58 unsigned int level_; ///< Holds the nested downloads level
55369ae6
AR
59};
60
61#endif