about summary refs log tree commit diff stats
path: root/tests/unittests/tools
diff options
context:
space:
mode:
authorWilliam Wennerström <william@wstrm.dev>2020-07-05 17:21:20 +0200
committerWilliam Wennerström <william@wstrm.dev>2020-11-16 21:58:09 +0100
commiteebf54c8596abd5c28b405d8860c173207bbec64 (patch)
treebb1abfaad055aadbb0908dff921259a6e5967aa3 /tests/unittests/tools
parent9499df65859abd1404d3f9e96b8af859d3315bff (diff)
downloadprofani-tty-eebf54c8596abd5c28b405d8860c173207bbec64.tar.gz
Infer filename from content-disposition or URL
The Content-Disposition inferring is probably a bad idea security wise,
so I am going to remove it.
Diffstat (limited to 'tests/unittests/tools')
-rw-r--r--tests/unittests/tools/stub_http_download.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unittests/tools/stub_http_download.c b/tests/unittests/tools/stub_http_download.c
new file mode 100644
index 00000000..a07146b4
--- /dev/null
+++ b/tests/unittests/tools/stub_http_download.c
@@ -0,0 +1,28 @@
+#ifndef TOOLS_HTTP_DOWNLOAD_H
+#define TOOLS_HTTP_DOWNLOAD_H
+
+#include <curl/curl.h>
+#include <pthread.h>
+
+typedef struct prof_win_t ProfWin;
+
+typedef struct http_download_t {
+    char *url;
+    char *filename;
+    char *directory;
+    FILE *filehandle;
+    curl_off_t bytes_received;
+    ProfWin *window;
+    pthread_t worker;
+    int cancel;
+} HTTPDownload;
+
+
+void* http_file_get(void *userdata);
+
+void http_download_cancel_processes(ProfWin *window);
+void http_download_add_download(HTTPDownload *download);
+
+char *http_filename_from_url(const char *url);
+
+#endif