diff ui/sslconnection.h @ 910:eaed02defe6a

More SSLConnection refactoring. Fixes curl downloader.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 18 Aug 2014 18:51:33 +0200
parents d1c951b3012d
children 879a634d0a40
line wrap: on
line diff
--- a/ui/sslconnection.h	Thu Aug 14 11:24:13 2014 +0200
+++ b/ui/sslconnection.h	Mon Aug 18 18:51:33 2014 +0200
@@ -51,18 +51,6 @@
 
     virtual ~SSLConnection() {};
 
-    /** @brief write */
-    virtual int write(const QByteArray& request) = 0;
-
-    /**
-     * @brief read at most len bytes and reset the connection
-     *
-     * @param [in] len Amount of bytes to read.
-     *
-     * @returns a byte array containing the data or
-     * a NULL byte array on error*/
-    virtual QByteArray read(size_t len) = 0;
-
     bool initialized() { return mInitialized; }
     bool connected() { return mConnected; }
 
@@ -74,6 +62,30 @@
      */
     virtual int connect() = 0;
 
+    /** @brief get the last modified header of a resource.
+     *
+     * Connection should be established beforehand.
+     * Modifies the error state.
+     *
+     * @param[in] resource The resource to check
+     *
+     * @returns the last modified date or a null datetime in case of errors
+     */
+    virtual QDateTime getLastModifiedHeader(const QString &resource) = 0;
+
+    /** @brief Download resource
+     *
+     * Download a resource with the established connection.
+     * Modifies the error state.
+     *
+     * @param[in] resource the resource to download
+     * @param[in] filename where the file should be saved.
+     * @param[in] maxSize maximum amount of bytes to download
+     *
+     * @returns True if the download was successful.
+     */
+    virtual bool downloadFile(const QString &resource, const QString &filename,
+                              size_t maxSize) = 0;
 protected:
     QUrl mUrl;
     QByteArray mPinnedCert;

http://wald.intevation.org/projects/trustbridge/