Refactor image loading to a separate class. Add dependency to curl
[claws.git] / src / plugins / litehtml_viewer / http.h
diff --git a/src/plugins/litehtml_viewer/http.h b/src/plugins/litehtml_viewer/http.h
new file mode 100644 (file)
index 0000000..4c4b03f
--- /dev/null
@@ -0,0 +1,28 @@
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <curl/curl.h>
+#include <gio/gio.h>
+
+#define HTTP_GET_TIMEOUT 5L
+
+class http
+{
+    CURL*           curl;
+    static gchar*   response_data;
+    static size_t   response_size;
+
+public:
+    http();
+    ~http();
+
+    GInputStream *load_url(const gchar *url, GError **error);
+
+private:
+    static size_t curl_write_data(char* ptr, size_t size, size_t nmemb, void* data);
+    static void destroy_giostream(gpointer data);
+};
+
+