status(Http::scNone),
level_(level)
{
- maxObjectSize = 512*1024;
}
Downloader::~Downloader()
Downloader::handleReply(HttpReply *reply, StoreIOBuffer receivedData)
{
bool existingContent = reply ? reply->content_length : 0;
- bool exceedSize = (getCurrentContext()->startOfOutput() && existingContent > -1 && (size_t)existingContent > maxObjectSize) ||
- ((object.length() + receivedData.length) > maxObjectSize);
+ bool exceedSize = (getCurrentContext()->startOfOutput() && existingContent > -1 && (size_t)existingContent > MaxObjectSize) ||
+ ((object.length() + receivedData.length) > MaxObjectSize);
if (exceedSize) {
status = Http::scInternalServerError;
// is pure virtual. breaks build on clang if override is used
public:
+
+ /// Callback data to use with Downloader callbacks;
class CbDialer {
public:
CbDialer(): status(Http::scNone) {}
explicit Downloader(SBuf &url, const MasterXaction::Pointer &xact, AsyncCall::Pointer &aCallback, unsigned int level = 0);
virtual ~Downloader();
+
+ /// Fake call used internally by Downloader.
void downloadFinished();
/// The nested level of Downloader object (downloads inside downloads)
virtual void start();
private:
+ /// Schedules for execution the "callback" with parameters the status
+ /// and object
void callBack();
- SBuf url_;
- AsyncCall::Pointer callback;
- Http::StatusCode status;
+
+ static const size_t MaxObjectSize = 1*1024*1024; ///< The maximum allowed object size.
+
+ SBuf url_; ///< The url to download
+ AsyncCall::Pointer callback; ///< callback to call when download finishes
+ Http::StatusCode status; ///< The download status code
SBuf object; //object data
- size_t maxObjectSize;
unsigned int level_; ///< Holds the nested downloads level
};
return buf.content();
}
+/// CallDialer to allow use Downloader objects within PeerConnector class.
class PeerConnectorCertDownloaderDialer: public CallDialer, public Downloader::CbDialer
{
public:
os << '(' << peerConnector_.get() << ", Http Status:" << status << ')';
}
- Method method_;
- CbcPointer<Ssl::PeerConnector> peerConnector_;
+ Method method_; ///< The Ssl::PeerConnector method to dial
+ CbcPointer<Ssl::PeerConnector> peerConnector_; ///< The Ssl::PeerConnector object
};
void
/// Squid COMM_SELECT_READ handler.
void noteWantRead();
+ /// Run the certificates list sent by SSL server and see if there are
+ /// missing certificates. For the certificates there is a issuer URL
+ /// add it to the urlsOfMissingCerts list
bool checkForMissingCertificates();
+ /// Start downloading procedure for the given URL
void startCertDownloading(SBuf &url);
+ /// Called by Downloader after a certificate object downloaded
void certDownloadingDone(SBuf &object, int status);
/// Called when the openSSL SSL_connect function needs to write data to