aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/callbacks.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 7b06873..fa2ed1f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -825,16 +825,19 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat
g_object_get(download, "suggested-filename", &suggested_filename, NULL);
/* get the mimetype of the download */
- const gchar *content_type;
+ const gchar *content_type = NULL;
WebKitNetworkResponse *r = webkit_download_get_network_response(download);
/* downloads can be initiated from the context menu, in that case there is
no network response yet and trying to get one would crash. */
if(WEBKIT_IS_NETWORK_RESPONSE(r)) {
- SoupMessage *m = webkit_network_response_get_message(r);
- SoupMessageHeaders *h;
+ SoupMessage *m = webkit_network_response_get_message(r);
+ SoupMessageHeaders *h = NULL;
g_object_get(m, "response-headers", &h, NULL);
- content_type = soup_message_headers_get_one(h, "Content-Type");
- } else
+ if(h) /* some versions of libsoup don't have "response-headers" here */
+ content_type = soup_message_headers_get_one(h, "Content-Type");
+ }
+
+ if(!content_type)
content_type = "application/octet-stream";
/* get the filesize of the download, as given by the server.