Refactor http class to prevent memory leak
[claws.git] / src / plugins / litehtml_viewer / http.h
1 #include <glib.h>
2 #include <glib/gstdio.h>
3 #include <fcntl.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <curl/curl.h>
7 #include <gio/gio.h>
8
9 #define HTTP_GET_TIMEOUT 5L
10
11 class http
12 {
13     CURL*           curl;
14     GInputStream*   stream;
15
16 public:
17     http();
18     ~http();
19
20     GInputStream *load_url(const gchar *url, GError **error);
21
22 private:
23     static size_t curl_write_data(char* ptr, size_t size, size_t nmemb, void* data_ptr);
24     void destroy_giostream();
25 };
26
27